diff --git a/config.json b/config.json index 94faf26..51f373d 100644 --- a/config.json +++ b/config.json @@ -5,6 +5,7 @@ "numLinksToCache": 10, "messageDeleteDelay": 10000, "youtubeMode": true, + "allowSubscriptions": true, "logFile": "./log", "subscribersFile": "./subscribers.json", "userCommands": { diff --git a/feed-bot.js b/feed-bot.js index 8a77ca1..8ff3aa0 100644 --- a/feed-bot.js +++ b/feed-bot.js @@ -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 },