久久久久久久av_日韩在线中文_看一级毛片视频_日本精品二区_成人深夜福利视频_武道仙尊动漫在线观看

讓機器人在超時后刪除自己的消息

Making a bot delete its own message after a timeout(讓機器人在超時后刪除自己的消息)
本文介紹了讓機器人在超時后刪除自己的消息的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!

問題描述

我希望我的機器人發送一條消息,確認它執行了命令,然后在超時后刪除該確認消息;以免使聊天混亂.

I am looking to have my bot send a message, confirming that it executed the command, and then delete that confirmation message after a timeout; so as not to clutter the chat.

這是我希望將其應用于當前命令的代碼示例:

Here is a code sample of my current command I would like to have it applied to:

exports.auth = 1
exports.run = (client, message, args) => {
  let num = parseInt(args);
  message.channel.bulkDelete(num+1)
    .then(messages => console.log(`Bulk deleted ${num} messages`))
    .catch(console.error);
  message.channel.send(`Deleted ${num} messages!`);
  message.delete(5000);
};

如果我沒有在 Message.delete() 中設置時間;行,它只是刪除我發送的消息.如果機器人發送消息的時間足夠長,它只會給我一個錯誤.

If I have no time set in the Message.delete(); line, it just deletes the message I sent. If the time is long enough for the bot to send a message, it just gives me an error.

推薦答案

你需要得到你發送的消息才能刪除它.

You need to get the message that you sent to delete it.

message.channel.send(`Deleted ${num} messages!`).then(sentMessage => {
    sentMessage.delete(5000);
});

這將發送消息,消息發送后它將返回,以便您管理它(刪除/編輯).

This is gonna send the message and after the message was sent it will return it so you can manage it (delete/edit).

這篇關于讓機器人在超時后刪除自己的消息的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!

【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!

相關文檔推薦

discord.js v12: How do I await for messages in a DM channel?(discord.js v12:我如何等待 DM 頻道中的消息?)
how to make my bot mention the person who gave that bot command(如何讓我的機器人提及發出該機器人命令的人)
How to fix Must use import to load ES Module discord.js(如何修復必須使用導入來加載 ES 模塊 discord.js)
How to list all members from a specific server?(如何列出來自特定服務器的所有成員?)
Discord bot: Fix ‘FFMPEG not found’(Discord bot:修復“找不到 FFMPEG)
Welcome message when joining discord Server using discord.js(使用 discord.js 加入 discord 服務器時的歡迎消息)
主站蜘蛛池模板: 精品欧美一区二区在线观看欧美熟 | 欧美狠狠操 | 99在线观看视频 | 久久久国产精品入口麻豆 | 国产免费一区二区 | 日韩中文字幕在线观看 | 91超碰在线| 久久亚洲一区二区三区四区 | 欧美国产免费 | 成人av电影免费在线观看 | 国产成人免费视频 | 日韩在线观看中文字幕 | 色片在线观看 | 欧美精品在线免费 | 欧美精品1区2区3区 精品国产欧美一区二区 | 麻豆精品国产91久久久久久 | 精品久久精品 | 365夜爽爽欧美性午夜免费视频 | 久久一及片 | 日韩高清av | 亚洲一区二区三区免费在线 | 久艹网站 | 欧美日本韩国一区二区 | 亚洲国产精品久久人人爱 | 国产一区二区三区精品久久久 | 一区二区三区免费在线观看 | 日韩精品免费在线 | 日韩在线免费电影 | 蜜臀av日日欢夜夜爽一区 | 自拍视频国产 | 综合亚洲视频 | 国产午夜精品久久久 | 国产精品视频一二三 | 精品视频一区二区三区在线观看 | 免费的av网站 | 亚洲免费一区二区 | 一区二区三区久久 | 日韩欧美一区二区三区四区 | 欧美亚洲视频 | 国产伦精品一区二区三毛 | 中文字幕一区二区视频 |