Events
Adding Events
1voice.addEvent(PlayerEvents.eventName);
List of Events
trackStart
→ Emitted whenever a track starts.trackEnd
→ Emitted whenever a track ends.queueStart
→ Emitted whenever a queue starts.queueEnd
→ Emitted whenever a queue ends.audioError
→ Emitted whenever a audio error occurs.trackPause
→ Emitted whenever a track pauses.trackResume
→ Emitted whenever a track resumes.
Using Events
1const { LoadCommands } = require("aoi.js");2
3... // rest of your setup4
5const loader = new LoadCommands(client);6loader.load(voice.cmds, "./voice/");
This should be the content of your ./voice/<filename>.js
:
1module.exports = [{2 channel: "$channelID",3 type: "eventName",4 code: `code to execute here`,5}];
If you don’t want to use handlers, you can use this instead in your main file also known as index.js
:
1voice.cmds["eventName"].set("Name for the command, can be anything", {2 channel: "$channelID", // Any channel Id, must be valid.3 code: `The code to execute when the event is triggered.`,4});