Skip to content
This repository was archived by the owner on Feb 15, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions conf-sample.js
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,9 @@ c.notifiers.discord = {}
c.notifiers.discord.on = false // false discord disabled; true discord enabled (key should be correct)
c.notifiers.discord.id = 'YOUR-WEBHOOK-ID'
c.notifiers.discord.token = 'YOUR-WEBHOOK-TOKEN'
c.notifiers.discord.username = '' // default "Zenbot"
c.notifiers.discord.avatar_url = ''
c.notifiers.discord.color = null // color as a decimal
// end discord configs

// prowl configs
Expand Down
18 changes: 9 additions & 9 deletions extensions/notifiers/discord.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,15 +3,15 @@ var request = require('request')
module.exports = function container (get, set, clear) {
var discord = {
pushMessage: function(config, title, message) {
var postData = {
"username": "Zenbot",
"avatar_url": "https://camo.githubusercontent.com/db46d81f1352cee31f9baea72dc4396a15ad1d3e/68747470733a2f2f7261776769742e636f6d2f6361726c6f7338662f7a656e626f742f6d61737465722f6173736574732f7a656e626f745f7371756172652e706e67",
"embeds": [{
"color": 15258703,
"fields": [{
"name": title,
"value": message
}]
var postData = {
"username": (config.username != '') ? config.username : "Zenbot",
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd use:
(config.username != '' ? config.username : "Zenbot")
But AFAIK the parenthesis are optional

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same for the two additions below

"avatar_url": (config.avatar_url != '') ? config.avatar_url : "https://camo.githubusercontent.com/db46d81f1352cee31f9baea72dc4396a15ad1d3e/68747470733a2f2f7261776769742e636f6d2f6361726c6f7338662f7a656e626f742f6d61737465722f6173736574732f7a656e626f745f7371756172652e706e67",
"embeds": [{
"color": (config.color != null) ? config.color : 15258703,
"fields": [{
"name": title,
"value": message
}]
}]
}

Expand Down