简体   繁体   English

discord.js 在编辑消息之前发送并等待

[英]discord.js send and wait before editing a message

I want my bot, to send my emotes , wait 1 seconds and edit the message to my others emotes .我想让我的机器人发送my emotes ,等待 1 秒钟,然后将消息编辑到my others emotes

Here's my code :这是我的代码:

message.channel.send('my emotes')
  .then((msg) => {
    setTimeout(function() {
    msg.edit('my other emotes');
  }, 1000)});  

And he send me this error : Cannot read property 'edit' of undefined他给我发了这个错误: Cannot read property 'edit' of undefined

Thanks you for helping me.谢谢你帮助我。

ok so finaly the code that works is :好的,最后有效的代码是:

message.channel.send('my emote')
.then((msg)=> {
  setTimeout(function(){
    msg.edit('my others emotes');
  }, 1000)
}); 

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM