Class: Discordrb::Events::ServerRoleDeleteEvent

Inherits:
Event
  • Object
show all
Defined in:
lib/discordrb/events/roles.rb

Overview

Raised when a role is deleted from a server

Instance Attribute Summary collapse

Attributes inherited from Event

#bot

Instance Method Summary collapse

Constructor Details

#initialize(data, bot) ⇒ ServerRoleDeleteEvent

Returns a new instance of ServerRoleDeleteEvent.



57
58
59
60
61
62
63
64
65
66
# File 'lib/discordrb/events/roles.rb', line 57

def initialize(data, bot)
  @bot = bot

  # The role should already be deleted from the server's list
  # by the time we create this event, so we'll create a temporary
  # role object for event consumers to use.
  @id = data['role_id'].to_i
  server_id = data['guild_id'].to_i
  @server = bot.server(server_id)
end

Instance Attribute Details

#idInteger (readonly)

Returns the ID of the role that got deleted.

Returns:

  • (Integer)

    the ID of the role that got deleted.



52
53
54
# File 'lib/discordrb/events/roles.rb', line 52

def id
  @id
end

#serverServer (readonly)

Returns the server on which a role got deleted.

Returns:

  • (Server)

    the server on which a role got deleted.



55
56
57
# File 'lib/discordrb/events/roles.rb', line 55

def server
  @server
end