Add support for role mentions on the bot's autogenerated managed roleid. #262
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.
Summary
This is to address the discrepancy when a user types the bot's exact name, and discord translates it to a role mention due to the autogenerated managed role that's created when adding a bot with permissions > 0 to a server. Below is an example of the new behavior from an
irb
session:in the above test, I sent two messages to the bot, one with a role mention and the other with a user mention. The blocks passed demonstrate that only when
:allow_role_mention == true
will the event be raised upon role mentions.All tests were run with
bundle exec rspec spec
and passed:Changed
discordrb/events/message.rb
discordrb/bot.rb
discordrb/container.rb
additionally the gemspec was updated to include the
role_mentions:
flag, to avoid a no method error but otherwise function is exactly the same.Fixed
You could say the
bot.mention
function has been "fixed"? Depends how you view this feature & support for Discord's managed roles.