forked from SplitScreen-Me/splitscreenme-hub
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
upgraded handler release notif for the discord bot
- Loading branch information
Showing
1 changed file
with
38 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,56 +1,63 @@ | ||
import { Meteor } from 'meteor/meteor'; | ||
import { HTTP } from 'meteor/http'; | ||
|
||
const adminLogging_webhookUrl = Meteor.settings.private.DISCORD_ADMIN_LOGGING_WEBHOOK || ""; | ||
const releaseLogging_webhookUrl = Meteor.settings.private.DISCORD_RELEASE_LOGGING_WEBHOOK || ""; | ||
const generalLogging_webhookUrl = Meteor.settings.private.DISCORD_GENERAL_LOGGING_WEBHOOK || ""; | ||
const adminLogging_webhookUrl = Meteor.settings.private.DISCORD_ADMIN_LOGGING_WEBHOOK || ''; | ||
const releaseLogging_webhookUrl = Meteor.settings.private.DISCORD_RELEASE_LOGGING_WEBHOOK || ''; | ||
const generalLogging_webhookUrl = Meteor.settings.private.DISCORD_GENERAL_LOGGING_WEBHOOK || ''; | ||
|
||
// Discord Admin Logging : | ||
const d_aLog = (title, description) => { | ||
if(adminLogging_webhookUrl.length > 0){ | ||
if (adminLogging_webhookUrl.length > 0) { | ||
HTTP.call('POST', adminLogging_webhookUrl, { | ||
data: { content: `**${title}** - \`${description}\`` } | ||
}) | ||
}else{ | ||
data: { content: `**${title}** - \`${description}\`` }, | ||
}); | ||
} else { | ||
console.log(`[Discord Admin Logging] ${title} - ${description}`); | ||
} | ||
}; | ||
// Discord Release Logging : | ||
const d_rLog = handler => { | ||
const discordData = { | ||
content: "**New handler release!**", | ||
embeds: [{ | ||
color: 3447003, | ||
title: handler.gameName, | ||
url: `https://hub.splitscreen.me/handler/${handler._id}`, | ||
thumbnail: { | ||
url: `https://images.igdb.com/igdb/image/upload/t_cover_big/${handler.gameCover}.jpg`, | ||
}, | ||
fields: [ | ||
{ | ||
name: 'Author', | ||
inline: true, | ||
value: handler.ownerName, | ||
content: '**New handler release!**', | ||
embeds: [ | ||
{ | ||
color: 3447003, | ||
title: handler.gameName, | ||
url: `https://hub.splitscreen.me/handler/${handler._id}`, | ||
thumbnail: { | ||
url: `https://images.igdb.com/igdb/image/upload/t_cover_big/${handler.gameCover}.jpg`, | ||
}, | ||
fields: [ | ||
{ | ||
name: 'Author', | ||
inline: true, | ||
value: `[${handler.ownerName}](https://hub.splitscreen.me/user/${handler.owner})`, | ||
}, | ||
{ | ||
name: `Download`, | ||
inline: true, | ||
value: `[Download Handler (v${handler.currentVersion})](https://hub.splitscreen.me/cdn/storage/packages/${handler.currentPackage}/original/handler-${handler._id}-v${handler.currentVersion}.nc?download=true)`, | ||
}, | ||
], | ||
timestamp: new Date(), | ||
footer: { | ||
icon_url: 'https://www.splitscreen.me/img/splitscreen-me-logo.png', | ||
text: '© SplitScreen.Me', | ||
}, | ||
], | ||
timestamp: new Date(), | ||
footer: { | ||
icon_url: "https://www.splitscreen.me/img/splitscreen-me-logo.png", | ||
text: '© SplitScreen.Me', | ||
}, | ||
}], | ||
], | ||
}; | ||
|
||
if(releaseLogging_webhookUrl.length > 0 && generalLogging_webhookUrl){ | ||
if (releaseLogging_webhookUrl.length > 0 && generalLogging_webhookUrl) { | ||
HTTP.call('POST', releaseLogging_webhookUrl, { | ||
data: {...discordData, content: "**New handler release!**\n<@&696472181093171300>"} | ||
data: { ...discordData, content: '**New handler release!**\n<@&696472181093171300>' }, | ||
}); | ||
HTTP.call('POST', generalLogging_webhookUrl, { | ||
data: discordData | ||
data: discordData, | ||
}); | ||
}else{ | ||
} else { | ||
console.log(`[Discord Release Logging] ${handler.title} by ${handler.ownerName}`); | ||
} | ||
}; | ||
|
||
export {d_aLog, d_rLog}; | ||
export { d_aLog, d_rLog }; |