Class: LibDiscord::Webhook
Overview
Webhook Resource
Do not instantiate a Webhook directly. Instead request one from an instance of Client.
client = LibDiscord::Client.new("Bot auth.token")
w = client["webhook"]
Instance Method Summary
collapse
-
#create_webhook(channel_id:, json:) ⇒ Response
-
#delete_webhook(webhook_id:) ⇒ Response
-
#delete_webhook_message(webhook_id:, webhook_token:, message_id:) ⇒ Response
-
#delete_webhook_with_token(webhook_id:, webhook_token:) ⇒ Response
-
#edit_webhook_message(webhook_id:, webhook_token:, message_id:, json:, params: {}) ⇒ Response
-
#execute_github_compatible_webhook(webhook_id:, webhook_token:, params: {}) ⇒ Response
-
#execute_slack_compatible_webhook(webhook_id:, webhook_token:, params: {}) ⇒ Response
-
#execute_webhook(webhook_id:, webhook_token:, json:, params: {}) ⇒ Response
-
#get_channel_webhooks(channel_id:) ⇒ Response
-
#get_guild_webhooks(guild_id:) ⇒ Response
-
#get_webhook(webhook_id:) ⇒ Response
-
#get_webhook_message(webhook_id:, webhook_token:, message_id:, params: {}) ⇒ Response
-
#get_webhook_with_token(webhook_id:, webhook_token:) ⇒ Response
-
#modify_webhook(webhook_id:, json:) ⇒ Response
-
#modify_webhook_with_token(webhook_id:, webhook_token:, json:) ⇒ Response
Methods inherited from Resource
#initialize
Instance Method Details
#create_webhook(channel_id:, json:) ⇒ Response
31
32
33
|
# File 'lib/lib_discord/webhook.rb', line 31
def create_webhook(channel_id:, json:)
send_request(:post, "/channels/#{channel_id}/webhooks", json:)
end
|
#delete_webhook(webhook_id:) ⇒ Response
151
152
153
|
# File 'lib/lib_discord/webhook.rb', line 151
def delete_webhook(webhook_id:)
send_request(:delete, "/webhooks/#{webhook_id}")
end
|
#delete_webhook_message(webhook_id:, webhook_token:, message_id:) ⇒ Response
295
296
297
|
# File 'lib/lib_discord/webhook.rb', line 295
def delete_webhook_message(webhook_id:, webhook_token:, message_id:)
send_request(:delete, "/webhooks/#{webhook_id}/#{webhook_token}/messages/#{message_id}")
end
|
#delete_webhook_with_token(webhook_id:, webhook_token:) ⇒ Response
167
168
169
170
171
172
173
|
# File 'lib/lib_discord/webhook.rb', line 167
def delete_webhook_with_token(webhook_id:, webhook_token:)
send_request(
:delete,
"/webhooks/#{webhook_id}/#{webhook_token}",
http_client: client
)
end
|
#edit_webhook_message(webhook_id:, webhook_token:, message_id:, json:, params: {}) ⇒ Response
276
277
278
|
# File 'lib/lib_discord/webhook.rb', line 276
def edit_webhook_message(webhook_id:, webhook_token:, message_id:, json:, params: {})
send_request(:patch, "/webhooks/#{webhook_id}/#{webhook_token}/messages/#{message_id}", json:, params:)
end
|
#execute_github_compatible_webhook(webhook_id:, webhook_token:, params: {}) ⇒ Response
230
231
232
|
# File 'lib/lib_discord/webhook.rb', line 230
def execute_github_compatible_webhook(webhook_id:, webhook_token:, params: {})
send_request(:post, "/webhooks/#{webhook_id}/#{webhook_token}/github", params:)
end
|
#execute_slack_compatible_webhook(webhook_id:, webhook_token:, params: {}) ⇒ Response
211
212
213
|
# File 'lib/lib_discord/webhook.rb', line 211
def execute_slack_compatible_webhook(webhook_id:, webhook_token:, params: {})
send_request(:post, "/webhooks/#{webhook_id}/#{webhook_token}/slack", params:)
end
|
#execute_webhook(webhook_id:, webhook_token:, json:, params: {}) ⇒ Response
192
193
194
|
# File 'lib/lib_discord/webhook.rb', line 192
def execute_webhook(webhook_id:, webhook_token:, json:, params: {})
send_request(:post, "/webhooks/#{webhook_id}/#{webhook_token}", json:, params:)
end
|
#get_channel_webhooks(channel_id:) ⇒ Response
46
47
48
|
# File 'lib/lib_discord/webhook.rb', line 46
def get_channel_webhooks(channel_id:)
send_request(:get, "/channels/#{channel_id}/webhooks")
end
|
#get_guild_webhooks(guild_id:) ⇒ Response
61
62
63
|
# File 'lib/lib_discord/webhook.rb', line 61
def get_guild_webhooks(guild_id:)
send_request(:get, "/guilds/#{guild_id}/webhooks")
end
|
#get_webhook(webhook_id:) ⇒ Response
76
77
78
|
# File 'lib/lib_discord/webhook.rb', line 76
def get_webhook(webhook_id:)
send_request(:get, "/webhooks/#{webhook_id}")
end
|
#get_webhook_message(webhook_id:, webhook_token:, message_id:, params: {}) ⇒ Response
252
253
254
|
# File 'lib/lib_discord/webhook.rb', line 252
def get_webhook_message(webhook_id:, webhook_token:, message_id:, params: {})
send_request(:get, "/webhooks/#{webhook_id}/#{webhook_token}/messages/#{message_id}", params:)
end
|
#get_webhook_with_token(webhook_id:, webhook_token:) ⇒ Response
92
93
94
95
96
97
98
|
# File 'lib/lib_discord/webhook.rb', line 92
def get_webhook_with_token(webhook_id:, webhook_token:)
send_request(
:get,
"/webhooks/#{webhook_id}/#{webhook_token}",
http_client: client
)
end
|
#modify_webhook(webhook_id:, json:) ⇒ Response
113
114
115
|
# File 'lib/lib_discord/webhook.rb', line 113
def modify_webhook(webhook_id:, json:)
send_request(:patch, "/webhooks/#{webhook_id}", json:)
end
|
#modify_webhook_with_token(webhook_id:, webhook_token:, json:) ⇒ Response
131
132
133
134
135
136
137
138
|
# File 'lib/lib_discord/webhook.rb', line 131
def modify_webhook_with_token(webhook_id:, webhook_token:, json:)
send_request(
:patch,
"/webhooks/#{webhook_id}/#{webhook_token}",
json:,
http_client: client
)
end
|