bots: Set user-agent for individual bots automatically.
Fixes
MODIFY
zulip_bots/zulip_bots/lib.py
zulip_bots/zulip_bots/lib.py
@@ -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()

MODIFY
zulip_bots/zulip_bots/run.py
zulip_bots/zulip_bots/run.py
@@ -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__':

bots: Set user-agent for individual bots automatically.

Fixes #28.