Class: Discordrb::Events::ServerMemberEvent
- Defined in:
- lib/discordrb/events/members.rb
Overview
Generic subclass for server member events (add/update/delete)
Direct Known Subclasses
ServerMemberAddEvent, ServerMemberDeleteEvent, ServerMemberUpdateEvent
Instance Attribute Summary collapse
-
#roles ⇒ Array<Role>
readonly
The member’s roles.
-
#server ⇒ Server
readonly
The server on which the event happened.
-
#user ⇒ Member
(also: #member)
readonly
The member in question.
Attributes inherited from Event
Instance Method Summary collapse
-
#initialize(data, bot) ⇒ ServerMemberEvent
constructor
A new instance of ServerMemberEvent.
Constructor Details
#initialize(data, bot) ⇒ ServerMemberEvent
Returns a new instance of ServerMemberEvent.
19 20 21 22 23 24 25 26 27 |
# File 'lib/discordrb/events/members.rb', line 19 def initialize(data, bot) @bot = bot @server = bot.server(data['guild_id'].to_i) return unless @server init_user(data, bot) init_roles(data, bot) end |
Instance Attribute Details
#roles ⇒ Array<Role> (readonly)
Returns the member’s roles.
14 15 16 |
# File 'lib/discordrb/events/members.rb', line 14 def roles @roles end |
#server ⇒ Server (readonly)
Returns the server on which the event happened.
17 18 19 |
# File 'lib/discordrb/events/members.rb', line 17 def server @server end |
#user ⇒ Member (readonly) Also known as: member
Returns the member in question.
10 11 12 |
# File 'lib/discordrb/events/members.rb', line 10 def user @user end |