I'm making a bot and want to have a prefix to call the bot. It works to change when you don't have groups. But how do I change the prefix "!" when I use groups?
My main code
const mando = require('discord.js-mando');
const bot = new mando.Client();
const prefix = ":D";
bot.registry.registerGroup('random', 'Random');
bot.registry.registerCommandsIn(__dirname + "/mands");
bot.login('Botcode'
);
My group
const mando = require('discord.js-mando');
class DiceRollCommand extends mando.Command {
constructor(client) {
super(client, {
name: 'roll',
group: 'random',
memberName: 'roll',
description: 'Roll a die'
});
}
async run(message, args){
var roll = Math.floor(Math.random() * 6) + 1;
message.reply("You rolled a " + roll);
}
}
module.exports = DiceRollCommand;
I'm making a bot and want to have a prefix to call the bot. It works to change when you don't have groups. But how do I change the prefix "!" when I use groups?
My main code
const mando = require('discord.js-mando');
const bot = new mando.Client();
const prefix = ":D";
bot.registry.registerGroup('random', 'Random');
bot.registry.registerCommandsIn(__dirname + "/mands");
bot.login('Botcode'
);
My group
const mando = require('discord.js-mando');
class DiceRollCommand extends mando.Command {
constructor(client) {
super(client, {
name: 'roll',
group: 'random',
memberName: 'roll',
description: 'Roll a die'
});
}
async run(message, args){
var roll = Math.floor(Math.random() * 6) + 1;
message.reply("You rolled a " + roll);
}
}
module.exports = DiceRollCommand;
I know it's a bit late, but
const bot = new mando.Client({
mandPrefix: ':D'
});
replace line two and three with that. You can change the :D to any prefix you want.
const mando = require('discord.js-mando');
const prefix = ":D";
const bot = new mando.Client({
mandPrefix: prefix
});
bot.registry.registerGroup('random', 'Random');
bot.registry.registerCommandsIn(__dirname + "/mands");
bot.login('Botcode'
);
Hope this helped!
You don't have to use the const bot = new mando.Client({
mandPrefix: prefix
});
You can use a single line like this: bot.mandPrefix = "YOUR PREFIX"
I am not an expert so dont try and prove pros wrong with my code!
You're going to have to edit 'client.js' in your node_module directory. \node_modules\discord.js-mando\src\client.js
This is on line 28:
"if(typeof options.mandPrefix === 'undefined') options.mandPrefix = 'YOUR PREFIX HERE';