forked from mniemela/kerhotonttu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbotcommands.py
86 lines (50 loc) · 1.65 KB
/
botcommands.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
76
77
78
79
80
81
82
83
84
85
86
# -*- coding: iso-8859-1 -*-
import random
# tähän sanastoon lisätään komennot ja niitä vastaavat oliot
command_dict = {}
class Test:
def main( self, irc, line, target ):
irc.send( 'PRIVMSG %s :Hello world!' % line[2] )
command_dict[ ':!test' ] = Test()
class Join:
def main( self, irc, line, target):
irc.send( 'JOIN %s' % ( line[4] ) )
command_dict[ ':!join' ] = Join()
class Quit:
def main( self, irc , line, target):
if irc.connected:
irc.send( 'QUIT' )
try:
irc.socket.close()
except:
print "Error closing connection"
irc.done = 1
command_dict[ ':!quit' ] = Quit()
class Ovi:
def main( self, irc, line, target):
if target is None:
irc.ser.write("O")
command_dict[ ':!ovi' ] = Ovi()
class Stats:
def main(self, irc, line, target):
irc.sendprivmsg(target, "Tilastoja löytyy osoitteesta http://xcalibur.cc.tut.fi/~mikael/stats.html")
command_dict[ ':!stats'] = Stats()
class Valo:
def main(self, irc, line, target):
if target is None:
irc.ser.write("V")
command_dict[ ':!valo' ] = Valo()
class Lampo:
def main( self, irc, line, target):
if target is None:
irc.ser.write("L")
command_dict[ ':!lampo' ] = Lampo()
class Viisaus:
def main(self, irc, line, target):
if len(line) > 5 and len(line[5]) > 0:
irc.wisdom(line[4], line[5], target=target)
elif len(line) > 4 and len(line[4]) > 0:
irc.wisdom(line[4], target=target)
else:
irc.wisdom(target=target)
command_dict[ ':!viisaus' ] = Viisaus()