Class: Discordrb::Events::GuildRoleCreateEvent
- Inherits:
-
Object
- Object
- Discordrb::Events::GuildRoleCreateEvent
- Defined in:
- lib/discordrb/events/guild_role_create.rb
Overview
Raised when a role is created on a server
Instance Attribute Summary collapse
-
#role ⇒ Object
readonly
Returns the value of attribute role.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
Instance Method Summary collapse
-
#initialize(data, bot) ⇒ GuildRoleCreateEvent
constructor
A new instance of GuildRoleCreateEvent.
Constructor Details
#initialize(data, bot) ⇒ GuildRoleCreateEvent
Returns a new instance of GuildRoleCreateEvent.
10 11 12 13 14 15 16 |
# File 'lib/discordrb/events/guild_role_create.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
#role ⇒ Object (readonly)
Returns the value of attribute role.
7 8 9 |
# File 'lib/discordrb/events/guild_role_create.rb', line 7 def role @role end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
8 9 10 |
# File 'lib/discordrb/events/guild_role_create.rb', line 8 def server @server end |