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"], UserPerms: ["ADMINISTRATOR"],
category: "Config", category: "Config",
options: [ 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, type: 2,
name: "enable", name: "enable",
@ -167,10 +153,7 @@ module.exports = {
}, },
], ],
run: async (client, interaction, args, utils, data) => { run: async (client, interaction, args, utils, data) => {
if (args[0].toLowerCase() === "prefix") { if (args[0].toLowerCase() === "tips") {
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[1]) { if (args[1]) {
await client.data.setTips(interaction.guild.id, "true"); await client.data.setTips(interaction.guild.id, "true");
interaction.followUp({ interaction.followUp({

View file

@ -157,23 +157,6 @@ module.exports = {
} else { } else {
UserPermissions = [command.UserPerms ? command.UserPerms : ""]; 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 fields = [];
const embed = new EmbedBuilder() const embed = new EmbedBuilder()
.setTitle(`"${command.name}" command details`) .setTitle(`"${command.name}" command details`)
@ -205,18 +188,6 @@ module.exports = {
name: "**Cooldown**:", name: "**Cooldown**:",
value: utils.timer(command.timeout), 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 embed
.setFooter({ .setFooter({
text: `Requested by ${interaction.user.tag}`, 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) {
if (data.Guild.Category.includes(cmd.directory)) { if (data.Guild.Category.includes(cmd.directory)) {
return interaction.followUp({ return interaction.followUp({
@ -116,7 +105,6 @@ client.on("interactionCreate", async interaction => {
cmd cmd
.run(client, interaction, args, utils, data) .run(client, interaction, args, utils, data)
.catch(e => sendE(e, interaction)); .catch(e => sendE(e, interaction));
// client.addcmdsused(interaction.user.id);
client.channels.cache.get(client.config.CMDLog).send({ 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})\``, 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({ 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})\``, 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({ new cooldown({
User: interaction.user.id, User: interaction.user.id,
CMD: cmd.name, CMD: cmd.name,

View file

@ -11,7 +11,6 @@ client.on("messageCreate", async message => {
if (!userDB) return; if (!userDB) return;
data.Guild = guildDB; data.Guild = guildDB;
data.User = userDB; data.User = userDB;
console.log(message.content);
if (!guildDB) await client.data.CreateGuild(message.guild.id); if (!guildDB) await client.data.CreateGuild(message.guild.id);
if (message.content.match(new RegExp(`^<@!?${client.user.id}>( |)$`))) { if (message.content.match(new RegExp(`^<@!?${client.user.id}>( |)$`))) {
const _ = new EmbedBuilder() 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({ return msg.followUp({
embeds: [ embeds: [
new EmbedBuilder() new EmbedBuilder()
.setColor("RANDOM") .setColor("Random")
.setTimestamp() .setTimestamp()
.setTitle(slowed) .setTitle(slowed)
.setDescription( .setDescription(

View file

@ -6,7 +6,6 @@ const cachegoose = new GooseCache(mongoose, {
mongoose.set("useFindAndModify", false); mongoose.set("useFindAndModify", false);
const u = require("../../models/users"); const u = require("../../models/users");
const g = require("../../models/guilds"); const g = require("../../models/guilds");
const m = require("../../models/bot");
module.exports = { module.exports = {
/** /**
* @param {String} URI - Mongo Connection URI * @param {String} URI - Mongo Connection URI
@ -63,34 +62,28 @@ module.exports = {
const ss = new u({ User: ID }); const ss = new u({ User: ID });
const { const {
User, User,
AFKDate,
Tier, Tier,
Premium, Premium,
Blacklist, Blacklist,
Blacklist_Reason, Blacklist_Reason,
PremiumServers, PremiumServers,
CommandUsed,
} = ss; } = ss;
await ss.save().catch(error => console.log(error)); await ss.save().catch(error => console.log(error));
return { return {
User, User,
AFKDate,
Tier, Tier,
Premium, Premium,
Blacklist, Blacklist,
Blacklist_Reason, Blacklist_Reason,
PremiumServers, PremiumServers,
CommandUsed,
}; };
} else { } else {
const User = user.User; const User = user.User;
const AFKDate = user.AFKDate;
const Tier = user.Tier; const Tier = user.Tier;
const Premium = user.Premium; const Premium = user.Premium;
const Blacklist = user.Blacklist; const Blacklist = user.Blacklist;
const Blacklist_Reason = user.Blacklist_Reason; const Blacklist_Reason = user.Blacklist_Reason;
const PremiumServers = user.PremiumServers; const PremiumServers = user.PremiumServers;
const CommandUsed = user.CommandUsed;
return { return {
User, User,
AFKDate, AFKDate,
@ -99,7 +92,6 @@ module.exports = {
Blacklist, Blacklist,
Blacklist_Reason, Blacklist_Reason,
PremiumServers, PremiumServers,
CommandUsed,
}; };
} }
}, },
@ -194,24 +186,6 @@ module.exports = {
await g.deleteMany({ Guild: ID }); await g.deleteMany({ Guild: ID });
return; 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} ID - Guild ID
* @param {String} Toggle - premium Toggle * @param {String} Toggle - premium Toggle
@ -322,32 +296,6 @@ module.exports = {
cachegoose.clearCache(); cachegoose.clearCache();
return true; 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} ID - Guild ID
* @param {String} Toggle - Level Toggle * @param {String} Toggle - Level Toggle