I have a basic moderation bot in discord.js
, written in node.js
. I need to run some tests on the bots but to do so, I need to toggle an event. I know that node.js
has an e.dispatchEvent(event)
but, to my knowledge, discord.js
does not have a function like that.
I was wondering what the equivalent of that would be.
A Discord Client extends a Node.js EventEmitter, so you can use the EventEmitter#emit()
method to call listener functions attached to the event. For example...
// Assuming 'client' is a Client, 'member' is a GuildMember
client.emit('guildMemberAdd', member);
You can find a complete list of events normally emitted by a Client here.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With