Add per server prefix (#7)

* Add ability to load server prefix

* Add ability to set prefix for a server

* Create serverPrefixes.json file if not found
This commit is contained in:
Ozzy 2021-03-13 03:57:53 +01:00 committed by GitHub
parent ae1ce65602
commit 4717de1712
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 79 additions and 8 deletions

15
commands/prefix.js Normal file
View file

@ -0,0 +1,15 @@
const setServerPrefix = require("../util/setServerPrefix");
module.exports = {
name: 'prefix',
description: 'Change the prefix of the bot in this server.',
execute({ message, client, args, prefix }) {
if (!args[0]) {
message.channel.send(`To change the prefix, execute \`${prefix}prefix <newPrefix>\``);
return;
}else{
setServerPrefix(client, args[0], message.guild.id)
message.channel.send(`The prefix for this server is now set to ${args[0]}`)
}
}
};