sendMessage delivers in random order
ClearFog opened this issue · 3 comments
ClearFog commented
I'm trying to use sendMessage to send a couple of messages back to back but they go through in a random order. Is there a good way to make sure they go through serialized? I tried combining them into one longer message and that produced variable results as well.
cloudrac3r commented
Put the second sendMessage in the callback of the first.
bot.sendMessage({to: channelID, message: "first"}, err => {
if (!err) bot.sendMessage({to: channelID, message: "second"});
});
You should join the discord.io server for questions like this in the future. I'm Cadence#3263, say hi!
vegeta897 commented
Mind posting the code you use to combine them? If it's one message, I don't see how it's possible for the order to get mixed up unless your code has bugs.
ClearFog commented
Well, turns out your both right. I had a bug in the combination code and the callback also worked.
Thanks for the quick response!