atomic-handler
v0.0.6
Published
Powerful slash-command/normal-commands handler with args, respond and music system ππ₯.
Downloads
1
Readme
ATOM Handler π«π
Installation π§
npm i atomic-handler
why ATOM-Handler π€
- powerful and easy to use ..
- make a normal command and slash-command in the same file ..
- Erela.js music system ..
- custom and easer respond system
Docs π¨βπ»
Index File π«
// require the ATOMIC-Handler ππ«
const ATOM = require("atomic-handler");
// makes the starting function .
(async () => {
// create an Discord.js(v14) client (returns a normal client);
// your can replace the Manager with your own erela.js manager
const client = new ATOM.Handler("<your discord bot token>", Manager);
// register the command to a JS-Map
// ' /commands ' the path to your commands
// the other option have to be true or false , true for allow commands category
// returns the commands (JS-Map)
let commands = await client.registerCommands("/commands", true);
// just for running the commands ..
// option (1) ' commands ' needs the commands JS-Map
// option (2) ' reply ' to change the default message: ' π« | This option have to be one of these ....' and use {args} to replace it with the chooses
// option (3) ' reply2 ' to change the default message: ' "π« | There is a missing entry that you should include next to the command: ....' and use {arg} to replace it with the missing entry
await client.runCommands(commands);
// run the ereal.js manger
// replace ' node ' with an normal erela.js NodeOptions
await client.createManager(node);
// you can request the erela.js manager with
client.manager;
// you can change your default prefix which is "!" using the database
// request the database (quick.db)
const db = ATOM.DB;
// then change the prefix using this line to change the prefix globaly
await db.set(`Prefix_Global`, "<your prefix>");
// or use this line to change it in a spacific server (replace Guild.id with the server id)
await db.set(`Prefix_${Guild.id}`, "<your prefix>");
// you can alose request the discord.js libraray with this line
const Discord = ATOM.DiscordJS
})();
Command File π«
const ATOM = require("atomic-handler");
const Discord = ATOM.DiscordJS;
const { Client, User, Guild, Message, TextChannel } = require("discord.js");
module.exports = {
data: {
name: "<command name>",
description: "<command description>",
type: 1, // command type
options: [
{
name: "<option name>",
type: 3, // option type
required: true, // option required
description: "<option description>",
},
],
}, // all this data you can find in: https://discord.com/developers/docs/interactions/application-commands#application-commands
/**
*
* @param {Client<boolean>} client
* @param {{
* author: User, guild: Guild, message: Message, channel: TextChannel
* }} interaction
* @param {{name: string, value: string}[]} args
* @param {{reply: Function, editReply: Function}} respond
*/
run: async (client, interaction, args, { editReply, reply }) => {
// client = DiscordJS.Client
// interaction = all the command data you will need (auto-complete included)
// args = an array of objects have all options includes with user entries
// reply = function to reply for user
// editReply = function to edit the reply
// example
let msgID = await reply({
content: "What did you say??",
});
setTimeout(() => {
editReply(
{
content: args[0].value + " - Right?",
},
msgID.id
);
}, 2600);
},
};