markdown makes me want to smash something
[synarere.git] / modules / list.py
blobffc8df8d1b18b15ec7587b17e16697e2577082fa
1 # synarere -- a highly modular and stable IRC bot.
2 # Copyright (C) 2010 Michael Rodriguez.
3 # Rights to this code are documented in docs/LICENSE.
5 # You're going to want to have this one threaded.
7 from core import command, shutdown
8 import pprint
10 def list_end(conn, origin, parv):
11 global channels
12 pprint.pprint(channels)
13 del channels
15 def list_chan(conn, origin, parv):
16 global channels
17 groups = re.match(r'^(.+) (\d+) :(.*)', parv[1]).groups()
18 channels.append(groups)
20 def cmd_list(conn, (nick, user, host), target, message):
21 global channels
22 channels = []
23 command.add('323', list_end, command.irc)
24 command.add('322', list_chan, command.irc)
25 conn.push('LIST')
27 def module_init():
28 command.add('.list', cmd_list, command.chan)
30 def module_fini():
31 command.delete('.list', cmd_list, command.chan)