Class: Discorb::Interaction::SourceResponse::CallbackMessage
- Inherits:
-
Object
- Object
- Discorb::Interaction::SourceResponse::CallbackMessage
- Defined in:
- lib/discorb/interaction/response.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.
121 122 123 124 125 |
# File 'lib/discorb/interaction/response.rb', line 121 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.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 |
# File 'lib/discorb/interaction/response.rb', line 91 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 |