I’m currently working on a Discord bot, I’ll use the fs module to load commands somewhat like CommonJS does.
const code = fs.readFileSync(`${dir}/${file}`, 'utf8')
const fn = new Function('command', 'Command', 'Client', 'Discord', 'db', code)
Where a command file could look like:
command.register = class PingCommand extends Command
{
constructor ()
{
super(Client, {
name: 'ping',
aliases: [ ],
group: 'utils',
permissions: [ 0 /* 0: anyone can execute this */ ],
args: { /* No arguments needed here */ }
})
}
async run (message, args, Account /* The fixed account that includes data from the database. */ )
{
// ...
}
}
command.register
is a set method:
class CommandRegistrar
{
// ...
set regiser (command)
{
// Verify and save comand
}
}
As you can see there is a few linting errors, is there any way I can add my own syntaxes to it?