Class: Discordrb::Role
- Inherits:
-
Object
- Object
- Discordrb::Role
- 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.
-
#id ⇒ Integer
(also: #resolve_id)
readonly
The ID used to identify this role internally.
-
#name ⇒ String
This role's name ("new role" if it hasn't been changed).
-
#permissions ⇒ Permissions
readonly
This role's permissions.
Instance Method Summary collapse
-
#==(other) ⇒ Object
ID based comparison.
-
#delete ⇒ Object
Delets this role.
Instance Attribute Details
#colour ⇒ ColourRGB Also known as: color
Returns the role colour.
305 306 307 |
# File 'lib/discordrb/data.rb', line 305 def colour @colour end |
#hoist ⇒ true, false
Returns whether or not this role should be displayed separately from other users.
302 303 304 |
# File 'lib/discordrb/data.rb', line 302 def hoist @hoist end |
#id ⇒ Integer (readonly) Also known as: resolve_id
Returns the ID used to identify this role internally.
299 300 301 |
# File 'lib/discordrb/data.rb', line 299 def id @id end |
#name ⇒ String
Returns this role's name ("new role" if it hasn't been changed).
296 297 298 |
# File 'lib/discordrb/data.rb', line 296 def name @name end |
#permissions ⇒ Permissions (readonly)
Returns this role's permissions.
293 294 295 |
# File 'lib/discordrb/data.rb', line 293 def @permissions end |
Instance Method Details
#==(other) ⇒ Object
ID based comparison
337 338 339 |
# File 'lib/discordrb/data.rb', line 337 def ==(other) Discordrb.id_compare(@id, other) end |
#delete ⇒ Object
Delets this role. This cannot be undone without recreating the role!
390 391 392 393 |
# File 'lib/discordrb/data.rb', line 390 def delete API.delete_role(@bot.token, @server.id, @id) @server.delete_role(@id) end |