Class: DiscordRDA::MessageCreateEvent
- Inherits:
-
Event
- Object
- Event
- DiscordRDA::MessageCreateEvent
show all
- Defined in:
- lib/discord_rda/event/base.rb
Instance Attribute Summary
Attributes inherited from Event
#data, #shard_id, #timestamp, #type
Instance Method Summary
collapse
Methods inherited from Event
#created_at, #inspect, #to_h
Constructor Details
Returns a new instance of MessageCreateEvent.
214
215
216
|
# File 'lib/discord_rda/event/base.rb', line 214
def initialize(data, shard_id:)
super('MESSAGE_CREATE', data, shard_id: shard_id)
end
|
Instance Method Details
#author ⇒ Object
222
223
224
|
# File 'lib/discord_rda/event/base.rb', line 222
def author
message.author
end
|
#channel_id ⇒ Object
226
227
228
|
# File 'lib/discord_rda/event/base.rb', line 226
def channel_id
message.channel_id
end
|
#content ⇒ Object
234
235
236
|
# File 'lib/discord_rda/event/base.rb', line 234
def content
message.content
end
|
#guild_id ⇒ Object
230
231
232
|
# File 'lib/discord_rda/event/base.rb', line 230
def guild_id
@data['guild_id'] ? Snowflake.new(@data['guild_id']) : nil
end
|
#mentions_bot?(bot_id) ⇒ Boolean
238
239
240
|
# File 'lib/discord_rda/event/base.rb', line 238
def mentions_bot?(bot_id)
message.mentioned_users.any? { |u| u.id.to_s == bot_id.to_s }
end
|
#message ⇒ Object
218
219
220
|
# File 'lib/discord_rda/event/base.rb', line 218
def message
@message ||= Message.new(@data)
end
|