This Handler Support both Slash and Legacy. Most the main brain of this handler located in Utils Folder.
- Reload-able Slash Command and Events
- Support Custom Sub-Event for Each Events it givens.
- Slash commands Support.
- Legacy commands support
- Provided Full Reference and Vast options on both commands. Example available on Examples
- Support sub directory in legacy and slash.
If you have any feedback, please reach out to me at Discord
This can be called globally by using functions
.
There's 3 functions (refer to this)
colorEmbed
, this will bring back most common used colors on V12 Embed, such as red, green, yellow, random.
You can use these properties when calling this functions
Green
,Red
,Blue
,Yellow
,Random
. Example:functions.colorEmbed.Red
.
rgb
, this function will generate random RGB value for example[ 123, 255, 3 ]
, and this also can be use to converthex
codes to RGB values for V14.setColor
. Example:functions.rgb('#DAFOFO')
.sleep
, this function actually self-explanatory, its likedelay
package, how to use this function you'll need to await it. Example:await functions.sleep(5000)
, means sleep for 5 seconds.
1. Install node.js v16+
2. Download this repository and unzip it or git clone it.
3. Fill in everything in src/config/config.js
, some value are optional.
3.5) If you using Replit.com, you need to change the entrypoint
on replit.nix
from entrypoint = 'index.js'
to entrypoint = 'src/index.js'
.
4. After filling everything in config. Type in npm install
shell. On Replit you just click Green RUN button on top
5. start the bot with node src/index.js
or node index.js
, depends how your terminal works.
{
defaultPrefix: "",
token: null,
slashCommandType: "guild", // hybrid [ the command will be applied to global scope ] | guild [ the command only will be applied to testGuilds ]
eventFolder: '', // events
legacyFolder: '', // cmdLegacy
slashFolder: '', // cmdSlash
owners: [],
testGuilds: [],
listOfAppIds: {},
clients: {
testing: true,
testBot: '',
mainBot: ''
}
}
defaultPrefix
is for legacy command and its optional iflegacyFolder
left empty.token
this is for Bot's token and also optional if you using env, because onsrc/index.js
, it'll check env first and if it can't find one, it'll check config.slashCommandType
this is for how you want the bot applied the slashes, if you want specific guild only useguild
and fills thetestGuilds
for the guild you wanted the slash to be applied, andhybrid
means, it'll register the commands to global scope but on the slash handler there's a property to split which is which global or not, we will get into it later.eventFolder
this is where you put all custom event files inside subfolder all you want, and the handler will take care of it.legacyFolder
this is Legacy command folder or Prefix based commands.slashFolder
slash DUH.owners
just put your User ID here, and it used fordevsOnly
anddev
property on both commands to check if its owner commands or not.testGuilds
list of guild for guild based slash command.listOfAppIds
meh you can leave this empty, this is dictionary for my original bot.clients
this is required if you useslash
, iftesting
istrue
then the process will usetestBot
and if it'sfalse
the process will usemainBot
, what should you put on these?, your bot'sID
or TestBot'sID
.
- Legacy Example
const {
ActionRowBuilder,
SelectMenuBuilder,
ButtonBuilder,
EmbedBuilder,
ButtonStyle
} = require('discord.js');
const { stripIndents, oneLine } = require('common-tags');
module.exports = {
name: "ping",
description: "Show Bot's latency",
aliases: ['pong', 'latency'],
category: 'util',
devsOnly: false,
userPermissions: [ 'CreateInstantInvite', 'EmbedLinks' ],
clientPermissions: [ 'Administrator' ],
details: ["This will give bot's heartbeat to discord API"],
cooldown: 5, // seconds
usage: ['<Require argument> [optional arguments]'], // if argsRequired is true then this param required
argsRequired: true,
wip: false,
async run (client, message, args) {
try
{
message.channel.send({ content: `hi ${message.author}, my latency is ${client.ws.ping}` })
//=================
}
catch(e)
{
console.log(e)
}
//=================
}
}
- Slash Commands
guild
andglobal
options oncommandType
will decide what this command will be used. If you putguild
it means it only applied to guild thats given on the config.js and if itglobal
it will be defaulted assigned to global and guild.
const {
ActionRowBuilder,
SelectMenuBuilder,
ButtonBuilder,
EmbedBuilder,
ButtonStyle,
ApplicationCommandType,
ApplicationCommandOptionType,
ModalBuilder,
TextInputBuilder
} = require('discord.js');
const { stripIndents, oneLine } = require('common-tags');
module.exports = {
data: {
name: 'ping',
description: 'Bot latency',
type: ApplicationCommandType.ChatInput,
/* long Reference here, you can see it on the example slash.js yourself */
options: [{
name: 'pong',
description: 'pong?',
type: 3 // String
}]
},
commandType: 'global', // global | guild
dev: false,
async run(client, int) {
try {
await int.reply({ content: `pong! ${client.ws.ping}ms!` })
}
catch(e) {
console.log(e)
}
}
}
- Custom Event (events)
The Listener Must be a valid event Name and you can enable which event you want to listen on LoadEvents possibleEvents by uncommenting them
*thename
of the event must match to the filename, so it can be reloaded if you made changes to the file. - src/events/messages/autoresponse.js
module.exports = {
name: 'autoresponse',
listener: 'messageCreate',
async run(client, message) {
if(message.content == 'hi') {
message.reply('hello')
}
}
};
- src/events/messages/updatedmessagelog.js
module.exports = {
name: 'updatedmessagelog',
listener: 'messageUpdate',
async run(client, oldMessage, newMessage) {
console.log(oldMessage, newMessage)
}
};
If you Like the Handler, please Star it, Thank you :3