mirror of
https://github.com/discourse/discourse-chat-integration.git
synced 2025-07-08 22:52:44 +00:00
FEATURE: Allow custom query parameters in Discord webhooks (#236)
This commit is contained in:
parent
71dcae5365
commit
3450662e68
@ -79,8 +79,12 @@ module DiscourseChatIntegration
|
|||||||
end
|
end
|
||||||
|
|
||||||
def self.trigger_notification(post, channel, rule)
|
def self.trigger_notification(post, channel, rule)
|
||||||
|
# Splitting the URL in order to support custom query parameters (e.g. thread_id=1234)
|
||||||
|
splitted_url = channel.data["webhook_url"].split("?")
|
||||||
# Adding ?wait=true means that we actually get a success/failure response, rather than returning asynchronously
|
# Adding ?wait=true means that we actually get a success/failure response, rather than returning asynchronously
|
||||||
webhook_url = "#{channel.data["webhook_url"]}?wait=true"
|
webhook_url = "#{splitted_url[0]}?wait=true"
|
||||||
|
|
||||||
|
webhook_url += "&" + splitted_url[1] if splitted_url.length > 1
|
||||||
message = generate_discord_message(post)
|
message = generate_discord_message(post)
|
||||||
response = send_message(webhook_url, message)
|
response = send_message(webhook_url, message)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user