Class: OnyxCord::Interactions::Metadata
- Inherits:
-
Object
- Object
- OnyxCord::Interactions::Metadata
- Includes:
- OnyxCord::IDObject
- Defined in:
- lib/onyxcord/interactions/internal/metadata.rb
Overview
Supplemental metadata about an interaction.
Instance Attribute Summary collapse
-
#interacted_message_id ⇒ Integer?
readonly
The ID of the message that contained the interactive message component.
-
#original_response_message_id ⇒ Integer?
readonly
The ID the original response message; only present on follow-up messages.
-
#target_message_id ⇒ Integer?
readonly
The ID of the message the command was ran on.
-
#target_user ⇒ User?
readonly
The user that the command was ran on.
-
#triggering_metadata ⇒ Metadata?
readonly
The metadata for the interaction that opened the modal.
-
#type ⇒ Integer
readonly
The type of the interaction.
-
#user ⇒ User
readonly
The user that initiated the interaction.
Attributes included from OnyxCord::IDObject
Instance Method Summary collapse
- #command? ⇒ Boolean
-
#component? ⇒ true, false
Whether or not the interaction metadata is for a message component.
-
#interacted_message ⇒ Message?
Attempt to fetch the message that contained the interatctive component.
-
#modal_submit? ⇒ true, false
Whether or not the interaction metadata is for a modal submission.
-
#original_response_message ⇒ Message?
Attempt to fetch the original response message of the interaction.
-
#server_integration? ⇒ true, false
Check if the interaction was triggered by a server by installed the application.
-
#target_message ⇒ Message?
Attempt to fetch the target message of the interaction.
-
#user_integration? ⇒ true, false
Check if the interaction was triggered by a user by installed the application.
Methods included from OnyxCord::IDObject
#==, #creation_time, synthesise
Instance Attribute Details
#interacted_message_id ⇒ Integer? (readonly)
Returns the ID of the message that contained the interactive message component.
27 28 29 |
# File 'lib/onyxcord/interactions/internal/metadata.rb', line 27 def @interacted_message_id end |
#original_response_message_id ⇒ Integer? (readonly)
Returns the ID the original response message; only present on follow-up messages.
30 31 32 |
# File 'lib/onyxcord/interactions/internal/metadata.rb', line 30 def @original_response_message_id end |
#target_message_id ⇒ Integer? (readonly)
Returns the ID of the message the command was ran on.
21 22 23 |
# File 'lib/onyxcord/interactions/internal/metadata.rb', line 21 def @target_message_id end |
#target_user ⇒ User? (readonly)
Returns the user that the command was ran on.
18 19 20 |
# File 'lib/onyxcord/interactions/internal/metadata.rb', line 18 def target_user @target_user end |
#triggering_metadata ⇒ Metadata? (readonly)
Returns the metadata for the interaction that opened the modal.
24 25 26 |
# File 'lib/onyxcord/interactions/internal/metadata.rb', line 24 def @triggering_metadata end |
#type ⇒ Integer (readonly)
Returns the type of the interaction.
12 13 14 |
# File 'lib/onyxcord/interactions/internal/metadata.rb', line 12 def type @type end |
#user ⇒ User (readonly)
Returns the user that initiated the interaction.
15 16 17 |
# File 'lib/onyxcord/interactions/internal/metadata.rb', line 15 def user @user end |
Instance Method Details
#command? ⇒ Boolean
91 92 93 |
# File 'lib/onyxcord/interactions/internal/metadata.rb', line 91 def command? @type == 1 end |
#component? ⇒ true, false
Returns whether or not the interaction metadata is for a message component.
91 92 93 |
# File 'lib/onyxcord/interactions/internal/metadata.rb', line 91 def command? @type == 1 end |
#interacted_message ⇒ Message?
Attempt to fetch the message that contained the interatctive component.
71 72 73 74 75 |
# File 'lib/onyxcord/interactions/internal/metadata.rb', line 71 def return unless @interacted_message_id @interacted_message ||= @message.channel.(@interacted_message_id) end |
#modal_submit? ⇒ true, false
Returns whether or not the interaction metadata is for a modal submission.
91 92 93 |
# File 'lib/onyxcord/interactions/internal/metadata.rb', line 91 def command? @type == 1 end |
#original_response_message ⇒ Message?
Attempt to fetch the original response message of the interaction.
79 80 81 82 83 |
# File 'lib/onyxcord/interactions/internal/metadata.rb', line 79 def return unless @original_response_message_id @original_response_message ||= @message.channel.(@original_response_message_id) end |
#server_integration? ⇒ true, false
Check if the interaction was triggered by a server by installed the application.
57 58 59 |
# File 'lib/onyxcord/interactions/internal/metadata.rb', line 57 def server_integration? @integration_owners[0] == @message.server.id end |
#target_message ⇒ Message?
Attempt to fetch the target message of the interaction.
63 64 65 66 67 |
# File 'lib/onyxcord/interactions/internal/metadata.rb', line 63 def return unless @target_message_id @target_message ||= @message.channel.(@target_message_id) end |
#user_integration? ⇒ true, false
Check if the interaction was triggered by a user by installed the application.
50 51 52 |
# File 'lib/onyxcord/interactions/internal/metadata.rb', line 50 def user_integration? @integration_owners[1] == @user.id end |