From e6950df5296f6d92473e07df968a507e0ab37605 Mon Sep 17 00:00:00 2001 From: Olly Nicholass Date: Fri, 29 Jan 2021 23:16:30 +0000 Subject: [PATCH] feat(*): Restrict ud command to the adult channel --- commands.js | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/commands.js b/commands.js index b62b5bf..6d38eb0 100644 --- a/commands.js +++ b/commands.js @@ -3,6 +3,8 @@ const axios = require('axios'); const cheerio = require('cheerio'); const got = require('got'); +const adultChannelName = 'adult-only-chat'; + module.exports = { dailyTasks: function (client) { sendDailyDilbert(client); @@ -13,7 +15,13 @@ module.exports = { commandHelp(Discord, config, logger, message, command, args); break; case 'ud': - commandUrbanDictionary(Discord, config, logger, message, command, args); + if (message.channel.name === adultChannelName) { + commandUrbanDictionary(Discord, config, logger, message, command, args); + } + else { + const channel = message.client.channels.cache.find((channel) => channel.name === adultChannelName); + message.channel.send(`This command is restricted to the <#${channel.id}> channel.`); + } break; default: message.channel.send(`That command is not one I know yet - but you could add it! To find out more visit ${config.github_url}`);