最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

programmeradmin0浏览0评论

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)
}); 
发布评论

评论列表(0)

  1. 暂无评论