Module: Discorb::Interaction::UpdateResponder
- Included in:
- MessageComponentInteraction
- Defined in:
- lib/discorb/interaction/response.rb
Overview
A module for response with update.
Instance Method Summary collapse
-
#defer_update(ephemeral: false) -> Async::Task<void>
Response with
DEFERRED_UPDATE_MESSAGE
(6
). -
#edit(content, tts: false, embed: nil, embeds: nil, allowed_mentions: nil, components: nil, ephemeral: false) -> Async::Task<void>
Response with
UPDATE_MESSAGE
(7
).
Instance Method Details
#defer_update(ephemeral: false) -> Async::Task<void>
Response with DEFERRED_UPDATE_MESSAGE
(6
).
158 159 160 161 162 163 164 165 166 167 |
# File 'lib/discorb/interaction/response.rb', line 158 def defer_update(ephemeral: false) Async do @client.http.request(Route.new("/interactions/#{@id}/#{@token}/callback", "//interactions/:interaction_id/:token/callback", :post), { type: 6, data: { flags: (ephemeral ? 1 << 6 : 0), }, }).wait end end |
#edit(content, tts: false, embed: nil, embeds: nil, allowed_mentions: nil, components: nil, ephemeral: false) -> Async::Task<void>
Response with UPDATE_MESSAGE
(7
).
184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 |
# File 'lib/discorb/interaction/response.rb', line 184 def edit(content, tts: false, embed: nil, embeds: nil, allowed_mentions: nil, components: nil, ephemeral: false) Async do payload = {} payload[:content] = content if content payload[:tts] = tts = if [] elsif end payload[:embeds] = .map(&:to_hash) if payload[:allowed_mentions] = allowed_mentions ? allowed_mentions.to_hash(@client.allowed_mentions) : @client.allowed_mentions.to_hash payload[:components] = Component.to_payload(components) if components payload[:flags] = (ephemeral ? 1 << 6 : 0) @client.http.request(Route.new("/interactions/#{@id}/#{@token}/callback", "//interactions/:interaction_id/:token/callback", :post), { type: 7, data: payload }).wait end end |