Skip to content

Easier and simpler command handling for you discord bot. Use a discord bot as a frame, then this allows you to add or remove commands as the bot is running. No more downtime!

Notifications You must be signed in to change notification settings

l0b5ter/Message-Handler

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 

Repository files navigation

Message-Handler (NodeJs)

Easier and simpler command handling! No longer need to restart your bot when your editing a command or want to add/remove one^^

Features:

  • built in reload function(instead of restarting bot do reload to load in all your commands).
  • built in commands function(to show all loaded commands).
  • 2 commands included in the command foler(userinfo.js and ping.js). Do prefix + commands to see all commands.

3rd party commands created:

Title Author Description
PS2stats l0b5ter Show planetside2 players info! This works with every pc server including ps4 servers.
COVID-19 \ Corona l0b5ter Keep track of Corona Virus(COVID-19) cases via rapidapi API. 21 pages totally!

Wanna add more commands to your bot? Just look at one of the commands and see how i managed to do it^^

How to get started

1. Download the "Message-Handler" repository.

2. Move the folder MsgModule into your bot folder.

3. Add some line of code to your main bot file (bot.js)

At the top add these lines:

client.commands = new Discord.Collection();
var Collection = client.commands;
var jsfiles = new Array();
const fs = require("fs");

So it becomes something like this

const client = new Discord.Client();
const { token, prefix, ChannelPost } = require('./config.json');
client.commands = new Discord.Collection();
var Collection = client.commands;
var jsfiles = new Array();
const fs = require("fs");

Then under "client.on('ready', () => {" or "bot.on('ready', () => {" put this:

[jsfiles, Collection] = require("./MsgModule/MsgHandler.js").GetCommands(client);

like this

client.on('ready', () => {
   console.log('The bot is Online!');
   [jsfiles, Collection] = require("./MsgModule/MsgHandler.js").GetCommands(client);
});

Finnaly we add the last bit of code needed to get it to work. which is under the "client.on('message', message => {" or "bot.on('message', message => {".

var Collection2  = require("./MsgModule/MsgHandler.js").run(client, message, prefix, jsfiles, ChannelPost, Collection);
Collection = Collection2;

like this

client.on('message', message => {
   var Collection2  = require("./MsgModule/MsgHandler.js").run(client, message, prefix, jsfiles, ChannelPost, Collection);
   Collection = Collection2;
});

4. DONE^^

Join Me

DiscordLink

Wanna support my work?

Become a Patron!

About

Easier and simpler command handling for you discord bot. Use a discord bot as a frame, then this allows you to add or remove commands as the bot is running. No more downtime!

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published