This topic was automatically generated from Slack. You can find the original thread here.
Hi I’m trying to count discord messages. Currently I’m using the discord bot and saving a number in a datastore every hour. However as the discord bot emits an event for each message at once it is only counting 1 event each time the workflow is triggered.
I have tried editing the source code of the discord bot and adding in a delay for when each event is emitted, but it then started to only emit a single event each hour. I don’t suppose anyone has any ideas how I could approach this or where I may have gone wrong with the code?
} else { messages.forEach((message, i) => { setTimeout(() => { this.$emit(message, { summary: message.content, id: message.id, // dedupes events based on this ID }); }, i * 1000); }); }