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)



824
825
826
# File 'lib/discordrb/data/interaction.rb', line 824

def attachments
  @attachments
end

#authorUser (readonly)



821
822
823
# File 'lib/discordrb/data/interaction.rb', line 821

def author
  @author
end

#channel_idInteger (readonly)



836
837
838
# File 'lib/discordrb/data/interaction.rb', line 836

def channel_id
  @channel_id
end

#componentsArray<Component> (readonly)



842
843
844
# File 'lib/discordrb/data/interaction.rb', line 842

def components
  @components
end

#contentString? (readonly)



800
801
802
# File 'lib/discordrb/data/interaction.rb', line 800

def content
  @content
end

#editedtrue, false (readonly)



815
816
817
# File 'lib/discordrb/data/interaction.rb', line 815

def edited
  @edited
end

#edited_timestampTime? (readonly)



812
813
814
# File 'lib/discordrb/data/interaction.rb', line 812

def edited_timestamp
  @edited_timestamp
end

#embedsArray<Embed> (readonly)



827
828
829
# File 'lib/discordrb/data/interaction.rb', line 827

def embeds
  @embeds
end

#flagsInteger (readonly)



833
834
835
# File 'lib/discordrb/data/interaction.rb', line 833

def flags
  @flags
end

#idInteger (readonly)



818
819
820
# File 'lib/discordrb/data/interaction.rb', line 818

def id
  @id
end

#interactionInteraction (readonly)



797
798
799
# File 'lib/discordrb/data/interaction.rb', line 797

def interaction
  @interaction
end

#mentionsArray<User> (readonly)



830
831
832
# File 'lib/discordrb/data/interaction.rb', line 830

def mentions
  @mentions
end

#message_referenceHash? (readonly)



839
840
841
# File 'lib/discordrb/data/interaction.rb', line 839

def message_reference
  @message_reference
end

#pinnedtrue, false (readonly)



803
804
805
# File 'lib/discordrb/data/interaction.rb', line 803

def pinned
  @pinned
end

#timestampTime (readonly)



809
810
811
# File 'lib/discordrb/data/interaction.rb', line 809

def timestamp
  @timestamp
end

#ttstrue, false (readonly)



806
807
808
# File 'lib/discordrb/data/interaction.rb', line 806

def tts
  @tts
end

Instance Method Details

#channelChannel

Returns The channel the interaction originates from.

Raises:



899
900
901
# File 'lib/discordrb/data/interaction.rb', line 899

def channel
  @bot.channel(@channel_id)
end

#deleteObject

Delete this message.



911
912
913
# File 'lib/discordrb/data/interaction.rb', line 911

def delete
  @interaction.delete_message(@id)
end

#edit(content: nil, embeds: nil, allowed_mentions: nil, components: nil, attachments: 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.



920
921
922
# File 'lib/discordrb/data/interaction.rb', line 920

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

#memberMember?



887
888
889
# File 'lib/discordrb/data/interaction.rb', line 887

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

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

Respond to this message.

Yield Parameters:

  • builder (Webhooks::Builder)

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



906
907
908
# File 'lib/discordrb/data/interaction.rb', line 906

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

#serverServer?



893
894
895
# File 'lib/discordrb/data/interaction.rb', line 893

def server
  @bot.server(@server_id)
end

#to_messageDiscordrb::Message Also known as: message



925
926
927
# File 'lib/discordrb/data/interaction.rb', line 925

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