Updated code to permit webhook requests for more than just messages:created#18
Open
joshand wants to merge 6 commits intoimapex:masterfrom
Open
Updated code to permit webhook requests for more than just messages:created#18joshand wants to merge 6 commits intoimapex:masterfrom
joshand wants to merge 6 commits intoimapex:masterfrom
Conversation
Pull Request Test Coverage Report for Build 47
💛 - Coveralls |
1 similar comment
Pull Request Test Coverage Report for Build 47
💛 - Coveralls |
Contributor
Author
|
@kecorbin Any feedback on this PR? |
This file contains hidden or 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
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I was in need of a bot that could monitor memberships data, so I extended this one to do that.
With the changes in the PR, the default behavior is still in tact. However, here is an example of how you would monitor memberships data:
In your main code, when you create an instance of the bot, add the "wh_resource" and "wh_event" parameters:
Then, add a new command for the resource you want to monitor:
bot.add_command('memberships', '*', check_memberships)Finally, add a function to handle that command. For example, I needed the bot (which is assigned to the room as a moderator) to be able to remove anyone from a room who is not in a set of whitelisted domains (i.e., to ensure that a room stays "internal-only"). This function has an additional parameter (sp in my example), which is used to directly access the SparkAPI object.