Module: Discordrb::API::Interaction
- Defined in:
- lib/discordrb/api/interaction.rb
Overview
API calls for interactions.
Class Method Summary collapse
-
.create_interaction_modal_response(interaction_token, interaction_id, custom_id, title, components) ⇒ Object
Create a response that results in a modal.
-
.create_interaction_response(interaction_token, interaction_id, type, content = nil, tts = nil, embeds = nil, allowed_mentions = nil, flags = nil, components = nil) ⇒ Object
Respond to an interaction.
-
.delete_original_interaction_response(interaction_token, application_id) ⇒ Object
Delete the original response to an interaction.
-
.edit_original_interaction_response(interaction_token, application_id, content = nil, embeds = nil, allowed_mentions = nil, components = nil) ⇒ Object
Edit the original response to an interaction.
-
.get_original_interaction_response(interaction_token, application_id) ⇒ Object
Get the original response to an interaction.
Class Method Details
.create_interaction_modal_response(interaction_token, interaction_id, custom_id, title, components) ⇒ Object
Create a response that results in a modal. https://discord.com/developers/docs/interactions/slash-commands#create-interaction-response
24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/discordrb/api/interaction.rb', line 24 def create_interaction_modal_response(interaction_token, interaction_id, custom_id, title, components) data = { custom_id: custom_id, title: title, components: components.to_a }.compact Discordrb::API.request( :interactions_iid_token_callback, interaction_id, :post, "#{Discordrb::API.api_base}/interactions/#{interaction_id}/#{interaction_token}/callback", { type: 9, data: data }.to_json, content_type: :json ) end |
.create_interaction_response(interaction_token, interaction_id, type, content = nil, tts = nil, embeds = nil, allowed_mentions = nil, flags = nil, components = nil) ⇒ Object
Respond to an interaction. https://discord.com/developers/docs/interactions/slash-commands#create-interaction-response
9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/discordrb/api/interaction.rb', line 9 def create_interaction_response(interaction_token, interaction_id, type, content = nil, tts = nil, = nil, allowed_mentions = nil, flags = nil, components = nil) data = { tts: tts, content: content, embeds: , allowed_mentions: allowed_mentions, flags: flags, components: components }.compact Discordrb::API.request( :interactions_iid_token_callback, interaction_id, :post, "#{Discordrb::API.api_base}/interactions/#{interaction_id}/#{interaction_token}/callback", { type: type, data: data }.to_json, content_type: :json ) end |
.delete_original_interaction_response(interaction_token, application_id) ⇒ Object
Delete the original response to an interaction. https://discord.com/developers/docs/interactions/slash-commands#delete-original-interaction-response
51 52 53 |
# File 'lib/discordrb/api/interaction.rb', line 51 def delete_original_interaction_response(interaction_token, application_id) Discordrb::API::Webhook.(interaction_token, application_id, '@original') end |
.edit_original_interaction_response(interaction_token, application_id, content = nil, embeds = nil, allowed_mentions = nil, components = nil) ⇒ Object
Edit the original response to an interaction. https://discord.com/developers/docs/interactions/slash-commands#edit-original-interaction-response
45 46 47 |
# File 'lib/discordrb/api/interaction.rb', line 45 def edit_original_interaction_response(interaction_token, application_id, content = nil, = nil, allowed_mentions = nil, components = nil) Discordrb::API::Webhook.(interaction_token, application_id, '@original', content, , allowed_mentions, components) end |
.get_original_interaction_response(interaction_token, application_id) ⇒ Object
Get the original response to an interaction. https://discord.com/developers/docs/interactions/slash-commands#get-original-interaction-response
39 40 41 |
# File 'lib/discordrb/api/interaction.rb', line 39 def get_original_interaction_response(interaction_token, application_id) Discordrb::API::Webhook.(interaction_token, application_id, '@original') end |