bots: Set user-agent for individual bots automatically.

Fixes #28.
This commit is contained in:
neiljp (Neil Pilgrim) 2017-07-25 18:24:08 -07:00 committed by Tim Abbott
parent b314c70da7
commit e619c19b36
2 changed files with 4 additions and 3 deletions

View file

@ -126,7 +126,7 @@ class StateHandler(object):
yield new_state
self.set_state(new_state)
def run_message_handler_for_bot(lib_module, quiet, config_file):
def run_message_handler_for_bot(lib_module, quiet, config_file, bot_name):
# type: (Any, bool, str) -> Any
#
# lib_module is of type Any, since it can contain any bot's
@ -135,7 +135,7 @@ def run_message_handler_for_bot(lib_module, quiet, config_file):
# function.
#
# Make sure you set up your ~/.zuliprc
client = Client(config_file=config_file)
client = Client(config_file=config_file, client="Zulip{}Bot".format(bot_name.capitalize()))
restricted_client = ExternalBotHandler(client)
message_handler = lib_module.handler_class()

View file

@ -107,7 +107,8 @@ def main():
run_message_handler_for_bot(
lib_module=lib_module,
config_file=options.config_file,
quiet=options.quiet
quiet=options.quiet,
bot_name=bot_name
)
if __name__ == '__main__':