PREPARE FOR CHAOS. Also, twitter added to markov
[scrappy.git] / modules / core / core.py
blobe42e2f776345ebace36a7283b66a92aa18958cc1
1 #Module for scrappy that implements some core commands, like 'help'
3 import sys
5 def init(scrap):
6 #register commands
7 scrap.register_event("core", "msg", help_cmd)
8 scrap.register_event("core", "msg", join_cmd)
10 def help_cmd(c,list,bot):
11 """help - Lists all available commands and their docstrings"""
12 if list[4] == "help" and list[3]:
13 #put the events into a set so we can compute the union
14 #Or maybe we should use sets for the events from the start?
16 s1 = set()
17 s2 = set()
19 for event in bot.privmsg_events:
20 s1.add(event.__doc__)
21 for event in bot.pubmsg_events:
22 s2.add(event.__doc__)
24 funcnames = s1.union(s2)
26 for name in funcnames:
27 c.privmsg(list[0],name)
29 def join_cmd(c,list,bot):
30 """join a channel"""
31 cmd = list[4].split(" ")[0]
33 #replace tcoppi with the name of the bot owner(config option)
34 if cmd == "join" and list[0] == "tcoppi":
35 chan = list[4].split(" ")[1]
36 c.join(chan)