From 449131e990a6f5d440dab52960adb1a7c40ed276 Mon Sep 17 00:00:00 2001 From: Braeden Sowinski Date: Fri, 6 May 2022 13:42:50 -0700 Subject: [PATCH] fix undefined exists func --- commands/debug.js | 6 +++--- commands/setChannel.js | 4 ++-- commands/setRole.js | 2 +- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/commands/debug.js b/commands/debug.js index 173cf13..52c81da 100644 --- a/commands/debug.js +++ b/commands/debug.js @@ -21,10 +21,10 @@ module.exports = { if (!client.config.Admins.includes(message.author.id)) return; if (args.length==0) return message.channel.send('Debug Error: Provide a debug command'); - if (!client.client.exists(args[0])) return message.channel.send('Debug Error: Provide a valid debug command'); + if (!client.exists(args[0])) return message.channel.send('Debug Error: Provide a valid debug command'); let debugConsole = false - if (client.client.exists(args[1])&&args[1]=='true') debugConsole = true + if (client.exists(args[1])&&args[1]=='true') debugConsole = true let command = args[0].toLowerCase(); @@ -91,7 +91,7 @@ module.exports = { if (!client.config.Admins.includes(interaction.member.user.id)) return; if (args.length==0) return message.channel.send('Debug Error: Provide a debug command'); - if (!client.client.exists(args[0].value)) return interaction.send('Debug Error: Provide a valid debug command'); + if (!client.exists(args[0].value)) return interaction.send('Debug Error: Provide a valid debug command'); let debugConsole = args[1].value; diff --git a/commands/setChannel.js b/commands/setChannel.js index 7a90d89..0b5f7f0 100644 --- a/commands/setChannel.js +++ b/commands/setChannel.js @@ -24,7 +24,7 @@ module.exports = { if (channel.type=="voice") return message.channel.send(`Connot set voice channel to preferred channel.`); if (channel.deleted) return message.channel.send(`Connot set deleted channel to preferred channel.`); let guild = await client.dbo.collection("prefixes").findOne({"server.serverID":message.guild.id}).then(guild => guild); - if (client.client.exists(guild.server.allowedChannels)&&guild.server.allowedChannels.includes(channelid)) return message.channel.send(`The channel ${args[0]} has already been added.`); + if (client.exists(guild.server.allowedChannels)&&guild.server.allowedChannels.includes(channelid)) return message.channel.send(`The channel ${args[0]} has already been added.`); client.dbo.collection("prefixes").updateOne({"server.serverID":message.guild.id},{$push:{"server.allowedChannels":channelid},$set:{"server.hasCustomChannels":true}},function(err, res) { if (err) throw err; return message.channel.send(`Successfully added ${args[0]} to allowed channels.`); @@ -58,7 +58,7 @@ module.exports = { if (channel.type=="voice") return interaction.send(`Connot set voice channel to preferred channel.`); if (channel.deleted) return interaction.send(`Connot set deleted channel to preferred channel.`); let guild = await client.dbo.collection("prefixes").findOne({"server.serverID":interaction.guild.id}).then(guild => guild); - if (client.client.exists(guild.server.allowedChannels)&&guild.server.allowedChannels.includes(channelid)) return interaction.send(`The channel <#${args[0].value}> has already been added.`); + if (client.exists(guild.server.allowedChannels)&&guild.server.allowedChannels.includes(channelid)) return interaction.send(`The channel <#${args[0].value}> has already been added.`); client.dbo.collection("prefixes").updateOne({"server.serverID":interaction.guild.id},{$push:{"server.allowedChannels":channelid},$set:{"server.hasCustomChannels":true}},function(err, res) { if (err) throw err; return interaction.send(`Successfully added <#${args[0].value}> to allowed channels.`); diff --git a/commands/setRole.js b/commands/setRole.js index d5b12fe..29698f5 100644 --- a/commands/setRole.js +++ b/commands/setRole.js @@ -24,7 +24,7 @@ module.exports = { return message.channel.send(`Uh Oh! The role ${args[0]} connot be found.`); } else { let guild = await client.dbo.collection("prefixes").findOne({"server.serverID":message.guild.id}).then(guild => guild); - if (client.client.exists(guild.server.allowedRoles)&&guild.server.allowedRoles.includes(roleid)) return message.channel.send(`The role ${args[0]} has already been added.`); + if (client.exists(guild.server.allowedRoles)&&guild.server.allowedRoles.includes(roleid)) return message.channel.send(`The role ${args[0]} has already been added.`); client.dbo.collection("prefixes").updateOne({"server.serverID":message.guild.id},{$push:{"server.allowedRoles":roleid},$set:{"server.hasCustomRoles":true}},function(err, res) { if (err) throw err; return message.channel.send(`Successfully added ${args[0]} to allowed roles.`);