Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[INTPROD-9204] Allow Match By Bot User ID (#106)
This pull request includes changes to the `omnibot` service and its documentation. The changes mainly revolve around the addition of a `user_id` property in the `Bot` class, the modification of the `_parse_payload` method in the `Message` class to include a check for the bot's `user_id`, and the addition of important notes in the `Adding normal slack apps` documentation. Documentation Updates: * [`docs/root/adding_new_slack_apps.rst`](diffhunk://#diff-31bdebcf2f1187f82ac5efc676dd93fb8c7c5f4ee85b81f7fc486a6ef543c9deR48-R53): Added notes about the potential for the bot to be called twice if `app_mention` is added, the need for `bot.name` to match the app `user_handle`, and the need to specify `match_mention: true` if `user_handle` and `bot.name` do not match. Codebase Updates: * [`omnibot/services/slack/bot.py`](diffhunk://#diff-4050ebc6feafe8ceb1145ae4c7149d83a181f55dc32c75e79525a8a5709ac785R2): Imported `get_auth` from `omnibot.services.slack` and added a `user_id` property to the `Bot` class that fetches the `user_id` from `bot_data` or calls `get_auth` if `user_id` is not present. [[1]](diffhunk://#diff-4050ebc6feafe8ceb1145ae4c7149d83a181f55dc32c75e79525a8a5709ac785R2) [[2]](diffhunk://#diff-4050ebc6feafe8ceb1145ae4c7149d83a181f55dc32c75e79525a8a5709ac785R87-R95) * [`omnibot/services/slack/message.py`](diffhunk://#diff-76d2c4d8159d285244ea3ee98f6d2acde313fc5413b55106384fea03f1bf184dL179-R183): Modified the `_parse_payload` method to check if the bot's `user_id` is mentioned in the message. * [`tests/unit/omnibot/services/slack/message_test.py`](diffhunk://#diff-f42e42442277bcdb393292670d558e99345a87f55f76ce133bc0842ce05f514aR14): Updated the test setup to include a `user_id` in the bot's data.
- Loading branch information