Class: Discorb::Interaction::SourceResponder::CallbackMessage
- Inherits:
-
Object
- Object
- Discorb::Interaction::SourceResponder::CallbackMessage
- Defined in:
- lib/discorb/interaction/response.rb
Overview
Represents of a callback message of interaction.
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.
- #inspect -> Object
Instance Method Details
#delete! -> Async::Task<void>
Note:
This will fail if the message is ephemeral.
Deletes the callback message.
134 135 136 137 138 |
# File 'lib/discorb/interaction/response.rb', line 134 def delete! Async do @client.http.request(Route.new("/webhooks/#{@application_id}/#{@token}/messages/@original", "//webhooks/:webhook_id/:token/messages/@original", :delete)).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.
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 |
# File 'lib/discorb/interaction/response.rb', line 107 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_request(Route.new("/webhooks/#{@application_id}/#{@token}/messages/@original", "//webhooks/:webhook_id/:token/messages/@original", :patch), payload, files, headers: headers).wait end end |
#inspect -> Object
140 141 142 |
# File 'lib/discorb/interaction/response.rb', line 140 def inspect "#<#{self.class.name} application_id=#{@application_id}" end |