You can contribute to Wump by creating your own command, this is very easy if you have a basic understanding of Node.JS
extData of a command
Every command has extData, this basically is the command-specific settings object, it's structured as followed:
Copy
cmd .extData = {
// Information
path : undefined , // The config path of the command [`wump.utility.ping` for example] ( optional )
name : null , // Command name ( required )
syntax : null , // Command syntax ( optional )
bearer : 'wump' , // Command bearer ( required )
aliases : [] , // Command aliases ( optional )
argument : [] , // Command arguments ( optional )
description : null , // Command description ( optional )
// Checks
hidden : false , // Hidden from view ( true / false )
enabled : true , // Enabled or disabled ( true / false )
cooldown : 1000 , // Command cooldown ( optional )
category : 'General' , // Command category ( required )
ownerOnly : false , // Owner only ( true / false )
guildOnly : false , // Guild only ( true / false )
permissions : [] // Bot permissions ( optional )
}
Base command class
A command is structured as followed:
Copy const { DiscordCommand } = requir
e ( '../../core' );
/*
Replace <name> with your command's name
Replace <syntax> with your command's syntax
Replace <author> with your name
Replace <description> with your description
*/
module . exports = class < name > extends DiscordCommand {
constructor (bot) {
super (bot , {
path : undefined ,
name : '<name>' ,
syntax : '<syntax>' ,
bearer : '<author>' ,
aliases : [] ,
argument : [] ,
description : '<description>' ,
hidden : false ,
enabled : true ,
cooldown : 1000 ,
category : 'Utility' ,
ownerOnly : false ,
guildOnly : false ,
permissions : []
});
Object .freeze ( this );
Object .freeze ( this .static);
}
async execute (msg , args , user , guild) {
// ...
}
_localize (msg , extData = {}) {
try {
if ( ! msg) throw 'INVALID_STRING' ;
// ...
} catch (ex) {
return `LOCALIZE_ERROR: ${ ex .code } ` ;
}
}
};
Creating your command
A command should be put inside of Command.emit
as followed:
Copy emit (msg , args , user , guild) {
console .log (msg , args , user , guild);
// Localizing
console .log ( this ._localize ( msg . author . locale .cooldown , msg .author);
}
Localizing your command
Localizing is done with the private Command._localize
function as followed:
Copy _localize (msg , extData = {}) {
try {
if ( ! msg) throw 'INVALID_STRING' ;
return msg
.replace ( /{e\.user\.id}/ , extData .id)
} catch (ex) {
return `LOCALIZE_ERROR: ${ ex .code } ` ;
}
}
How to submit
After you've tested and linted your command, you can submit it by creating a pull request on GitHub .
It may take some time for your pull request to be reviewed