Class: Discordrb::Events::ServerMemberEvent

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

Overview

Generic subclass for server member events (add/update/delete)

Instance Attribute Summary collapse

Attributes inherited from Event

#bot

Instance Method Summary collapse

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

#rolesArray<Role> (readonly)

Returns the member's roles.

Returns:

  • (Array<Role>)

    the member's roles.


14
15
16
# File 'lib/discordrb/events/members.rb', line 14

def roles
  @roles
end

#serverServer (readonly)

Returns the server on which the event happened.

Returns:

  • (Server)

    the server on which the event happened.


17
18
19
# File 'lib/discordrb/events/members.rb', line 17

def server
  @server
end

#userMember (readonly) Also known as: member

Returns the member in question.

Returns:

  • (Member)

    the member in question.


10
11
12
# File 'lib/discordrb/events/members.rb', line 10

def user
  @user
end