Added boolean toggle for use of subscriptions with the bot

This commit is contained in:
benji7425 2017-01-09 23:08:52 +00:00
parent 86fc7c414d
commit 5859713ae8
2 changed files with 8 additions and 6 deletions

View File

@ -5,6 +5,7 @@
"numLinksToCache": 10,
"messageDeleteDelay": 10000,
"youtubeMode": true,
"allowSubscriptions": true,
"logFile": "./log",
"subscribersFile": "./subscribers.json",
"userCommands": {

View File

@ -113,21 +113,22 @@ var DiscordClient = {
messageTriggers: [
{
message: Config.userCommands.subscribe,
action: (user, userID, channelID, message) => { Subscriptions.subscribe(user, userID, channelID, message); },
action: (user, userID, channelID, message) => { if (Config.allowSubscriptions) Subscriptions.subscribe(user, userID, channelID, message); },
channelID: Config.channelID
},
{
message: Config.userCommands.unsubscribe,
action: (user, userID, channelID, message) => { Subscriptions.unsubscribe(user, userID, channelID, message); },
action: (user, userID, channelID, message) => { if (Config.allowSubscriptions) Subscriptions.unsubscribe(user, userID, channelID, message); },
channelID: Config.channelID
},
{
message: Config.userCommands.subscribersList,
action: (user, userID, channelID, message) => {
DiscordClient.bot.sendMessage({
to: Config.channelID,
message: DiscordClient.bot.fixMessage("<@" + Subscriptions.subscribers.join("> <@") + ">")
}, (err, response) => { setTimeout(() => { DiscordClient.bot.deleteMessage({ channelID: channelID, messageID: response.id }); }, Config.messageDeleteDelay); });
if (Config.allowSubscriptions)
DiscordClient.bot.sendMessage({
to: Config.channelID,
message: DiscordClient.bot.fixMessage("<@" + Subscriptions.subscribers.join("> <@") + ">")
}, (err, response) => { setTimeout(() => { DiscordClient.bot.deleteMessage({ channelID: channelID, messageID: response.id }); }, Config.messageDeleteDelay); });
},
channelID: Config.channelID
},