fix crash bug

This commit is contained in:
SowinskiBraeden committed 2022-07-03 13:27:57 -07:00
1 parent 9d6be863ad
commit 0d69c6c79d
2 files changed
+21 -1

No files matched your search

+1 -1
View File
@@ -17,7 +17,7 @@ module.exports = {
* @param {string[]} args * @param {string[]} args
* @param {*} param3 * @param {*} param3
*/ */
run: async (client, message, args) => { run: async (client, message, args, { GuildDB }) => {
let useCommand = await client.verifyUseCommand(GuildDB.serverID, message.member.roles.cache, false); let useCommand = await client.verifyUseCommand(GuildDB.serverID, message.member.roles.cache, false);
if (!useCommand) return message.channel.send("You don't have permission to use this command"); if (!useCommand) return message.channel.send("You don't have permission to use this command");
+20
View File
@@ -97,6 +97,26 @@ class LinesPoliceCadBot extends Client {
}); });
} }
/* Not yet done
async canUseCommand(interaction, GuildDB) {
if (!GuildDB.customChannelStatus) return true;
let channel_id;
for (let i = 0; i < GuildDB.allowedChannels.length; i++) {
channel_id = GuildDB.allowedChannels[i];
if(interaction.guild.channels.cache.get(channel_id) === undefined) {
this.dbo.collection("prefixes").updateOne({"server.serverID":interaction.guild.id},{$pull:{"server.allowedChannels":channel_id},$set:{"server.hasCustomChannels":false}},function(err, res) {
if (err) throw err;
GuildDB.allowedChannels.splice(i, i+1);
if (GuildDB.allowedChannels.length == 0) GuildDB.customChannelStatus = false;
});
}
}
if (!GuildDB.allowedChannels.includes(interaction.channel_id)) {
return false;
}
}
*/
exists(n) {return null != n && undefined != n && "" != n} exists(n) {return null != n && undefined != n && "" != n}
LoadCommands() { LoadCommands() {