Class: Discordrb::Events::ServerEvent

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

Overview

Generic subclass for server events (create/update/delete)

Instance Attribute Summary collapse

Attributes inherited from Event

#bot

Instance Method Summary collapse

Instance Attribute Details

#serverServer (readonly)

Returns the server in question.

Returns:

  • (Server)

    the server in question.



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

def server
  @server
end

Instance Method Details

#init_server(data, bot) ⇒ Object

Initializes this event with server data. Should be overwritten in case the server doesn't exist at the time of event creation (e. g. Discordrb::Events::ServerDeleteEvent)



21
22
23
# File 'lib/discordrb/events/guilds.rb', line 21

def init_server(data, bot)
  @server = bot.server(data['id'].to_i)
end