nyx/commands/Config/prefix-reset.js

38 lines
1.1 KiB
JavaScript
Raw Normal View History

2021-06-12 12:53:51 +02:00
const schema = require("../../models/guilds");
const prefix = require("../../config.json").prefix;
module.exports = {
name: "prefix-reset",
aliases: ["pr"],
description: 'Reset the prefix to "C." at the server',
UserPerm: "ADMINISTRATOR",
category: "Config",
run: async (client, message, args, utils) => {
2021-06-12 12:53:51 +02:00
message.channel
.send({ content: "**Do you want to reset your prefix?**" })
2021-06-12 12:53:51 +02:00
.then(async msg => {
const emoji = await utils.confirmation(
2021-06-12 12:53:51 +02:00
msg,
message.author,
["✅", "❌"],
10000
);
if (emoji === "✅") {
msg.delete();
schema.findOne({ Guild: message.guild.id }, async (err, data) => {
if (data) {
data.Prefix = prefix;
await schema.findOneAndUpdate({ Guild: message.guild.id }, data);
}
});
message.channel.send({
content: `The prefix has been reset to **${prefix}**`,
});
2021-06-12 12:53:51 +02:00
}
if (emoji === "❌") {
msg.delete();
message.channel.send({ content: "Cancelled." });
2021-06-12 12:53:51 +02:00
}
});
},
};