本文介紹了如何讓不和諧機器人編輯 dm 消息?的處理方法,對大家解決問題具有一定的參考價值,需要的朋友們下面隨著小編來一起學習吧!
問題描述
我想在 Discord 上為我的服務器實現一個簡單的數據庫,所以我需要我的機器人給我發消息,當變量更改他的值時,他用新值編輯 DM(使用他發送給我的消息的 ID)對于變量.(對不起我的英語)
I want to implement a simple database for my server on Discord so i need my bot to DM me and when a variable change his value, he edit the DM (using the ID of the message he sent me) with the new value for the variables. (sorry my english)
這就是我目前所擁有的:
That's what I've at the moment:
async function replyAndLog() {
let sent = await msg.author.send("<database things>");
let id = sent.id;
console.log(id) //the id of the DM
}
//when i need to edit
if (msg.content === '!edit') {
msg.id("id").edit("<new databese>") // here's the problem, i dont know how to write this line
}
推薦答案
const User = client.users.cache.get("Your UserId");
if (!User.dmChannel) return console.log("No messages found.");
// Getting the message by ID
User.dmChannel.messages.fetch("MessageID").then(dmMessage => {
// Editing the message.
dmMessage.edit("I have an update!");
})
這篇關于如何讓不和諧機器人編輯 dm 消息?的文章就介紹到這了,希望我們推薦的答案對大家有所幫助,也希望大家多多支持html5模板網!
【網站聲明】本站部分內容來源于互聯網,旨在幫助大家更快的解決問題,如果有圖片或者內容侵犯了您的權益,請聯系我們刪除處理,感謝您的支持!