if (message.content.startsWith('!delete')) { // 删除用户消息 message.delete() .then(() => console.log(`Deleted user message: ${message.content}`)) .catch(console.error); // 发送一条机器人消息 message.channel.send('This is a bot message.') .then(botMessage => { // 删除机器人消...
client.login('YOUR_BOT_TOKEN'); 1. 2. 3. 4. 5. 6. 7. 8. 9. 10. 11. 12. 运行上述代码后,当有人在您的Discord服务器上删除消息时,控制台将记录删除消息的用户和消息内容。 请注意,messageDelete事件只能追踪单个消息的删除。如果同时删除了多个消息(例如使用bulkDelete方法),则需要使用messageDelete...
async def on_message(message): # 机器人发送的消息不会被删除 if message.author.bot: return await message.channel.send("这是一条自动删除的消息") await message.delete() bot.run("YOUR_BOT_TOKEN") 在上述示例代码中,首先创建了一个Discord机器人实例,并设置了命令前缀为"!"。然后,通过@bot.event装...
1. Delete Messages Manually Open the text channel that has messages that you want to delete. Once you have selected the message you want to delete, hover the text and select the three dots that appear. Once the menu from the 3 dots appears, select the delete option that appears. ...
Messages are deleted on a "rolling" basis -- if you set a 24-hour live time, each message will be deleted 24 hours after it is posted (as opposed to all messages being deleted every 24 hours). If you have an urgent message about the operation of the bot, say@AutoDelete adminhelp ...
Here we create a listener for the message event and get the message and save it into a message object if it is triggered. 在这里,我们为消息事件创建一个侦听器,并获取消息并将其保存到消息对象(如果已触发)。 Now we need to check if the message is from our own bot and ignore it if it ...
Edit code that interact with ddnet-owned servers in cogs/map_testing/__init__.py, comment out parts of the function bodies of the functions ddnet_upload, ddnet_delete, archive_testlog in bot.py, comment out the 'cogs.status', line Execute the file run.py with pythonAbout...
Message archiving. If you plan on including a knowledge base in your community, Discord lets you search all of your server's previous messages regardless of how many you have. (Slack limits the number of previous messages that free users can see and will eventually delete old messages after ...
Bot in Discord with discord.js (13) Chapter 16 - 嵌入式元素 embed 嵌入式元素(Embed)是一种一般由机器人发送的、通常具有彩色边框、嵌入图像、文本字段和其他奇特的属性的消息。比如下图: Embed 一般来说,可以具有以下域: author color description
Click "Add App" to add Discord Clear Chat Bot to your server. Make sure to assign a role with"Manage Channels" permissionto the bot for the command to go through. Type the command message to delete messages:/clearall Note that thiscannotbe used on a server chat or chats within a voice...