Merge pull request #99 from v0idp/develop

Develop
This commit is contained in:
void*
2020-02-12 01:35:10 +01:00
committed by GitHub
3 changed files with 9 additions and 15 deletions

4
package-lock.json generated
View File

@@ -289,8 +289,8 @@
"integrity": "sha1-+hN8S9aY7fVc1c0CrFWfkaTEups="
},
"discord.js": {
"version": "github:discordjs/discord.js#fe7df708e44e0280dfaf0f8e457b154781bb5140",
"from": "github:discordjs/discord.js#fe7df708e44e0280dfaf0f8e457b154781bb5140",
"version": "github:discordjs/discord.js#8e9e93da1d9c96a7acf63cc1c5317a42e56afbd8",
"from": "github:discordjs/discord.js#8e9e93da1d9c96a7acf63cc1c5317a42e56afbd8",
"requires": {
"@discordjs/collection": "^0.1.1",
"abort-controller": "^3.0.0",

View File

@@ -33,7 +33,7 @@
"bcryptjs": "^2.4.3",
"bluebird": "^3.5.5",
"cookie-parser": "^1.4.4",
"discord.js": "github:discordjs/discord.js#fe7df708e44e0280dfaf0f8e457b154781bb5140",
"discord.js": "github:discordjs/discord.js#8e9e93da1d9c96a7acf63cc1c5317a42e56afbd8",
"discord.js-commando": "discordjs/Commando",
"ejs": "^2.6.2",
"express": "^4.17.1",

View File

@@ -64,18 +64,12 @@ module.exports = class BotClient extends Commando.Client {
}
});
this.dispatcher.addInhibitor((message) => {
// Older versions of the DB may not have channelName defined
const bot = this.webDatabase.webConfig['bot'];
if (!bot.channelname || bot.channelname.length == 0) {
return false;
}
else if (!message.guild.channels.has(bot.channelname)) {
console.log(`The channel to monitor you entered doesn\'t exist in this guild. (${message.guild.id})`);
return false;
}
return (message.channel.name.toLowerCase() !== bot.channelname.toLowerCase()) ? 'Not allowed in this channel' : false;
});
const channelname = this.webDatabase.webConfig['bot'].channelname.toLowerCase();
if (channelname !== "") {
this.dispatcher.addInhibitor((msg) => {
return (channelname !== msg.channel.name.toLowerCase() && msg.guild.channels.has(channelname)) ? 'Not allowed in this channel' : false;
});
}
// login client with bot token
this.login(this.token)