-
Notifications
You must be signed in to change notification settings - Fork 160
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
The calculation result of PermissionCalculator#permission? is incorrect #700
Comments
Channel permission settingTesting coderequire 'bundler/setup'
require 'discordrb'
bot = Discordrb::Commands::CommandBot.new(
token: "TOKEN",
prefix: "/"
)
bot.command(:test) do |event|
p event.server.bot.permission?(:read_messages, event.channel)
end
bot.run ResultExecute false |
Sorry that it took a while to get to this one, it appears we discussed this in the channel but I forgot to commit something afterwards. |
No problem. |
I'm sorry. Specific example: Server rolesChannel overwritesTesting coderequire 'bundler/setup'
require 'discordrb'
bot = Discordrb::Commands::CommandBot.new(token: 'TOKEN', prefix: '/')
bot.command(:test) do |event|
own_member = event.server.bot
own_member.permission?(:send_messages, event.channel)
end
bot.run ResultSending a |
This was fixed via shardlab/discordrb@9cc3a26 in the new repo and released in v3.4.0 and can be closed. Thank you for the report. |
Summary
The calculation result of Discordrb::PermissionCalculator#permission? is incorrect.
According to the Discord specification, if there are multiple roles, "Allow" always takes precedence when overwriting channel permissions, regardless of the priority of the roles.
However, for "permission?", the authority of the upper role takes precedence, and the "Allow" of the lower role is ignored.
Therefore, authority cannot be checked correctly.
It is not possible to identify where the problem is in the library.
Environment
Ruby version:
ruby 2.6.5p114 (2019-10-01 revision 67812) [x64-mingw32]
Discordrb version:
C:/Ruby26-x64/lib/ruby/gems/2.6.0/bundler/gems/discordrb-2c2b50e32c05
The text was updated successfully, but these errors were encountered: