Easy developing in discord.js
Please go to the issues page on github to submit a bug
Example:
const { Discord, Client, Command } = require("@mrmythical/discord.js-helper")
const { Intents } = Discord
const client = new Client({
intents: [Intents.FLAGS.GUILDS, Intents.FLAGS.GUILD_MESSAGES],
autoListen: true
})
client.prefix = '!'
const command = new Command(client, {
name: "test",
aliases: ["t"]
})
command.on("execute", ({ msg }) => {
msg.reply("Success!")
})
client.on("ready", () => console.log("Ready"))
client.login(token)
You can contribute on the GitHub repository
const { Client, Discord, SlashCommand } = require(".");
const { Intents } = Discord;
const client = new Client({
intents: [Intents.FLAGS.GUILDS],
autoListen: true
});
const command = new SlashCommand(client, {
name: "test",
options: [{
name: "test",
description: "A test",
type: "STRING"
}],
description: "test cmd"
})
client.on("ready", async () => {
// ONLY RUN THIS ONCE WHEN YOU MODIFY COMMANDS OR YOU WILL LIKELY GET RATELIMITED
await client.slashCommands.postAll(guildId) // guildId is not required, not passing guildId will make it post to global comands
console.log("ready")
})
command.on("execute", async ({ interaction }) => {
await interaction.reply(`This is a reply to the ${interaction.commandName} slash command!`)
})
client.login(token);
There are no docs yet, but hopefully this helps:
Regular discord.js with a few changes, including autoListen
in ClientOptions
and being able to set the prefix. There is also .commands
which returns a CommandManager
Args are like js maps, but are readonly. They are mapped by name and user input.
Commands are easy to use and auto listen if set in client options. autoListen
in the client options is true by default. CommandManagers help you with managing commands, like listing them, deleting them, etc.
SlashCommands are almost like Commands, but aren't as flexible as message commands and you can access them on Discord by typing /
. SlashCommandManagers hold these commands. Please only run the methods responsibly. Only run them if needed, or you may get ratelimited