2017-04-17 3 views
0

Ich mache einen Bot und möchte ein Präfix, um den Bot aufrufen. Es funktioniert zu ändern, wenn Sie keine Gruppen haben. Aber wie ändere ich das Präfix "!" Wann benutze ich Gruppen?Ändern Präfix für Diskord Bot in Javascript

Mein Hauptcode

const commando = require('discord.js-commando'); 
const bot = new commando.Client(); 
const prefix = ":D"; 

bot.registry.registerGroup('random', 'Random'); 
bot.registry.registerCommandsIn(__dirname + "/commands"); 

bot.login('Botcode' 
); 

Meine Gruppe

const commando = require('discord.js-commando'); 

class DiceRollCommand extends commando.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; 
+0

Wenn Sie Hilfe benötigen, benötigen wir Code. Bearbeiten Sie Ihre Frage so, dass sie ein [** minimales, vollständiges, überprüfbares Beispiel **] (https://stackoverflow.com/help/mcve) enthält. – Santi

Antwort

0

Du wirst 'Client.js' in Ihrem node_module Verzeichnis haben zu bearbeiten. \ node_modules \ discord.js-Kommando \ src \ Client.js

Diese auf der Leitung 28:

"if(typeof options.commandPrefix === 'undefined') options.commandPrefix = 'YOUR PREFIX HERE'; 
0

Ich weiß, dass es ein bisschen spät, aber

const bot = new commando.Client({ 
    commandPrefix: ':D' 
    }); 

Linie zwei ersetzen und drei damit. Sie können das: D in ein beliebiges Präfix ändern.