Class: Discordrb::Interactions::Metadata
- Inherits:
-
Object
- Object
- Discordrb::Interactions::Metadata
- Includes:
- Discordrb::IDObject
- Defined in:
- lib/discordrb/data/interaction.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 Discordrb::IDObject
Instance Method Summary collapse
-
#command? ⇒ true, false
Whether or not the interaction metadata is for an application command.
-
#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 Discordrb::IDObject
#==, #creation_time, synthesise
Instance Attribute Details
#interacted_message_id ⇒ Integer? (readonly)
Returns the ID of the message that contained the interactive message component.
1058 1059 1060 |
# File 'lib/discordrb/data/interaction.rb', line 1058 def @interacted_message_id end |
#original_response_message_id ⇒ Integer? (readonly)
Returns the ID the original response message; only present on follow-up messages.
1061 1062 1063 |
# File 'lib/discordrb/data/interaction.rb', line 1061 def @original_response_message_id end |
#target_message_id ⇒ Integer? (readonly)
Returns the ID of the message the command was ran on.
1052 1053 1054 |
# File 'lib/discordrb/data/interaction.rb', line 1052 def @target_message_id end |
#target_user ⇒ User? (readonly)
Returns the user that the command was ran on.
1049 1050 1051 |
# File 'lib/discordrb/data/interaction.rb', line 1049 def target_user @target_user end |
#triggering_metadata ⇒ Metadata? (readonly)
Returns the metadata for the interaction that opened the modal.
1055 1056 1057 |
# File 'lib/discordrb/data/interaction.rb', line 1055 def @triggering_metadata end |
#type ⇒ Integer (readonly)
Returns the type of the interaction.
1043 1044 1045 |
# File 'lib/discordrb/data/interaction.rb', line 1043 def type @type end |
#user ⇒ User (readonly)
Returns the user that initiated the interaction.
1046 1047 1048 |
# File 'lib/discordrb/data/interaction.rb', line 1046 def user @user end |
Instance Method Details
#command? ⇒ true, false
Returns whether or not the interaction metadata is for an application command.
1122 1123 1124 1125 1126 |
# File 'lib/discordrb/data/interaction.rb', line 1122 Interaction::TYPES.each do |name, value| define_method("#{name}?") do @type == value end end |
#component? ⇒ true, false
Returns whether or not the interaction metadata is for a message component.
1122 1123 1124 1125 1126 |
# File 'lib/discordrb/data/interaction.rb', line 1122 Interaction::TYPES.each do |name, value| define_method("#{name}?") do @type == value end end |
#interacted_message ⇒ Message?
Attempt to fetch the message that contained the interatctive component.
1102 1103 1104 1105 1106 |
# File 'lib/discordrb/data/interaction.rb', line 1102 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.
1122 1123 1124 1125 1126 |
# File 'lib/discordrb/data/interaction.rb', line 1122 Interaction::TYPES.each do |name, value| define_method("#{name}?") do @type == value end end |
#original_response_message ⇒ Message?
Attempt to fetch the original response message of the interaction.
1110 1111 1112 1113 1114 |
# File 'lib/discordrb/data/interaction.rb', line 1110 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.
1088 1089 1090 |
# File 'lib/discordrb/data/interaction.rb', line 1088 def server_integration? @integration_owners[0] == @message.server.id end |
#target_message ⇒ Message?
Attempt to fetch the target message of the interaction.
1094 1095 1096 1097 1098 |
# File 'lib/discordrb/data/interaction.rb', line 1094 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.
1081 1082 1083 |
# File 'lib/discordrb/data/interaction.rb', line 1081 def user_integration? @integration_owners[1] == @user.id end |