From 2aeb498e366a5f882ee15ff0f789b17b1c159027 Mon Sep 17 00:00:00 2001 From: Neko Life Date: Sun, 30 May 2021 20:50:21 +0000 Subject: [PATCH] shorter fetch channel function --- cmds/utility/embmaker.js | 6 ++---- cmds/utility/send.js | 14 ++++++-------- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/cmds/utility/embmaker.js b/cmds/utility/embmaker.js index b909526..d4cbc3a 100644 --- a/cmds/utility/embmaker.js +++ b/cmds/utility/embmaker.js @@ -276,10 +276,8 @@ module.exports = class embmaker extends commando.Command { } else { if (/^\d{17,19}$/.test(ID)) { channel = msg.guild.channels.cache.get(ID); - if (!channel) { - if (this.client.owners.includes(msg.author.id)) { - channel = this.client.channels.cache.get(ID); - } + if (!channel && this.client.owners.includes(msg.author.id)) { + channel = this.client.channels.cache.get(ID); } } else { channel = findChannelRegEx(msg, ID, ["category", "voice"])[0]; diff --git a/cmds/utility/send.js b/cmds/utility/send.js index c8a8446..f0a3867 100644 --- a/cmds/utility/send.js +++ b/cmds/utility/send.js @@ -24,17 +24,15 @@ module.exports = class send extends commando.Command { let channel; if (/^\d{17,19}$/.test(search)) { channel = msg.guild.channels.cache.get(search); + if (!channel && this.client.owners.includes(msg.author)) { + channel = this.client.channels.cache.get(search); + } } if (!channel) { channel = findChannelRegEx(msg, search, ["category", "voice"])[0]; - if (!channel) { - if (this.client.owners.includes(msg.author)) { - channel = this.client.channels.cache.get(search); - } - if (!channel) { - return trySend(this.client, msg, "That channel is like your gf. Doesn't exist <:cathmmLife:772716381874946068>"); - } - } + } + if (!channel) { + return trySend(this.client, msg, "That channel is like your gf. Doesn't exist <:cathmmLife:772716381874946068>"); } if (!channel.permissionsFor(msg.author).has("SEND_MESSAGES") || !channel.permissionsFor(msg.author).has("VIEW_CHANNEL")) { return trySend(this.client, msg, "No <:cathmmLife:772716381874946068>");