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.
1051 1052 1053 |
# File 'lib/discordrb/data/interaction.rb', line 1051 def @interacted_message_id end |
#original_response_message_id ⇒ Integer? (readonly)
Returns the ID the original response message; only present on follow-up messages.
1054 1055 1056 |
# File 'lib/discordrb/data/interaction.rb', line 1054 def @original_response_message_id end |
#target_message_id ⇒ Integer? (readonly)
Returns the ID of the message the command was ran on.
1045 1046 1047 |
# File 'lib/discordrb/data/interaction.rb', line 1045 def @target_message_id end |
#target_user ⇒ User? (readonly)
Returns the user that the command was ran on.
1042 1043 1044 |
# File 'lib/discordrb/data/interaction.rb', line 1042 def target_user @target_user end |
#triggering_metadata ⇒ Metadata? (readonly)
Returns the metadata for the interaction that opened the modal.
1048 1049 1050 |
# File 'lib/discordrb/data/interaction.rb', line 1048 def @triggering_metadata end |
#type ⇒ Integer (readonly)
Returns the type of the interaction.
1036 1037 1038 |
# File 'lib/discordrb/data/interaction.rb', line 1036 def type @type end |
#user ⇒ User (readonly)
Returns the user that initiated the interaction.
1039 1040 1041 |
# File 'lib/discordrb/data/interaction.rb', line 1039 def user @user end |
Instance Method Details
#command? ⇒ true, false
Returns whether or not the interaction metadata is for an application command.
1115 1116 1117 1118 1119 |
# File 'lib/discordrb/data/interaction.rb', line 1115 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.
1115 1116 1117 1118 1119 |
# File 'lib/discordrb/data/interaction.rb', line 1115 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.
1095 1096 1097 1098 1099 |
# File 'lib/discordrb/data/interaction.rb', line 1095 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.
1115 1116 1117 1118 1119 |
# File 'lib/discordrb/data/interaction.rb', line 1115 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.
1103 1104 1105 1106 1107 |
# File 'lib/discordrb/data/interaction.rb', line 1103 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.
1081 1082 1083 |
# File 'lib/discordrb/data/interaction.rb', line 1081 def server_integration? @integration_owners[0] == @message.server.id end |
#target_message ⇒ Message?
Attempt to fetch the target message of the interaction.
1087 1088 1089 1090 1091 |
# File 'lib/discordrb/data/interaction.rb', line 1087 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.
1074 1075 1076 |
# File 'lib/discordrb/data/interaction.rb', line 1074 def user_integration? @integration_owners[1] == @user.id end |