Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
gitlab-ce
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
gitlab-ce
Commits
736b6f1d
Commit
736b6f1d
authored
Nov 05, 2018
by
blackst0ne
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update discord notification service
parent
1ec470fd
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
4 additions
and
6 deletions
+4
-6
app/models/project_services/discord_service.rb
app/models/project_services/discord_service.rb
+4
-6
No files found.
app/models/project_services/discord_service.rb
View file @
736b6f1d
...
@@ -19,7 +19,7 @@ class DiscordService < ChatNotificationService
...
@@ -19,7 +19,7 @@ class DiscordService < ChatNotificationService
"This service sends notifications about projects events to Discord channels.<br />
"This service sends notifications about projects events to Discord channels.<br />
To set up this service:
To set up this service:
<ol>
<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>Paste the <strong>Webhook URL</strong> into the field below.</li>
<li>Select events below to enable notifications.</li>
<li>Select events below to enable notifications.</li>
</ol>"
</ol>"
...
@@ -30,9 +30,11 @@ class DiscordService < ChatNotificationService
...
@@ -30,9 +30,11 @@ class DiscordService < ChatNotificationService
end
end
def
event_field
(
event
)
def
event_field
(
event
)
# No-op.
end
end
def
default_channel_placeholder
def
default_channel_placeholder
# No-op.
end
end
def
default_fields
def
default_fields
...
@@ -47,13 +49,9 @@ class DiscordService < ChatNotificationService
...
@@ -47,13 +49,9 @@ class DiscordService < ChatNotificationService
def
notify
(
message
,
opts
)
def
notify
(
message
,
opts
)
client
=
Discordrb
::
Webhooks
::
Client
.
new
(
url:
webhook
)
client
=
Discordrb
::
Webhooks
::
Client
.
new
(
url:
webhook
)
client
.
execute
do
|
builder
|
client
.
execute
do
|
builder
|
builder
.
content
=
message
.
pretext
builder
.
content
=
message
.
pretext
# builder.add_embed do |embed|
# embed.title = 'Embed title'
# embed.description = 'Embed description'
# embed.timestamp = Time.now
# end
end
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