def handle_message(text, expect_reaction=True): client = SlackClient("api_token", connect=False) plugins = PluginsManager() dispatcher = MessageDispatcher(client, plugins, None) msg = [ "respond_to", {"text": text, "channel": "channel", "ts": str(time.mktime(T0.timetuple()))}, ] if expect_reaction: with assert_slack_client_reacts_to_message(): dispatcher.dispatch_msg(msg) else: with assert_slack_client_doesnt_react_to_message(): dispatcher.dispatch_msg(msg)
def handle_message(text, *, category="respond_to", expect_reaction=True): client = SlackClient("api_token", connect=False) plugins = PluginsManager() plugins.init_plugins() dispatcher = MessageDispatcher(client, plugins, None) msg = [ category, { "text": text, "channel": "channel", "ts": TS }, ] if expect_reaction: with assert_slack_client_reacts_to_message(): dispatcher.dispatch_msg(msg) else: with assert_slack_client_doesnt_react_to_message(): dispatcher.dispatch_msg(msg)