Class: Discordrb::Events::GuildRoleUpdateEvent

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

Overview

Event raised when a role updates on a server

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, bot) ⇒ GuildRoleUpdateEvent

Returns a new instance of GuildRoleUpdateEvent.



10
11
12
13
14
15
16
# File 'lib/discordrb/events/guild_role_update.rb', line 10

def initialize(data, bot)
  @server = bot.server(data['guild_id'].to_i)
  return unless @server

  role_id = data['role']['id'].to_i
  @role = @server.roles.find { |r| r.id == role_id }
end

Instance Attribute Details

#roleObject (readonly)

Returns the value of attribute role.



7
8
9
# File 'lib/discordrb/events/guild_role_update.rb', line 7

def role
  @role
end

#serverObject (readonly)

Returns the value of attribute server.



8
9
10
# File 'lib/discordrb/events/guild_role_update.rb', line 8

def server
  @server
end