You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Inside the scene among other scene stuff (commands etc.) I catch all text messages and simply ignore them.
It works well if I chat with the bot.
But I noticed that if I forward two, three... messages to a bot at once from another chat, bot enters my_scene on every message!
But the bot is supposed to skip second, third... message as the bot should be already inside the scene after the first message coming.
Looks like it's a race condition. Entering the scene is still in progress but a new message comes and global listener (the above code) runs leading to call scene.enter again.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
Hi,
I have a listener
bot.on(message('text'), async ctx => await ctx.scene.enter('my_scene'))
in my code.
Inside the scene among other scene stuff (commands etc.) I catch all text messages and simply ignore them.
It works well if I chat with the bot.
But I noticed that if I forward two, three... messages to a bot at once from another chat, bot enters my_scene on every message!
But the bot is supposed to skip second, third... message as the bot should be already inside the scene after the first message coming.
Looks like it's a race condition. Entering the scene is still in progress but a new message comes and global listener (the above code) runs leading to call scene.enter again.
Beta Was this translation helpful? Give feedback.
All reactions