shorter fetch channel function

This commit is contained in:
Neko Life 2021-05-30 20:50:21 +00:00
parent 2f247ddaa9
commit 2aeb498e36
2 changed files with 8 additions and 12 deletions

View file

@ -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];

View file

@ -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>");