Class: Discordrb::Events::GuildMemberUpdateEvent
- Inherits:
-
Object
- Object
- Discordrb::Events::GuildMemberUpdateEvent
- Defined in:
- lib/discordrb/events/guild-member-update.rb
Instance Attribute Summary collapse
-
#roles ⇒ Object
readonly
Returns the value of attribute roles.
-
#server ⇒ Object
readonly
Returns the value of attribute server.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
-
#initialize(data, bot) ⇒ GuildMemberUpdateEvent
constructor
A new instance of GuildMemberUpdateEvent.
Constructor Details
#initialize(data, bot) ⇒ GuildMemberUpdateEvent
Returns a new instance of GuildMemberUpdateEvent.
10 11 12 13 14 15 16 17 18 19 20 21 |
# File 'lib/discordrb/events/guild-member-update.rb', line 10 def initialize(data, bot) @server = bot.server(data['guild_id'].to_i) return if !@server user_id = data['user']['id'].to_i @user = @server.members.find {|u| u.id == user_id} @roles = [] data['roles'].each do |element| role_id = element.to_i @roles << @server.roles.find {|r| r.id == role_id} end end |
Instance Attribute Details
#roles ⇒ Object (readonly)
Returns the value of attribute roles.
7 8 9 |
# File 'lib/discordrb/events/guild-member-update.rb', line 7 def roles @roles end |
#server ⇒ Object (readonly)
Returns the value of attribute server.
8 9 10 |
# File 'lib/discordrb/events/guild-member-update.rb', line 8 def server @server end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
6 7 8 |
# File 'lib/discordrb/events/guild-member-update.rb', line 6 def user @user end |