Method: LibDiscord.permissions

Defined in:
lib/lib_discord/permissions.rb

.permissionsHash

Get the data structure for Discord permissions. Use this data structure for permissions calculations, permissions comparisons, and to help reduce magic numbers in your code when making requests to Discord and parsing Discord responses.

Examples:

p = LibDiscord.permissions
p[:ADD_REACTIONS] # => 64

Permissions value that can SEND_MESSAGES and ADD_REACTIONS

my_perms = p[:SEND_MESSAGES] + p[:ADD_REACTIONS] # => 2112

Check for permission flags that are set.

my_perms & p[:ADD_REACTIONS] == p[:ADD_REACTIONS] # => true

Check for permission flags that are not set.

my_perms & p[:KICK_MEMBERS] == p[:KICK_MEMBERS] # => false

Returns:

  • (Hash)

See Also:



83
# File 'lib/lib_discord/permissions.rb', line 83

def self.permissions = PERMISSIONS