Class: Discordrb::Role
- Inherits:
-
Object
- Object
- Discordrb::Role
- Includes:
- IDObject
- Defined in:
- lib/discordrb/data.rb
Overview
A Discord role that contains permissions and applies to certain users
Defined Under Namespace
Classes: RoleWriter
Instance Attribute Summary collapse
-
#colour ⇒ ColourRGB
(also: #color)
The role colour.
-
#hoist ⇒ true, false
Whether or not this role should be displayed separately from other users.
-
#mentionable ⇒ true, false
(also: #mentionable?)
readonly
Whether this role can be mentioned using a role mention.
-
#name ⇒ String
This role's name ("new role" if it hasn't been changed).
-
#permissions ⇒ Permissions
readonly
This role's permissions.
Attributes included from IDObject
Instance Method Summary collapse
-
#delete ⇒ Object
Delets this role.
-
#inspect ⇒ Object
The inspect method is overwritten to give more useful output.
-
#mention ⇒ String
A string that will mention this role, if it is mentionable.
Methods included from IDObject
Instance Attribute Details
#colour ⇒ ColourRGB Also known as: color
Returns the role colour.
578 579 580 |
# File 'lib/discordrb/data.rb', line 578 def colour @colour end |
#hoist ⇒ true, false
Returns whether or not this role should be displayed separately from other users.
571 572 573 |
# File 'lib/discordrb/data.rb', line 571 def hoist @hoist end |
#mentionable ⇒ true, false (readonly) Also known as: mentionable?
Returns whether this role can be mentioned using a role mention.
574 575 576 |
# File 'lib/discordrb/data.rb', line 574 def mentionable @mentionable end |
#name ⇒ String
Returns this role's name ("new role" if it hasn't been changed).
568 569 570 |
# File 'lib/discordrb/data.rb', line 568 def name @name end |
#permissions ⇒ Permissions (readonly)
Returns this role's permissions.
565 566 567 |
# File 'lib/discordrb/data.rb', line 565 def end |
Instance Method Details
#delete ⇒ Object
Delets this role. This cannot be undone without recreating the role!
665 666 667 668 |
# File 'lib/discordrb/data.rb', line 665 def delete API.delete_role(@bot.token, @server.id, @id) @server.delete_role(@id) end |
#inspect ⇒ Object
The inspect method is overwritten to give more useful output
671 672 673 |
# File 'lib/discordrb/data.rb', line 671 def inspect "<Role name=#{@name} permissions=#{@permissions.inspect} hoist=#{@hoist} colour=#{@colour.inspect} server=#{@server.inspect}>" end |
#mention ⇒ String
Returns a string that will mention this role, if it is mentionable.
612 613 614 |
# File 'lib/discordrb/data.rb', line 612 def mention "<@&#{@id}>" end |