Commit 8f51affe authored by Sam Bingner's avatar Sam Bingner Committed by Arturo Herrero

Make discord messages sort of readable

parent d27e02cd
......@@ -3,6 +3,7 @@
require "discordrb/webhooks"
class DiscordService < ChatNotificationService
LINK_REGEX = /(\[[^\]]*\]\()([^\)]*)\)/.freeze
def title
s_("DiscordService|Discord Notifications")
end
......@@ -52,7 +53,7 @@ class DiscordService < ChatNotificationService
client = Discordrb::Webhooks::Client.new(url: webhook)
client.execute do |builder|
builder.content = message.pretext
builder.content = (message.pretext + "\n\n" + message.attachments.to_s).gsub(LINK_REGEX, "\\1<\\2>)")
end
end
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment