From 9edb6b98d7fd39e81a1a61d55ae9158ff9e71a8b Mon Sep 17 00:00:00 2001 From: Braeden Sowinski Date: Thu, 17 Mar 2022 12:16:52 -0700 Subject: [PATCH] use client.exists --- commands/setChannel.js | 2 +- commands/setRole.js | 3 +-- events/ready.js | 10 +++++----- util/Exists.js | 4 ---- 4 files changed, 7 insertions(+), 12 deletions(-) delete mode 100644 util/Exists.js diff --git a/commands/setChannel.js b/commands/setChannel.js index bc42d81..f2b9f10 100644 --- a/commands/setChannel.js +++ b/commands/setChannel.js @@ -25,7 +25,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 (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.`); diff --git a/commands/setRole.js b/commands/setRole.js index cef54dd..e31fda4 100644 --- a/commands/setRole.js +++ b/commands/setRole.js @@ -1,5 +1,4 @@ const { MessageEmbed } = require('discord.js'); -const exists = require('../util/Exists') module.exports = { name: "setrole", @@ -25,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 (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.`); diff --git a/events/ready.js b/events/ready.js index 2a8a892..8e37bb3 100644 --- a/events/ready.js +++ b/events/ready.js @@ -2,11 +2,11 @@ module.exports = async (client) => { (client.Ready = true), client.user.setPresence({ status: client.config.Presence.status, // You can show online, idle, and dnd - activity: { - name: client.config.Presence.name, - type: client.config.Presence.type, - }, -}); + activity: { + name: client.config.Presence.name, + type: client.config.Presence.type, + }, + }); client.log("Successfully Logged in as " + client.user.tag); // You can change the text if you want, but DO NOT REMOVE "client.user.tag" client.RegisterSlashCommands(); }; \ No newline at end of file diff --git a/util/Exists.js b/util/Exists.js deleted file mode 100644 index 3cdeea0..0000000 --- a/util/Exists.js +++ /dev/null @@ -1,4 +0,0 @@ -module.exports = n => { - if (n == null || n == undefined || n == "") return false; - return true; -} \ No newline at end of file