-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
63 lines (52 loc) · 1.14 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
using System.Collections.Generic;
using Meebey.SmartIrc4net;
//todo
//link (like quote)
namespace Bot
{
public class Bot
{
private IrcClient _irc = new IrcClient();
private IEnumerable<IBottable> _modules;
public Bot()
{
//admin must always come first
_modules = new List<IBottable>
{
new Admin(_irc),
new Quote(_irc),
new Rainbow(_irc),
new Big(_irc),
new Puppet(_irc),
new LOTD(_irc),
new EightBall(_irc),
new KickMe(_irc)
};
_irc.ActiveChannelSyncing = true;
_irc.OnReadLine += OnReadLine;
_irc.SendDelay = 500;
}
private void OnReadLine(object sender, ReadLineEventArgs e)
{
IrcMessageData data = _irc.MessageParser(e.Line);
if (!_irc.IsMe(data.Nick))
foreach (var bottable in Modules)
if (!bottable.OnReadLine(data))
break;
//_irc.ListenOnce();
}
public IEnumerable<IBottable> Modules
{
get { return _modules; }
}
}
class Program
{
static void Main(string[] args)
{
Bot bot = new Bot();
foreach (var bottable in bot.Modules)
bottable.OnConsoleLine(args);
}
}
}