Support /astro avec noms partiels ou numériques
=> fix /astro Château Dromant => support /astro chat => support /astro 12
This commit is contained in:
@ -79,9 +79,11 @@ export class RdDCommands {
|
||||
<br><strong>/payer 10d</strong> permet d'envoyer un message pour payer 10 deniers`
|
||||
});
|
||||
rddCommands.registerCommand({
|
||||
path: ["/astro"], func: (content, msg, params) => RdDUtility.afficherHeuresChanceMalchance(params[0]),
|
||||
descr: `Affiche les heures de chance et de malchance selon l'heure de naissance donnée en argument. Exemples:
|
||||
<br><strong>/astro Lyre</strong>`
|
||||
path: ["/astro"], func: (content, msg, params) => RdDUtility.afficherHeuresChanceMalchance(RdDCommands.toParamString(params)),
|
||||
descr: `Affiche les heures de chance et de malchance selon l'heure de naissance donnée en argument. Exemples pour l'heure de la Lyre:
|
||||
<br><strong>/astro 7</strong>
|
||||
<br><strong>/astro Lyre</strong>
|
||||
<br><strong>/astro Lyr</strong>`
|
||||
});
|
||||
|
||||
rddCommands.registerCommand({
|
||||
@ -109,6 +111,10 @@ export class RdDCommands {
|
||||
this.commandsTable = {};
|
||||
}
|
||||
|
||||
static toParamString(params) {
|
||||
return params.length == 1 ? params[0] : params.reduce((a, b) => `${a} ${b}`, '');
|
||||
}
|
||||
|
||||
/* -------------------------------------------- */
|
||||
registerCommand(command) {
|
||||
this._addCommand(this.commandsTable, command.path, '', command);
|
||||
|
Reference in New Issue
Block a user