Я не понимаю, что не так с моим кодом...
ПРИМЕНЕНИЕ:
/предлагать
бот отправляет предложение на канал с именем sugestions Вот мех код:
if (cmd === `${prefix}suggest`){
// USAGE:
// /suggest this is the suggestion
let suggestion = args.join(" ").slice(22);
let suggestEmbed = new Discord.RichEmbed()
.setDescription("~~-------~~**__NEW SUGGESTION!__**~~-------~~")
.setColor("#ff0000")
.addField("Suggestion By", `${message.author} (${message.author.id})`)
.addField("Channel", message.channel)
.addField("Time", message.createdAt)
.addField("Suggestion", suggestion)
.setTimestamp()
.setFooter("Use /invite to invite me to your server!");
let suggestchannel = message.guild.channels.find(`name`, "suggestions");
if (!suggestchannel) return message.channel.send("Couldn't find suggestions channel. Please **create one for this command to work!**");
message.delete().catch(O_o=>{});
suggestchannel.send(suggestEmbed);
return;
}
Вы ошиблись с кодовой строкой suggestchannel.send(...)
. Вы не можете отправить вставку как содержание сообщения, потому что это должна быть строка.
Здесь вы можете найти дополнительную информацию об этом: https://discord.js.org/#/docs/main/stable/class/TextChannel?scrollTo=send
Это исправленный код, попробуйте использовать следующее:
if (cmd === `${prefix}suggest`) {
// USAGE:
// /suggest this is the suggestion
const suggestion = args.join(' ').slice(22);
const suggestEmbed = new Discord.RichEmbed()
.setDescription('~~-------~~**__NEW SUGGESTION!__**~~-------~~')
.setColor('#ff0000')
.addField('Suggestion By', `${message.author} (${message.author.id})`)
.addField('Channel', message.channel)
.addField('Time', message.createdAt)
.addField('Suggestion', suggestion)
.setTimestamp()
.setFooter('Use /invite to invite me to your server!');
const suggestchannel = message.guild.channels.find(`name`, 'suggestions');
if (!suggestchannel) return message.channel.send("Couldn't find suggestions channel. Please **create one for this command to work!**");
message.delete().catch(O_o => {});
suggestchannel.send({ embed: suggestEmbed });
}