diff --git a/commands/updateStatus.js b/commands/updateStatus.js index f44a9bb..87e8929 100644 --- a/commands/updateStatus.js +++ b/commands/updateStatus.js @@ -17,7 +17,7 @@ module.exports = { * @param {string[]} args * @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); if (!useCommand) return message.channel.send("You don't have permission to use this command"); diff --git a/structures/LinesPoliceCadBot.js b/structures/LinesPoliceCadBot.js index 8e36d19..8014022 100644 --- a/structures/LinesPoliceCadBot.js +++ b/structures/LinesPoliceCadBot.js @@ -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} LoadCommands() {