fixed "??" message

This commit is contained in:
Neko-Life 2021-08-11 18:48:57 +07:00
parent a181614181
commit 5294e897ee
2 changed files with 32 additions and 32 deletions

View file

@ -5,36 +5,36 @@ const { MessageEmbed } = require("discord.js");
const { getChannelMessage, errLog, ranLog, trySend, tryReact } = require("../../resources/functions"); const { getChannelMessage, errLog, ranLog, trySend, tryReact } = require("../../resources/functions");
module.exports = class cloneembed extends commando.Command { module.exports = class cloneembed extends commando.Command {
constructor(client) { constructor(client) {
super(client, { super(client, {
name: "clone-embed", name: "clone-embed",
aliases: ["clone-emb","clon-emb", "clon-embed"], aliases: ["clone-emb", "clon-emb", "clon-embed"],
memberName: "clonemb", memberName: "clonemb",
group: "utility", group: "utility",
description: "Clone an Embed." description: "Clone an Embed."
}); });
} }
async run(msg, cargs) { async run(msg, cargs) {
const args = cargs.trim().split(/ +/); const args = cargs.trim().split(/ +/);
try { try {
const theMes = await getChannelMessage(msg,args[0],args[1]); const theMes = await getChannelMessage(msg, args[0], args[1]);
let content; let content;
if (theMes.content) { if (theMes.content) {
content = theMes.content; content = theMes.content;
} }
if (!theMes.embeds || (theMes.embeds).length === 0) { if (!theMes.embeds || (theMes.embeds).length === 0) {
return trySend(this.client, msg, 'ypu don\'t know what an embed is? <:cathmmLife:772716381874946068>'); return trySend(this.client, msg, 'ypu don\'t know what an embed is? <:cathmmLife:772716381874946068>');
} }
if (!args[0]) { if (!args[0]) {
return trySend(this.client, msg, 'Which message||'); return trySend(this.client, msg, 'Which message??');
} }
const sent = theMes.embeds.map(r => trySend(this.client, msg, {content:content,embed:r})); const sent = theMes.embeds.map(r => trySend(this.client, msg, { content: content, embed: r }));
if (sent) { if (sent) {
tryReact(msg, "a:yesLife:794788847996370945"); tryReact(msg, "a:yesLife:794788847996370945");
} }
return sent; return sent;
} catch (e) { } catch (e) {
return trySend(this.client, msg, "No embed found. Use `<channel_[mention, ID]> <message_ID>` if it's in another channel."); return trySend(this.client, msg, "No embed found. Use `<channel_[mention, ID]> <message_ID>` if it's in another channel.");
}
} }
}
}; };

View file

@ -31,7 +31,7 @@ module.exports = class perms extends commando.Command {
channel = getChannel(msg, use); channel = getChannel(msg, use);
if (!channel || !(channel instanceof GuildChannel)) { if (!channel || !(channel instanceof GuildChannel)) {
channel = undefined; channel = undefined;
mes += "Channel unexisted||?\n"; mes += "Channel unexisted!?\n";
} }
} }
const find = arg.replace(/(?<!\\)--ch [^ ]*\s?/, ""); const find = arg.replace(/(?<!\\)--ch [^ ]*\s?/, "");