0.1.3 • Published 2 years ago

@igecorp/ige-djs v0.1.3

Weekly downloads
-
License
Apache-2.0
Repository
github
Last release
2 years ago

IgeDJS

IgeDJS is a npm module

Documentation

https://igecorp.js.org

Installation

Latest version

npm i @igecorp/ige-djs

Dev Version

Must have git on your device

npm i github:IgeCorp/ige-djs

Example

Login CLient

index.js

const IgeDJS = require("@igecorp/ige-djs");

const client = new IgeDJS.IgeClient("Discord Bot Token", {
    replies: true, //Replace "replies: true" by "replies: false" if you don't want any mentions.
    owner: "ownerId", //Replace this string by an Array of strings: ["id 1", "id 2", "..."]
    testGuild: "guild id" //this is for client guild only slashs
});

client.param({
    slashsDir: "slashs", //Replace it by your client commands directory.
    eventsDir: "events" //Replace it by your client events directory.
});

events/ready.js

module.exports = async (client) => {
    console.log(`${client.user.tag} is ready.`);

    client.postSlashs(client.slashs); // this will post the client commands

    client.user.setActivity(`I'm using @igecorp/ige-djs npm module !`, { type: "PLAYING" });
}

events/interactionCreate.js

module.exports = async (client, interaction) => {
    if (interaction.isCommand()) {
        if (interaction.commandName) {
            try {
                await client.slashs.get(interaction.commandName).run(interaction); // Get the slash with the interaction command name and run it
            } catch(err) {
                console.error(err);
                await interaction.reply({
                    content: "An error as occured",
                    ephemeral: true
                });
            }
        }
    }
}

slashs/ping.js

const IgeDJS = require("@igecorp/ige-djs");

class ping extends IgeDJS.IgeCommand {
    constructor() {
        super({
            name: "ping",
            description: "Get the client latency",
            category: "utility",
            guildOnly: true // change this to false to make this command to global (all client guilds)
        });
    }

    async run(interaction) {
        await interaction.reply({
            content: `Pong: \`${Date.now() - message.createdTimestamp}ms\``
        });
    }
}

module.exports = new ping;

© 2021 Copyright: IgeCorp

0.1.0

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.3

2 years ago

0.0.9

3 years ago

0.0.8

3 years ago

0.0.7

3 years ago

0.0.5

3 years ago

0.0.6

3 years ago

0.0.4

3 years ago

0.0.3

3 years ago

0.0.2

3 years ago

0.0.1

3 years ago