Class: Discordrb::Role

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

Instance Attribute Details

#colourColourRGB Also known as: color

Returns the role colour.

Returns:



305
306
307
# File 'lib/discordrb/data.rb', line 305

def colour
  @colour
end

#hoisttrue, false

Returns whether or not this role should be displayed separately from other users.

Returns:

  • (true, false)

    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

#idInteger (readonly) Also known as: resolve_id

Returns the ID used to identify this role internally.

Returns:

  • (Integer)

    the ID used to identify this role internally



299
300
301
# File 'lib/discordrb/data.rb', line 299

def id
  @id
end

#nameString

Returns this role's name ("new role" if it hasn't been changed).

Returns:

  • (String)

    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

#permissionsPermissions (readonly)

Returns this role's permissions.

Returns:



293
294
295
# File 'lib/discordrb/data.rb', line 293

def permissions
  @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

#deleteObject

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