Class: Discordrb::Events::ChannelRecipientEvent

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

Overview

Generic subclass for recipient events (add/remove)

Instance Attribute Summary collapse

Attributes inherited from Event

#bot

Instance Method Summary collapse

Constructor Details

#initialize(data, bot) ⇒ ChannelRecipientEvent

Returns a new instance of ChannelRecipientEvent.



137
138
139
140
141
142
143
144
# File 'lib/discordrb/events/channels.rb', line 137

def initialize(data, bot)
  @bot = bot

  @channel = bot.channel(data['channel_id'].to_i)
  recipient = data['user']
  recipient_user = bot.ensure_user(recipient)
  @recipient = Discordrb::Recipient.new(recipient_user, @channel, bot)
end

Instance Attribute Details

#channelChannel (readonly)

Returns the channel in question.

Returns:

  • (Channel)

    the channel in question.



128
129
130
# File 'lib/discordrb/events/channels.rb', line 128

def channel
  @channel
end

#recipientRecipient (readonly)

Returns the recipient that was added/removed from the group.

Returns:

  • (Recipient)

    the recipient that was added/removed from the group



133
134
135
# File 'lib/discordrb/events/channels.rb', line 133

def recipient
  @recipient
end