-
Notifications
You must be signed in to change notification settings - Fork 103
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Permit per-plugin/per-listener reply-to-self
This commit implements a per-plugin reply-to-self functionality, allowing the bot to, for selected `listen_to` statements, reply to its own previous messages. For example, this would allow the bot to send a reply like "Hey @sender do the thing" to a trigger, and then handle its own "@sender" listener for that message. First, we turn the `EventHandler` `ignore_own_messages` into a global `mmpy_bot` setting, which defaults to `True` to preserve the existing behaviour; the bot user must turn this off to use this new feature. Second, we add a handler within the `MessageFunction` that duplicates the functionality in `EventHandler`; this ensures that the existing behaviour continues to be preserved, even if the global setting is `False`. Finally, we add another kwarg to the `listen_to` decorator to permit passing an `ignore_own_message=False` option, which would then allow that particular listener to ignore the previous conditions and reply to itself. Information about this functionality, including a warning about loops, has been added to the documentation on Plugins at the bottom of the page, to ensure users become aware of this new feature and what needs to be done to activate it.
- Loading branch information
1 parent
d3e0d5e
commit cb934b5
Showing
5 changed files
with
63 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters