Too lightweight discord bot framework
This one is inspired by Sapphire, decided to make my own single-file version of it
- Download and unzip it somewhere
- Create
config.jsonand put this into your config :
{
"token": "TOKEN HERE",
"clientId": "BOT CLIENT ID HERE"
}- Create folder named
commandsand put commands into it, Syntax is the same as discord.js - Run
npm start, everything should start installing and work!
There is 3 scripts
npm startNormal startnpm run buildBuild from src.js to index.jsnpm run watchAutomatically build and restart when something changes
Modules is a small implementation i made, basically run that module on startup, it just open more possibilities. Different between modules and commands is commands loads using discord.js command loader, but modules are loaded globally. Syntax are the same, but how you code it is different
To start making a new module,
In folder named modules, create a new file example.js, put this snippet in,
module.exports = {
data: {
name: 'Example addon',
}, //This "data" will provide addon name for the script, and will appear on the execute argument
execute: data => { //Better require() that dynamically install package!
require('consola').success('Loaded Example addon');
/* Add your code here!
foo.addListener('bar',() => console.log)
*/
}
}Do not use any declaration prefix, like
let,constorvar, this have a chance to break the system
Only put code inside
executefunction, or all variables outside will not be accessible by the function
All variables on the module will be shared directly to the main script, in bidirectional
There is no need to do
npm install, The script will dynamically install that package whenever it need
Never trust anyone by putting random addons from people, this can leak your token