the great revamp 2.0

This commit is contained in:
NK 2023-04-06 13:32:44 +01:00
parent 2f394a83ba
commit 3a2e52d660
7 changed files with 2 additions and 137 deletions

View file

@ -6,20 +6,6 @@ module.exports = {
UserPerms: ["ADMINISTRATOR"],
category: "Config",
options: [
{
type: 1,
name: "prefix",
description: "Configure prefix settings for the server",
options: [
{
type: 3,
name: "prefix",
description: "The prefix for the server",
required: true,
choices: [],
},
],
},
{
type: 2,
name: "enable",
@ -167,10 +153,7 @@ module.exports = {
},
],
run: async (client, interaction, args, utils, data) => {
if (args[0].toLowerCase() === "prefix") {
await client.data.setPrefix(interaction.guild.id, args[1]);
interaction.followUp({ content: `Saved \`${args[2]}\` as the prefix` });
} else if (args[0].toLowerCase() === "tips") {
if (args[0].toLowerCase() === "tips") {
if (args[1]) {
await client.data.setTips(interaction.guild.id, "true");
interaction.followUp({

View file

@ -157,23 +157,6 @@ module.exports = {
} else {
UserPermissions = [command.UserPerms ? command.UserPerms : ""];
}
if (command.BotPerms && Array.isArray(command.BotPerms)) {
BotPermissions = command.BotPerms;
} else {
BotPermissions = [command.BotPerms ? command.BotPerms : ""];
}
const BotPerms = BotPermissions.map(x =>
x
.split("_")
.map(y => y[0] + y.substring(1, y.length).toLowerCase())
.join(" ")
).join(", ");
const UserPerms = UserPermissions.map(x =>
x
.split("_")
.map(y => y[0] + y.substring(1, y.length).toLowerCase())
.join(" ")
).join(", ");
const fields = [];
const embed = new EmbedBuilder()
.setTitle(`"${command.name}" command details`)
@ -205,18 +188,6 @@ module.exports = {
name: "**Cooldown**:",
value: utils.timer(command.timeout),
});
if (command.UserPerms)
fields.push({
name: "**Required User Permission**:",
value: UserPerms,
});
if (command.BotPerms)
fields.push({
name: "**Required Bot Permission**:",
value: BotPerms,
});
embed
.setFooter({
text: `Requested by ${interaction.user.tag}`,

View file

@ -70,17 +70,6 @@ client.on("interactionCreate", async interaction => {
],
});
}
// if (!interaction.guild.me.permissions.has(cmd.BotPerms || [])) {
// return interaction.followUp({
// content: `You can't use this command. I need to have ${cmd.BotPerms} permission to use this command.`,
// });
// }
// if (!interaction.member.permissions.has(cmd.UserPerms || [])) {
// return interaction.followUp({
// content: `You can't use this command. I need to have ${cmd.UserPerms} permission to use this command.`,
// });
// }
if (data.Guild?.Category) {
if (data.Guild.Category.includes(cmd.directory)) {
return interaction.followUp({
@ -116,7 +105,6 @@ client.on("interactionCreate", async interaction => {
cmd
.run(client, interaction, args, utils, data)
.catch(e => sendE(e, interaction));
// client.addcmdsused(interaction.user.id);
client.channels.cache.get(client.config.CMDLog).send({
content: `\`${interaction.user.tag}(${interaction.user.id})\`\n has used \n**${cmd.name}**\n command in \n\`${interaction.guild.name}(${interaction.guild.id})\``,
});
@ -129,7 +117,6 @@ client.on("interactionCreate", async interaction => {
client.channels.cache.get(client.config.CMDLog).send({
content: `\`${interaction.user.tag}(${interaction.user.id})\`\n has used \n**${cmd.name}**\n command in \n\`${interaction.guild.name}(${interaction.guild.id})\``,
});
// client.addcmdsused(interaction.user.id);
new cooldown({
User: interaction.user.id,
CMD: cmd.name,

View file

@ -11,7 +11,6 @@ client.on("messageCreate", async message => {
if (!userDB) return;
data.Guild = guildDB;
data.User = userDB;
console.log(message.content);
if (!guildDB) await client.data.CreateGuild(message.guild.id);
if (message.content.match(new RegExp(`^<@!?${client.user.id}>( |)$`))) {
const _ = new EmbedBuilder()

View file

@ -1,23 +0,0 @@
const mongoose = require("mongoose");
module.exports = mongoose.model(
"status",
new mongoose.Schema({
Bot: {
type: String,
default: "null",
},
Status: { type: String, default: "false" },
Guilds: {
type: String,
default: "null",
},
Users: {
type: String,
default: "null",
},
Commands: {
type: Array,
default: [],
},
})
);

View file

@ -213,7 +213,7 @@ function cooldown(dbtime, defaults, msg) {
return msg.followUp({
embeds: [
new EmbedBuilder()
.setColor("RANDOM")
.setColor("Random")
.setTimestamp()
.setTitle(slowed)
.setDescription(

View file

@ -6,7 +6,6 @@ const cachegoose = new GooseCache(mongoose, {
mongoose.set("useFindAndModify", false);
const u = require("../../models/users");
const g = require("../../models/guilds");
const m = require("../../models/bot");
module.exports = {
/**
* @param {String} URI - Mongo Connection URI
@ -63,34 +62,28 @@ module.exports = {
const ss = new u({ User: ID });
const {
User,
AFKDate,
Tier,
Premium,
Blacklist,
Blacklist_Reason,
PremiumServers,
CommandUsed,
} = ss;
await ss.save().catch(error => console.log(error));
return {
User,
AFKDate,
Tier,
Premium,
Blacklist,
Blacklist_Reason,
PremiumServers,
CommandUsed,
};
} else {
const User = user.User;
const AFKDate = user.AFKDate;
const Tier = user.Tier;
const Premium = user.Premium;
const Blacklist = user.Blacklist;
const Blacklist_Reason = user.Blacklist_Reason;
const PremiumServers = user.PremiumServers;
const CommandUsed = user.CommandUsed;
return {
User,
AFKDate,
@ -99,7 +92,6 @@ module.exports = {
Blacklist,
Blacklist_Reason,
PremiumServers,
CommandUsed,
};
}
},
@ -194,24 +186,6 @@ module.exports = {
await g.deleteMany({ Guild: ID });
return;
},
/**
* @param {String} ID - User ID
* @param {String} Prefix - Guild Prefix
*/
async setPrefix(ID, Prefix) {
if (!ID) throw new Error("Guild ID?");
if (!Prefix) throw new Error("Prefix?");
const guild = await g.findOne({ Guild: ID });
if (!guild) {
const newU = new g({ Guild: ID });
await newU.save().catch(error => console.log(error));
return { Prefix };
}
guild.Prefix = Prefix;
await guild.save().catch(error => console.log(error));
cachegoose.clearCache();
return { Prefix };
},
/**
* @param {String} ID - Guild ID
* @param {String} Toggle - premium Toggle
@ -322,32 +296,6 @@ module.exports = {
cachegoose.clearCache();
return true;
},
/**
* @param {String} ID - Bot ID
* @param {String} Toggle - Maintenance Toggle
*/
async maintenance(ID, Toggle) {
if (!ID) throw new Error("Please Provide a ID!");
if (!Toggle) throw new Error("Please Provide a Toggle!");
const idk = await m.findOne({ Bot: ID });
if (!idk) {
const newdb = new m({ Bot: ID });
if (Toggle === "true") {
newdb.Status = "true";
} else {
newdb.Status = "false";
}
await newdb.save().catch(error => console.log(error));
return;
} else if (Toggle === "true") {
idk.Status = "true";
} else {
idk.Status = "false";
}
await idk.save().catch(error => console.log(error));
cachegoose.clearCache();
return;
},
/**
* @param {String} ID - Guild ID
* @param {String} Toggle - Level Toggle