plugins.set_client(client)
@asyncio.coroutine
+def builtin_commands(message, command, raw):
+ if command == 'plugins':
+ all_plugins = list(plugins.plugins())
+ if len(all_plugins):
+ lines = []
+ for name in all_plugins:
+ description = plugins.description(name)
+ if description is not None:
+ lines.append('{}: {}'.format(name, description))
+ else:
+ lines.append(name)
+ yield from bot.say_many(message.channel, lines)
+ else:
+ yield from bot.say(message.channel, 'shrugs')
+ return True
+ return False
+
+@asyncio.coroutine
def process_module(message, command, raw):
for module, params in modules.items():
if command in params['commands']:
if m is None:
return
command = m.group(1)
- result = yield from plugins.handle_command(message, command, raw)
+ result = yield from builtin_commands(message, command, raw)
+ if not result:
+ result = yield from plugins.handle_command(message, command, raw)
if not result:
yield from process_module(message, command, raw)
def plugins(self):
return self.loaded.keys()
+ def description(self, name):
+ if self.has_method(name, 'description'):
+ return self.call_method(name, 'description')
+
def get_plugin(self, name):
if name not in self.loaded:
return None
super(Feeds, self).__init__(filename)
self.create_tables()
+ def description(self):
+ return 'Handles RSS feeds.'
+
def create_tables(self):
self.open_db()
cursor = self.query('create table if not exists feeds (id char(36) not null, bot_id varchar(32) not null, server_id varchar(32) not null, channel_id varchar(32) not null, description varchar(64), url varchar(128) not null, date boolean not null default true, summary boolean not null default false, link_json varchar(256), enabled boolean not null default true)')