当试图让我的机器人删除一条消息时,我使用命令=m p "some song"得到了这个错误:
DiscordAPIError: Unknown Message
at RequestHandler.execute (C:\poe-sieglind\node_modules\discord.js\src\rest\RequestHandler.js:298:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push
我得到一个错误: DiscordAPIError: Unknown Message
at RequestHandler.execute (D:\Programming\Discord Bot\node_modules\discord.js\src\rest\RequestHandler.js:298:13)
at processTicksAndRejections (node:internal/process/task_queues:96:5)
at async RequestHandler.push (D:\Programming\Discord B
尝试使用discord.js将不一致消息编辑为RichEmbedded消息时,出现错误
(node:10860) UnhandledPromiseRejectionWarning: DiscordAPIError: Invalid Form Body
embed.timestamp: Could not parse 1581492006141. Should be ISO8601.
at item.request.gen.end (/rbd/pnpm-volume/xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx/node_modules/.registry.n
在python中使用discord.py,我可以执行以下操作,即使消息的历史超过2周,它也会慢慢删除通道中的所有消息:
async def clear(self, ctx):
length = await ctx.message.channel.history(limit=999).flatten()
num = len(length)
div = 100
target = [num // div(1 if x < num % div else 0) for x in range(div)]
for tar in target:
我有个问题要问Discord.js。如何从消息中删除特定用户的反应?
我试图用以下代码来实现这个目标:
// Now known as 'messages.fetch'.
message.channel.fetchMessage(MessageID).then(m => {
m.reactions.remove(UserID);
});
但它并没有消除用户的反应。我做错了什么吗?
任何帮助都将不胜感激。
import DiscordJS, { TextChannel, Intents, Message, Channel } from 'discord.js'
import dotenv from 'dotenv'
dotenv.config()
//sets prefix to be used when running bot commands
const prefix = '~';
//This lets the discord bot know what your intentions are using this bot. Hence
我有一个不和谐的机器人,它每秒编辑一条消息。因此,如果机器人关闭,消息将显示最后的编辑。 我想在关闭Node JS进程(使用Ctrl + C,关闭命令提示符或任何类型的关闭进程)之前,编辑消息,使其类似于:"The bot is off“。 示例: // something using discord.js
bot.on("close", myFunction);
// or in node, like in browser 'window.onbeforeunload'
node.beforecloseprocess = myFunction; 如