Class: Discorb::Interaction::SourceResponse::CallbackMessage
- Inherits:
-
Object
- Object
- Discorb::Interaction::SourceResponse::CallbackMessage
- Defined in:
- lib/discorb/interaction.rb
Instance Method Summary collapse
-
#delete! -> Object
Deletes the callback message.
-
#edit(content = :unset, embed: :unset, embeds: :unset, file: :unset, files: :unset, attachments: :unset) -> Object
(also: #modify)
Edits the callback message.
Instance Method Details
#delete! -> Object
Note:
This will fail if the message is ephemeral.
Deletes the callback message.
239 240 241 242 243 |
# File 'lib/discorb/interaction.rb', line 239 def delete! Async do @client.http.delete("/webhooks/#{@application_id}/#{@token}/messages/@original").wait end end |
#edit(content = :unset, embed: :unset, embeds: :unset, file: :unset, files: :unset, attachments: :unset) -> Object Also known as: modify
Note:
This is an asynchronous method, it will return a Async::Task
object. Use Async::Task#wait
to get the result.
Note:
This method calls HTTP request.
Note:
The arguments of this method are defaultly set to :unset
. Specify value to set the value, if not don't specify or specify :unset
.
Edits the callback message.
209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 |
# File 'lib/discorb/interaction.rb', line 209 def edit( content = :unset, embed: :unset, embeds: :unset, file: :unset, files: :unset, attachments: :unset ) Async do payload = {} payload[:content] = content if content != :unset payload[:embeds] = ? [.to_hash] : [] if != :unset payload[:embeds] = .map(&:to_hash) if != :unset payload[:attachments] = .map(&:to_hash) if != :unset files = [file] if file != :unset if files == :unset headers = { "Content-Type" => "application/json", } else headers, payload = HTTP.multipart(payload, files) end @client.http.patch("/webhooks/#{@application_id}/#{@token}/messages/@original", payload, headers: headers).wait end end |