Class: Discordrb::Events::GuildRoleCreateEvent

Inherits:
Object
  • Object
show all
Defined in:
lib/discordrb/events/guild-role-create.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(data, bot) ⇒ GuildRoleCreateEvent

Returns a new instance of GuildRoleCreateEvent.



9
10
11
12
13
14
15
# File 'lib/discordrb/events/guild-role-create.rb', line 9

def initialize(data, bot)
  @server = bot.server(data['guild_id'].to_i)
  return if !@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.



6
7
8
# File 'lib/discordrb/events/guild-role-create.rb', line 6

def role
  @role
end

#serverObject (readonly)

Returns the value of attribute server.



7
8
9
# File 'lib/discordrb/events/guild-role-create.rb', line 7

def server
  @server
end