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,
owner: "ownerId",
testGuild: "guild id"
});
client.param({
slashsDir: "slashs",
eventsDir: "events"
});
events/ready.js
module.exports = async (client) => {
console.log(`${client.user.tag} is ready.`);
client.postSlashs(client.slashs);
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);
} 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
});
}
async run(interaction) {
await interaction.reply({
content: `Pong: \`${Date.now() - message.createdTimestamp}ms\``
});
}
}
module.exports = new ping;
© 2021 Copyright: IgeCorp