Class: Discordrb::Interactions::Message

Inherits:
Object
  • Object
show all
Includes:
Discordrb::IDObject
Defined in:
lib/discordrb/data/interaction.rb

Overview

A message partial for interactions.

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods included from Discordrb::IDObject

#==, #creation_time, synthesise

Instance Attribute Details

#attachmentsAttachment (readonly)



687
688
689
# File 'lib/discordrb/data/interaction.rb', line 687

def attachments
  @attachments
end

#authorUser (readonly)



684
685
686
# File 'lib/discordrb/data/interaction.rb', line 684

def author
  @author
end

#channel_idInteger (readonly)



699
700
701
# File 'lib/discordrb/data/interaction.rb', line 699

def channel_id
  @channel_id
end

#componentsArray<Component> (readonly)



705
706
707
# File 'lib/discordrb/data/interaction.rb', line 705

def components
  @components
end

#contentString? (readonly)



663
664
665
# File 'lib/discordrb/data/interaction.rb', line 663

def content
  @content
end

#editedtrue, false (readonly)



678
679
680
# File 'lib/discordrb/data/interaction.rb', line 678

def edited
  @edited
end

#edited_timestampTime? (readonly)



675
676
677
# File 'lib/discordrb/data/interaction.rb', line 675

def edited_timestamp
  @edited_timestamp
end

#embedsArray<Embed> (readonly)



690
691
692
# File 'lib/discordrb/data/interaction.rb', line 690

def embeds
  @embeds
end

#flagsInteger (readonly)



696
697
698
# File 'lib/discordrb/data/interaction.rb', line 696

def flags
  @flags
end

#idInteger (readonly)



681
682
683
# File 'lib/discordrb/data/interaction.rb', line 681

def id
  @id
end

#interactionInteraction (readonly)



660
661
662
# File 'lib/discordrb/data/interaction.rb', line 660

def interaction
  @interaction
end

#mentionsArray<User> (readonly)



693
694
695
# File 'lib/discordrb/data/interaction.rb', line 693

def mentions
  @mentions
end

#message_referenceHash? (readonly)



702
703
704
# File 'lib/discordrb/data/interaction.rb', line 702

def message_reference
  @message_reference
end

#pinnedtrue, false (readonly)



666
667
668
# File 'lib/discordrb/data/interaction.rb', line 666

def pinned
  @pinned
end

#timestampTime (readonly)



672
673
674
# File 'lib/discordrb/data/interaction.rb', line 672

def timestamp
  @timestamp
end

#ttstrue, false (readonly)



669
670
671
# File 'lib/discordrb/data/interaction.rb', line 669

def tts
  @tts
end

Instance Method Details

#channelChannel

Returns The channel the interaction originates from.

Raises:



762
763
764
# File 'lib/discordrb/data/interaction.rb', line 762

def channel
  @bot.channel(@channel_id)
end

#deleteObject

Delete this message.



774
775
776
# File 'lib/discordrb/data/interaction.rb', line 774

def delete
  @interaction.delete_message(@id)
end

#edit(content: nil, embeds: nil, allowed_mentions: nil, components: nil) {|builder| ... } ⇒ Object

Edit this message's data.

Yield Parameters:

  • builder (Webhooks::Builder)

    An optional message builder. Arguments passed to the method overwrite builder data.



783
784
785
# File 'lib/discordrb/data/interaction.rb', line 783

def edit(content: nil, embeds: nil, allowed_mentions: nil, components: nil, &block)
  @interaction.edit_message(@id, content: content, embeds: embeds, allowed_mentions: allowed_mentions, components: components, &block)
end

#memberMember?



750
751
752
# File 'lib/discordrb/data/interaction.rb', line 750

def member
  server&.member(@user.id)
end

#respond(content: nil, embeds: nil, allowed_mentions: nil, flags: 0, ephemeral: true, components: nil) {|builder| ... } ⇒ Object

Respond to this message.

Yield Parameters:

  • builder (Webhooks::Builder)

    An optional message builder. Arguments passed to the method overwrite builder data.



769
770
771
# File 'lib/discordrb/data/interaction.rb', line 769

def respond(content: nil, embeds: nil, allowed_mentions: nil, flags: 0, ephemeral: true, components: nil, &block)
  @interaction.send_message(content: content, embeds: embeds, allowed_mentions: allowed_mentions, flags: flags, ephemeral: ephemeral, components: components, &block)
end

#serverServer?



756
757
758
# File 'lib/discordrb/data/interaction.rb', line 756

def server
  @bot.server(@server_id)
end

#to_messageDiscordrb::Message Also known as: message



788
789
790
# File 'lib/discordrb/data/interaction.rb', line 788

def to_message
  Discordrb::Message.new(@data, @bot)
end