Skip to content

Latest commit

 

History

History
50 lines (45 loc) · 1.01 KB

File metadata and controls

50 lines (45 loc) · 1.01 KB

Events

Client Events

Format

import { ClientEvent } from "../types.js";

export const Event: ClientEvent = {
    name: "clientEventName",
    run: async(<event args>): Promise<void> => {
        // Code
    }
};

Example Code

import { ClientEvent } from "../types.js";

export const Event: ClientEvent = {
    name: "channelCreate", // Omitted whenever a channel is created in a guild.
    run: (channel): void => {
        console.log(`A new channel was created in the ${channel.guild.name} of the name ${channel.name}.`);
    }
};

Non-Client Events

Format

import { ClientEvent } from "../types.js";

export const Event: ClientEvent = {
    customEvent: true,
    run: async(client): Promise<void> => {
        // Code
    }
};

Example Code

import { ClientEvent } from "../types.js";

export const Event: ClientEvent = {
    customEvent: true,
    run: (client): void => {
        client.Distube.on("addSong", (queue, song) => {
            // Your Code
        });
    }
};