Class: Discorb::Interaction::SourceResponse::CallbackMessage
- Inherits:
-
Object
- Object
- Discorb::Interaction::SourceResponse::CallbackMessage
- Defined in:
- lib/discorb/interaction/response.rb
Instance Method Summary collapse
-
#delete! -> Async::Task<void>
Deletes the callback message.
-
#edit(content = Discorb::Unset, embed: Discorb::Unset, embeds: Discorb::Unset, file: Discorb::Unset, files: Discorb::Unset, attachments: Discorb::Unset) -> Async::Task<void>
(also: #modify)
Edits the callback message.
Instance Method Details
#delete! -> Async::Task<void>
Note:
This will fail if the message is ephemeral.
Deletes the callback message.
119 120 121 122 123 |
# File 'lib/discorb/interaction/response.rb', line 119 def delete! Async do @client.http.delete("/webhooks/#{@application_id}/#{@token}/messages/@original").wait end end |
#edit(content = Discorb::Unset, embed: Discorb::Unset, embeds: Discorb::Unset, file: Discorb::Unset, files: Discorb::Unset, attachments: Discorb::Unset) -> Async::Task<void> Also known as: modify
Note:
The arguments of this method are defaultly set to Discorb::Unset
. Specify value to set the value, if not don't specify or specify Discorb::Unset
.
Edits the callback message.
92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 |
# File 'lib/discorb/interaction/response.rb', line 92 def edit( content = Discorb::Unset, embed: Discorb::Unset, embeds: Discorb::Unset, file: Discorb::Unset, files: Discorb::Unset, attachments: Discorb::Unset ) Async do payload = {} payload[:content] = content if content != Discorb::Unset payload[:embeds] = ? [.to_hash] : [] if != Discorb::Unset payload[:embeds] = .map(&:to_hash) if != Discorb::Unset payload[:attachments] = .map(&:to_hash) if != Discorb::Unset files = [file] if file != Discorb::Unset files = [] if files == Discorb::Unset @client.http.multipart_patch("/webhooks/#{@application_id}/#{@token}/messages/@original", payload, files, headers: headers).wait end end |