我在这里有一个Slack机器人:https://github.com/avrwhy/2022bot/blob/master/main.py
特别地,这是直接提及时运行的代码:
def parse_bot_commands(slack_events):
for event in slack_events:
if event["type"] == "message" and not "subtype" in event:
user_id, message = parse_direct_mention(event["text"])
if user_id == starterbot_id:
return message, event["channel"]
return None, None
我如何做到这一点,以使其不需要直接提及来执行命令?