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.
209
210
211
|
# File 'lib/discord_rda/event/base.rb', line 209
def initialize(data, shard_id:)
super('MESSAGE_CREATE', data, shard_id: shard_id)
end
|
Instance Method Details
#author ⇒ Object
217
218
219
|
# File 'lib/discord_rda/event/base.rb', line 217
def author
message.author
end
|
#channel_id ⇒ Object
221
222
223
|
# File 'lib/discord_rda/event/base.rb', line 221
def channel_id
message.channel_id
end
|
#content ⇒ Object
229
230
231
|
# File 'lib/discord_rda/event/base.rb', line 229
def content
message.content
end
|
#guild_id ⇒ Object
225
226
227
|
# File 'lib/discord_rda/event/base.rb', line 225
def guild_id
@data['guild_id'] ? Snowflake.new(@data['guild_id']) : nil
end
|
#mentions_bot?(bot_id) ⇒ Boolean
233
234
235
|
# File 'lib/discord_rda/event/base.rb', line 233
def mentions_bot?(bot_id)
message.mentioned_users.any? { |u| u.id.to_s == bot_id.to_s }
end
|
#message ⇒ Object
213
214
215
|
# File 'lib/discord_rda/event/base.rb', line 213
def message
@message ||= Message.new(@data)
end
|