-
Notifications
You must be signed in to change notification settings - Fork 0
/
main.py
executable file
·46 lines (34 loc) · 1.05 KB
/
main.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
import csv
import socket
HOST="127.0.0.1"
PORT=6667
readbuffer=""
diction = {}
inplay = True
reader = csv.reader(open("kaos.db"), [], delimiter="*")
for line in reader:
diction[line[0]] = line[1:]
print diction
cb=socket.socket( )
cb.connect((HOST, PORT))
cb.send("NICK cheatbot\r\n" )
cb.send("USER cheatbot cheatbot bla :CHEATBOT\r\n" )
cb.send("JOIN #games\r\n")
while 1:
data = cb.recv ( 4096 )
if data.find ( 'PING' ) != -1:
cb.send ( 'PONG ' + data.split() [ 1 ] + '\r\n' )
if data.find ( '!cheatbot stop' ) != -1:
inplay = False
cb.send("PRIVMSG #games : NOT PLAYING\r\n")
if data.find ( '!cheatbot start' ) != -1:
inplay = True
cb.send("PRIVMSG #games : PLAYING\r\n")
if inplay == True:
data = data.lower()
for i in diction:
if data.find( i.lower() ) != -1:
for item in diction[i]:
cb.send("PRIVMSG #games :" + item + "\r\n")
print item
print data