-
Notifications
You must be signed in to change notification settings - Fork 0
/
jaubot.py
executable file
·63 lines (47 loc) · 1.34 KB
/
jaubot.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
#!/usr/local/bin/python2.4
# Ircbot for pinging.
import ircbot, time, urlbot3, pingbot, os, sys, reminderbot, replybot
# quotebot, evalbot, pinky, delistore
debuglog=open("debug.log","w")
def debug(*args):
debuglog.write("%s: "% (time.asctime()))
for a in args:
debuglog.write(str(a))
debuglog.write("\n")
debuglog.flush()
ircbot.debug=debug
server=("irc.kolumbus.fi",6667)
nick="jaubot"
name="Bot by Juha Autero <jautero@iki.fi>"
channels=["#espoohacklab"]
bot=ircbot.Bot(nick=nick,channels=channels,name=name)
bot.restart=0
def invite(m, origin, args, text, bot=bot):
chan=text
if chan in bot.channels:
bot.todo(['JOIN', chan])
def leave(m, origin, args, text, bot=bot):
if text=="restart":
bot.restart=1
bot.todo(['QUIT'], "bye bye!")
bot.rule(invite,'invite',cmd="INVITE")
bot.rule(leave,'leave',cmd="KICK")
urlstore=urlbot3.DummyStore(False)
urlbot3.init_bot(bot,urlstore)
pingbot.init_bot(bot)
reminderbot.init_bot(bot)
#pinky.init_bot(bot)
replybot.init_bot(bot)
#quotebot.init_bot(bot)
#evalbot.init_bot(bot)
ircbot.doubleFork()
bot.run(server[0],server[1])
#evalbot.uninit_bot(bot)
#quotebot.uninit_bot(bot)
urlbot3.uninit_bot(bot)
pingbot.uninit_bot(bot)
reminderbot.uninit_bot(bot)
replybot.uninit_bot(bot)
#pinky.uninit_bot(bot)
#if bot.restart:
# os.execlp(sys.argv[0],sys.argv)