-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathchimera.py
75 lines (58 loc) · 1.94 KB
/
chimera.py
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
64
65
66
67
68
69
70
71
72
73
74
75
# --------------------------------------------------------
#
# Chimera Core Revision 3
# Created by:
# Andromeda <[email protected]>
# Jobe <[email protected]>
#
# --------------------------------------------------------
# Load some libs
#moo
# Include some files
import config
import modules.irc
import modules.sock
import modules.parser as parser
import modules.channels
import modules.commands
from subprocess import call
irc = modules.irc.irc()
chanlist = modules.channels.chanlist()
cmd = modules.commands.commands()
sock = modules.sock.sock()
irc.setsock(sock)
cmd.setsock(sock)
sock.connect(config.server, config.port)
irc.conn_nick(config.nick)
irc.conn_user(config.ident, config.realname)
# Begin the loop if we're good to go
while 1:
feed = sock.recv()
feed = feed.splitlines()
for line in feed:
print line
x = parser.parse_raw_irc(line)
if (x['msg'] == "PING"):
irc.ping(x['params'][-1])
if (x['msg'] == "001"):
irc.umode(config.nick)
irc.join(config.channels)
if (x['msg'] == "JOIN"):
chanlist.addchannel(x['params'][0])
if (x['msg'] == "PART"):
chanlist.delchannel(x['params'][0])
if (x['msg'] == "KICK"):
if (x['params'][1].lower() == botnick.lower()):
chanlist.delchannel(x['params'][0])
if (x['msg'] == "NICK"):
if (x['source']['name'].lower() == botnick.lower()):
botnick = x['params'][0]
if (x['msg'] == "PRIVMSG"):
if (chanlist.ischannel(x['params'][0])):
if (x['params'][1][0] == config.prefix):
tmp = x['params'][1][1:]
com = tmp.split(' ')
if (com[0].lower() == "uptime"):
cmd.uptime(x['params'][0])
if (x['params'][1] == "\x01VERSION\x01"):
cmd.version(x['source']['name'])