Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
heptapod
heptapod
Commits
7cc709891d3d
Commit
f71087a3
authored
Nov 05, 2018
by
blackst0ne
Browse files
Update discord notification service
parent
540f3a007738
Changes
1
Hide whitespace changes
Inline
Side-by-side
app/models/project_services/discord_service.rb
View file @
7cc70989
...
...
@@ -19,7 +19,7 @@ def help
"This service sends notifications about projects events to Discord channels.<br />
To set up this service:
<ol>
<li><a href='
ADD-DISCORD-LINK-HERE
'>Setup a custom Incoming Webhook</a>.</li>
<li><a href='
https://support.discordapp.com/hc/en-us/articles/228383668-Intro-to-Webhooks
'>Setup a custom Incoming Webhook</a>.</li>
<li>Paste the <strong>Webhook URL</strong> into the field below.</li>
<li>Select events below to enable notifications.</li>
</ol>"
...
...
@@ -30,9 +30,11 @@ def webhook_placeholder
end
def
event_field
(
event
)
# No-op.
end
def
default_channel_placeholder
# No-op.
end
def
default_fields
...
...
@@ -47,13 +49,9 @@ def default_fields
def
notify
(
message
,
opts
)
client
=
Discordrb
::
Webhooks
::
Client
.
new
(
url:
webhook
)
client
.
execute
do
|
builder
|
builder
.
content
=
message
.
pretext
# builder.add_embed do |embed|
# embed.title = 'Embed title'
# embed.description = 'Embed description'
# embed.timestamp = Time.now
# end
end
end
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment