bots: Add basic metadata with failover, used on running only.
MODIFY
zulip_bots/zulip_bots/bots/wikipedia/wikipedia.py
zulip_bots/zulip_bots/bots/wikipedia/wikipedia.py
@@ -18,6 +18,11 @@ class WikipediaHandler(object):
kind of external issue tracker as well.
'''
+ META = {
+ 'name': 'Wikipedia',
+ 'description': 'Searches Wikipedia for a term and returns the top article.',
+ }
+
def usage(self):
return '''
This plugin will allow users to directly search

MODIFY
zulip_bots/zulip_bots/bots/xkcd/xkcd.py
zulip_bots/zulip_bots/bots/xkcd/xkcd.py
@@ -14,6 +14,11 @@ class XkcdHandler(object):
commands.
'''
+ META = {
+ 'name': 'XKCD',
+ 'description': 'Fetches comic strips from https://xkcd.com.',
+ }
+
def usage(self):
return '''
This plugin allows users to fetch a comic strip provided by

MODIFY
zulip_bots/zulip_bots/lib.py
zulip_bots/zulip_bots/lib.py
@@ -187,7 +187,17 @@ def run_message_handler_for_bot(lib_module, quiet, config_file, bot_name):
state_handler = StateHandler()
+ # Set default bot_details, then override from class, if provided
+ bot_details = {
+ 'name': bot_name.capitalize(),
+ 'description': "",
+ }
+ bot_details.update(getattr(lib_module.handler_class, 'META', {}))
+
if not quiet:
+ print("Running {} Bot:".format(bot_details['name']))
+ if bot_details['description'] != "":
+ print("\n\t{}".format(bot_details['description']))
print(message_handler.usage())
def handle_message(message):

bots: Add basic metadata with failover, used on running only.