69 up = data['list'][0]['thumbs_up'] |
84 up = data['list'][0]['thumbs_up'] |
70 down = data['list'][0]['thumbs_down'] |
85 down = data['list'][0]['thumbs_down'] |
71 bot.privmsg (replyto, "\002%s\002: %s\0033 %d\003 up,\0035 %d\003 down" % (word, definition, up, down)) |
86 bot.privmsg (replyto, "\002%s\002: %s\0033 %d\003 up,\0035 %d\003 down" % (word, definition, up, down)) |
72 except Exception as e: |
87 except Exception as e: |
73 command_error ('Urban dictionary lookup failed: %s' % e) |
88 command_error ('Urban dictionary lookup failed: %s' % e) |
|
89 |
|
90 def cmd_commands (bot, replyto, ident, host, **rest): |
|
91 commandlist = ModuleCore.get_available_commands (ident, host) |
|
92 partitioned=[] |
|
93 |
|
94 while len (commandlist) > 0: |
|
95 partitioned.append (commandlist[0:15]) |
|
96 commandlist = commandlist[15:] |
|
97 |
|
98 for part in partitioned: |
|
99 bot.privmsg (replyto, 'Available commands: %s' % (", ".join (part))) |
|
100 |
|
101 def cmd_help (bot, replyto, ident, host, args, **rest): |
|
102 cmd = ModuleCore.get_command_by_name (args['command']) |
|
103 |
|
104 if not cmd: |
|
105 command_error ('unknown command \'%s\'' % args['command']) |
|
106 |
|
107 if not ModuleCore.is_available (cmd, ident, host): |
|
108 command_error ('you may not use %s' % cmd['name']) |
|
109 |
|
110 bot.privmsg (replyto, '%s %s: %s' % (cmd['name'], cmd['args'], cmd['description'])) |