Class: DiscordRDA::MessageDeleteEvent
- Inherits:
-
Event
- Object
- Event
- DiscordRDA::MessageDeleteEvent
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 MessageDeleteEvent.
547
548
549
|
# File 'lib/discord_rda/event/base.rb', line 547
def initialize(data, shard_id:)
super('MESSAGE_DELETE', data, shard_id: shard_id)
end
|
Instance Method Details
#author ⇒ Object
574
575
576
|
# File 'lib/discord_rda/event/base.rb', line 574
def author
@author ||= User.new(@data['author']) if @data['author']
end
|
#channel_id ⇒ Object
555
556
557
|
# File 'lib/discord_rda/event/base.rb', line 555
def channel_id
@data['channel_id']
end
|
#content ⇒ Object
578
579
580
|
# File 'lib/discord_rda/event/base.rb', line 578
def content
@data['content']
end
|
#dm? ⇒ Boolean
586
587
588
|
# File 'lib/discord_rda/event/base.rb', line 586
def dm?
guild_id.nil?
end
|
#guild? ⇒ Boolean
582
583
584
|
# File 'lib/discord_rda/event/base.rb', line 582
def guild?
!guild_id.nil?
end
|
#guild_id ⇒ Object
559
560
561
|
# File 'lib/discord_rda/event/base.rb', line 559
def guild_id
@data['guild_id']
end
|
#jump_url ⇒ Object
590
591
592
593
594
595
596
|
# File 'lib/discord_rda/event/base.rb', line 590
def jump_url
if guild_id
"https://discord.com/channels/#{guild_id}/#{channel_id}/#{message_id}"
else
"https://discord.com/channels/@me/#{channel_id}/#{message_id}"
end
end
|
#message ⇒ Object
563
564
565
566
567
568
569
570
571
572
|
# File 'lib/discord_rda/event/base.rb', line 563
def message
@message ||= begin
if @data['author'] || @data['content'] || @data['embeds']
Message.new(@data.merge('id' => message_id, 'deleted' => true))
else
nil
end
end
end
|
#message_id ⇒ Object
551
552
553
|
# File 'lib/discord_rda/event/base.rb', line 551
def message_id
@data['id']
end
|