bots: Add basic metadata with failover, used on running only.
This commit is contained in:
parent
5681b6e9e2
commit
85f2a9e03d
|
@ -18,6 +18,11 @@ class WikipediaHandler(object):
|
||||||
kind of external issue tracker as well.
|
kind of external issue tracker as well.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
META = {
|
||||||
|
'name': 'Wikipedia',
|
||||||
|
'description': 'Searches Wikipedia for a term and returns the top article.',
|
||||||
|
}
|
||||||
|
|
||||||
def usage(self):
|
def usage(self):
|
||||||
return '''
|
return '''
|
||||||
This plugin will allow users to directly search
|
This plugin will allow users to directly search
|
||||||
|
|
|
@ -14,6 +14,11 @@ class XkcdHandler(object):
|
||||||
commands.
|
commands.
|
||||||
'''
|
'''
|
||||||
|
|
||||||
|
META = {
|
||||||
|
'name': 'XKCD',
|
||||||
|
'description': 'Fetches comic strips from https://xkcd.com.',
|
||||||
|
}
|
||||||
|
|
||||||
def usage(self):
|
def usage(self):
|
||||||
return '''
|
return '''
|
||||||
This plugin allows users to fetch a comic strip provided by
|
This plugin allows users to fetch a comic strip provided by
|
||||||
|
|
|
@ -187,7 +187,17 @@ def run_message_handler_for_bot(lib_module, quiet, config_file, bot_name):
|
||||||
|
|
||||||
state_handler = StateHandler()
|
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:
|
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())
|
print(message_handler.usage())
|
||||||
|
|
||||||
def handle_message(message):
|
def handle_message(message):
|
||||||
|
|
Loading…
Reference in a new issue