Class: OnyxCord::Interactions::Message
- Inherits:
-
Object
- Object
- OnyxCord::Interactions::Message
- Includes:
- OnyxCord::IDObject
- Defined in:
- lib/onyxcord/interactions/internal/message.rb
Overview
A message partial for interactions.
Instance Attribute Summary collapse
- #attachments ⇒ Attachment readonly
-
#author ⇒ User
readonly
The user of the application.
- #channel_id ⇒ Integer readonly
- #components ⇒ Array<Component> readonly
-
#content ⇒ String?
readonly
The content of the message.
- #edited ⇒ true, false readonly
- #edited_timestamp ⇒ Time? readonly
- #embeds ⇒ Array<Embed> readonly
- #flags ⇒ Integer readonly
- #id ⇒ Integer readonly
-
#interaction ⇒ Interaction
readonly
The interaction that created this message.
- #mentions ⇒ Array<User> readonly
- #message_reference ⇒ Hash? readonly
-
#pinned ⇒ true, false
readonly
Whether this message is pinned in the channel it belongs to.
- #timestamp ⇒ Time readonly
- #tts ⇒ true, false readonly
Instance Method Summary collapse
-
#channel ⇒ Channel
The channel the interaction originates from.
-
#delete ⇒ Object
Delete this message.
-
#edit(content: nil, embeds: nil, allowed_mentions: nil, components: nil, attachments: nil) {|builder, view| ... } ⇒ Object
Edit this message's data.
-
#member ⇒ Member?
This will return nil if the bot does not have access to the server the interaction originated in.
-
#respond(content: nil, embeds: nil, allowed_mentions: nil, flags: 0, ephemeral: true, components: nil, attachments: nil) {|builder, view| ... } ⇒ Object
(also: #reply)
Respond to this message.
-
#server ⇒ Server?
This will return nil if the bot does not have access to the server the interaction originated in.
- #to_message ⇒ OnyxCord::Message (also: #message)
Methods included from OnyxCord::IDObject
#==, #creation_time, synthesise
Instance Attribute Details
#attachments ⇒ Attachment (readonly)
39 40 41 |
# File 'lib/onyxcord/interactions/internal/message.rb', line 39 def @attachments end |
#author ⇒ User (readonly)
Returns The user of the application.
36 37 38 |
# File 'lib/onyxcord/interactions/internal/message.rb', line 36 def @author end |
#channel_id ⇒ Integer (readonly)
51 52 53 |
# File 'lib/onyxcord/interactions/internal/message.rb', line 51 def channel_id @channel_id end |
#components ⇒ Array<Component> (readonly)
57 58 59 |
# File 'lib/onyxcord/interactions/internal/message.rb', line 57 def components @components end |
#content ⇒ String? (readonly)
Returns The content of the message.
15 16 17 |
# File 'lib/onyxcord/interactions/internal/message.rb', line 15 def content @content end |
#edited ⇒ true, false (readonly)
30 31 32 |
# File 'lib/onyxcord/interactions/internal/message.rb', line 30 def edited @edited end |
#edited_timestamp ⇒ Time? (readonly)
27 28 29 |
# File 'lib/onyxcord/interactions/internal/message.rb', line 27 def @edited_timestamp end |
#embeds ⇒ Array<Embed> (readonly)
42 43 44 |
# File 'lib/onyxcord/interactions/internal/message.rb', line 42 def @embeds end |
#flags ⇒ Integer (readonly)
48 49 50 |
# File 'lib/onyxcord/interactions/internal/message.rb', line 48 def flags @flags end |
#id ⇒ Integer (readonly)
33 34 35 |
# File 'lib/onyxcord/interactions/internal/message.rb', line 33 def id @id end |
#interaction ⇒ Interaction (readonly)
Returns The interaction that created this message.
12 13 14 |
# File 'lib/onyxcord/interactions/internal/message.rb', line 12 def interaction @interaction end |
#mentions ⇒ Array<User> (readonly)
45 46 47 |
# File 'lib/onyxcord/interactions/internal/message.rb', line 45 def mentions @mentions end |
#message_reference ⇒ Hash? (readonly)
54 55 56 |
# File 'lib/onyxcord/interactions/internal/message.rb', line 54 def @message_reference end |
#pinned ⇒ true, false (readonly)
Returns Whether this message is pinned in the channel it belongs to.
18 19 20 |
# File 'lib/onyxcord/interactions/internal/message.rb', line 18 def pinned @pinned end |
#timestamp ⇒ Time (readonly)
24 25 26 |
# File 'lib/onyxcord/interactions/internal/message.rb', line 24 def @timestamp end |
#tts ⇒ true, false (readonly)
21 22 23 |
# File 'lib/onyxcord/interactions/internal/message.rb', line 21 def tts @tts end |
Instance Method Details
#channel ⇒ Channel
Returns The channel the interaction originates from.
114 115 116 |
# File 'lib/onyxcord/interactions/internal/message.rb', line 114 def channel @bot.channel(@channel_id) end |
#delete ⇒ Object
Delete this message.
126 127 128 |
# File 'lib/onyxcord/interactions/internal/message.rb', line 126 def delete @interaction.(@id) end |
#edit(content: nil, embeds: nil, allowed_mentions: nil, components: nil, attachments: nil) {|builder, view| ... } ⇒ Object
Edit this message's data.
135 136 137 |
# File 'lib/onyxcord/interactions/internal/message.rb', line 135 def edit(content: nil, embeds: nil, allowed_mentions: nil, components: nil, attachments: nil, &block) @interaction.(@id, content: content, embeds: , allowed_mentions: allowed_mentions, components: components, attachments: , &block) end |
#member ⇒ Member?
Returns This will return nil if the bot does not have access to the server the interaction originated in.
102 103 104 |
# File 'lib/onyxcord/interactions/internal/message.rb', line 102 def member server&.member(@user.id) end |
#respond(content: nil, embeds: nil, allowed_mentions: nil, flags: 0, ephemeral: true, components: nil, attachments: nil) {|builder, view| ... } ⇒ Object Also known as:
Respond to this message.
121 122 123 |
# File 'lib/onyxcord/interactions/internal/message.rb', line 121 def respond(content: nil, embeds: nil, allowed_mentions: nil, flags: 0, ephemeral: true, components: nil, attachments: nil, &block) @interaction.(content: content, embeds: , allowed_mentions: allowed_mentions, flags: flags, ephemeral: ephemeral, components: components, attachments: , &block) end |
#server ⇒ Server?
Returns This will return nil if the bot does not have access to the server the interaction originated in.
108 109 110 |
# File 'lib/onyxcord/interactions/internal/message.rb', line 108 def server @bot.server(@server_id) end |
#to_message ⇒ OnyxCord::Message Also known as: message
140 141 142 |
# File 'lib/onyxcord/interactions/internal/message.rb', line 140 def OnyxCord::Message.new(@data, @bot) end |