javascript - discord.js send and wait before editing a message - Stack Overflow

I want my bot, to send my emotes, wait 1 seconds and edit the message to my others emotes.Here's

I want my bot, to send my emotes, wait 1 seconds and edit the message to 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

Thanks you for helping me.

I want my bot, to send my emotes, wait 1 seconds and edit the message to 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

Thanks you for helping me.

Share Improve this question edited Apr 15, 2018 at 9:11 31piy 23.9k6 gold badges51 silver badges68 bronze badges asked Apr 15, 2018 at 9:09 DillgoDillgo 732 gold badges2 silver badges6 bronze badges 4
  • Seems fine to me. The code should work as expected. – Jonas Wilms Commented Apr 15, 2018 at 9:44
  • I just tested your code and works fine. What NodeJS version you have? And what discord.js version? Use node -v to get Node version and npm list discord.js to get the discordjs version – André Commented Apr 15, 2018 at 10:02
  • finaly, I've managed myself and I patched it, if finaly works ! – Dillgo Commented Apr 15, 2018 at 10:14
  • You should answer your own question with that you did to make it work, so if anyone else is having the same issue as you know what you did to solve it. @Dillgo – André Commented Apr 15, 2018 at 10:32
Add a ment  | 

1 Answer 1

Reset to default 1

ok so finaly the code that works is :

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

发布者:admin,转转请注明出处:http://www.yc00.com/questions/1744784257a4593526.html

相关推荐

发表回复

评论列表(0条)

  • 暂无评论

联系我们

400-800-8888

在线咨询: QQ交谈

邮件:admin@example.com

工作时间:周一至周五,9:30-18:30,节假日休息

关注微信