Method: Discordrb::Webhooks::Client#execute
- Defined in:
- lib/discordrb/webhooks/client.rb
#execute(builder = nil, wait = false, components = nil, thread_id: nil) {|builder| ... } ⇒ RestClient::Response
Executes the webhook this client points to with the given data.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 |
# File 'lib/discordrb/webhooks/client.rb', line 42 def execute(builder = nil, wait = false, components = nil, thread_id: nil) raise TypeError, 'builder needs to be nil or like a Discordrb::Webhooks::Builder!' unless (builder.respond_to?(:file) && builder.respond_to?(:to_multipart_hash)) || builder.respond_to?(:to_json_hash) || builder.nil? builder ||= Builder.new view = View.new yield(builder, view) if block_given? components ||= view if builder.file post_multipart(builder, components, wait, thread_id) else post_json(builder, components, wait, thread_id) end end |