Answer the question
In order to leave comments, you need to log in
How to change bot config with commands in Discord?
Greetings, how can I make sure that a certain element changes in the config with a certain command? Let's say - !set-prefix s! (actually, the bot should now have an s prefix!), s!set-currency $ , etc.
Answer the question
In order to leave comments, you need to log in
Use a database and store all "configs" in it. On command to update the data in the database.
you still have these settings somehow loaded, take it and change it
let prefix = '!';
let currencySymbol = '@';
discordBot.on('message', (msg) => {
let [ command, ...args ] = msg.content.split(' ');
switch(true) {
case(command === `{ $prefix }set-prefix`):
prefix = args[0] ?? prefix;
break;
case(command === `{ $prefix }set-currency`):
currencySymbol = args[0] ?? currencySymbol;
break;
default: break;
};
});
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question