mrmBot-Matrix/commands/prefix.js

19 lines
881 B
JavaScript
Raw Normal View History

2019-09-13 20:02:41 +00:00
const database = require("../utils/database.js");
exports.run = async (message, args) => {
if (!message.channel.guild) return `${message.author.mention}, this command only works in servers!`;
const guild = await database.guilds.findOne({ id: message.channel.guild.id });
2019-09-13 20:02:41 +00:00
if (args.length !== 0) {
if (!message.member.permission.has("administrator") && message.member.id !== process.env.OWNER) return `${message.author.mention}, you need to be an administrator to change the bot prefix!`;
guild.set("prefix", args[0]);
await guild.save();
2019-09-13 20:02:41 +00:00
return `The prefix has been changed to ${args[0]}.`;
} else {
return `${message.author.mention}, the current prefix is \`${guild.prefix}\`.`;
2019-09-13 20:02:41 +00:00
}
};
exports.aliases = ["setprefix", "changeprefix", "checkprefix"];
exports.category = 1;
exports.help = "Checks/changes the server prefix";
exports.params = "{prefix}";