[discord.js]如何检查消息id的作者id是否等于bot id



这是我的代码

const botID = '986945043849945088'
let msgID = await message.channel.messages.fetch(args[0]).catch(() => undefined);
if (msgID.includes(botID)) return message.reply(`This message does not belong to <@${client.user.id}>`)      
if (msgID === undefined) {
return message.reply('Wrong Message ID!')      
} else {
await msgID.edit(args[1]).then(() => message.delete())

错误:

TypeError:是否。在Object.exports.callback (/home/runner/J-Bot/Commands/edit.js:30:17)

msgID为message。所以没有includes函数。

const botID = '986945043849945088'
let msgID = await message.channel.messages.fetch(args[0]).catch(() => undefined);
if (msgID.author.id != botID) return message.reply(`This message does not belong to <@${client.user.id}>`)      
if (msgID === undefined) {
return message.reply('Wrong Message ID!')      
} else {
await msgID.edit(args[1]).then(() => message.delete())

相关内容

  • 没有找到相关文章

最新更新