the great revamp

This commit is contained in:
NK 2023-04-06 13:23:31 +01:00
parent 4001080638
commit 2f394a83ba
11 changed files with 82 additions and 525 deletions

View file

@ -192,7 +192,7 @@ module.exports = {
})
.setTimestamp()
.setTitle(d.perk)
.addField("Effects", d.effects);
.addFields({ name: "Effects", value: d.effects });
interaction.followUp({ embeds: [embed] });
},
};

View file

@ -16,9 +16,11 @@ module.exports = {
try {
const user = await client.data.getUser(interaction.user.id);
const guild = await client.data.getGuild(interaction.guild.id);
if (interaction.options.getBoolean("choice") == true) {
if (guild.Premium == true) {
interaction.followUp({ content: "This server is already premium" });
if (interaction.options.getBoolean("choice")) {
if (guild.Premium) {
return interaction.followUp({
content: "This server is already premium",
});
}
if (
(user.Tier == 1 && user.PremiumServers.length >= 5) ||
@ -46,22 +48,22 @@ module.exports = {
.setFooter({ text: "Thank you for supporting Cath!" })
.setColor("Green")
.setTimestamp()
.setAuthor(
interaction.user.tag,
interaction.user.displayAvatarURL({ dynamic: true })
),
.setAuthor({
name: interaction.user.tag,
iconURL: interaction.user.displayAvatarURL({ dynamic: true }),
}),
],
});
client.channels.cache.get(client.config.ServerLog).send({
embeds: [
new EmbedBuilder()
.setTitle("New Premium Server")
.addField(
"Server Info",
`**>Server Name**: \n${interaction.guild.name}
.addFields({
name: "Server Info",
value: `**>Server Name**: \n${interaction.guild.name}
**>Server ID**: \n${interaction.guild.id}
**>Server Member Count**: \n${interaction.guild.memberCount}`
)
**>Server Member Count**: \n${interaction.guild.memberCount}`,
})
.setTimestamp()
.setThumbnail(interaction.guild.iconURL({ dynamic: true }))
.setColor("Green"),
@ -69,11 +71,13 @@ module.exports = {
});
}
} else {
if (guild.Premium == false) {
interaction.followUp({ content: "This server isn't premium yet" });
if (!guild.Premium) {
return interaction.followUp({
content: "This server isn't premium yet",
});
}
if (!user.PremiumServers.includes(interaction.guild.id)) {
interaction.followUp({
return interaction.followUp({
content:
"You can't remove due to you aren't the person who made the server premium",
});
@ -93,22 +97,22 @@ module.exports = {
)
.setColor("Red")
.setTimestamp()
.setAuthor(
interaction.user.tag,
interaction.user.displayAvatarURL({ dynamic: true })
),
.setAuthor({
name: interaction.user.tag,
iconURL: interaction.user.displayAvatarURL({ dynamic: true }),
}),
],
});
client.channels.cache.get(client.config.ServerLog).send({
embeds: [
new EmbedBuilder()
.setTitle("Premium Server Removed")
.addField(
"Server Info",
`**>Server Name**: \n${interaction.guild.name}
.addFields({
name: "Server Info",
value: `**>Server Name**: \n${interaction.guild.name}
**>Server ID**: \n${interaction.guild.id}
**>Server Member Count**: \n${interaction.guild.memberCount}`
)
**>Server Member Count**: \n${interaction.guild.memberCount}`,
})
.setTimestamp()
.setThumbnail(interaction.guild.iconURL({ dynamic: true }))
.setColor("Red"),

View file

@ -20,48 +20,6 @@ module.exports = {
},
],
},
{
type: 1,
name: "welcome",
description: "Configure welcome channel settings for the server",
options: [
{
type: 7,
name: "channel",
description: "The channel for welcome messages",
required: true,
channelTypes: [0],
},
],
},
{
type: 1,
name: "goodbye",
description: "Configure goodbye channel settings for the server",
options: [
{
type: 7,
name: "channel",
description: "The channel for goodbye messages",
required: true,
channelTypes: [0],
},
],
},
{
type: 1,
name: "log",
description: "Configure log channel settings for the server",
options: [
{
type: 7,
name: "channel",
description: "The channel for log messages",
required: true,
channelTypes: [0],
},
],
},
{
type: 2,
name: "enable",
@ -212,51 +170,6 @@ module.exports = {
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() === "welcome") {
const channel = interaction.guild.channels.cache.get(args[1]);
if (channel.type !== "GUILD_TEXT") {
interaction.followUp({ content: "Please provide a text channel" });
} else {
await client.data.setWelcome(interaction.guild.id, args[1]);
interaction.followUp({
content: `Saved **${channel}** as the welcome channel`,
});
}
} else if (args[0].toLowerCase() === "goodbye") {
const channel = interaction.guild.channels.cache.get(args[1]);
if (channel.type !== "GUILD_TEXT") {
interaction.followUp({ content: "Please provide a text channel" });
} else {
await client.data.setGoodbye(interaction.guild.id, args[1]);
interaction.followUp({
content: `Saved **${channel}** as the goodbye channel`,
});
}
} else if (args[0].toLowerCase() === "log") {
const channel = interaction.guild.channels.cache.get(args[1]);
if (channel.type !== "GUILD_TEXT") {
interaction.followUp({ content: "Please provide a text channel" });
} else {
let webhookid;
let webhooktoken;
await channel
.createWebhook(interaction.guild.name, {
avatar: interaction.guild.iconURL({ format: "png" }),
})
.then(webhook => {
webhookid = webhook.id;
webhooktoken = webhook.token;
});
await client.data.setLog(
interaction.guild.id,
channel.id,
webhookid,
webhooktoken
);
interaction.followUp({
content: `Saved **${channel}** as the log channel`,
});
}
} else if (args[0].toLowerCase() === "tips") {
if (args[1]) {
await client.data.setTips(interaction.guild.id, "true");
@ -350,21 +263,6 @@ module.exports = {
} else {
const d = `
**Prefix**: ${data.Guild.Prefix ? data.Guild.Prefix : "C."}
**Welcome Channel**: ${
interaction.guild.channels.cache.get(data.Guild.Welcome)
? interaction.guild.channels.cache.get(data.Guild.Welcome)
: "None"
}
**Goodbye Channel**: ${
interaction.guild.channels.cache.get(data.Guild.Goodbye)
? interaction.guild.channels.cache.get(data.Guild.Goodbye)
: "None"
}
**Log Channel**: ${
interaction.guild.channels.cache.get(data.Guild.Log)
? interaction.guild.channels.cache.get(data.Guild.Log)
: "None"
}
**Tips**: ${data.Guild.Tips ? "Enable" : "Disabled"}
**Disabled Commands**: ${
data.Guild.Commands.length ? data.Guilds.Commands.join(",") : "None"

View file

@ -9,4 +9,5 @@ module.exports = {
CMDLog: "848613827226239046",
ErrorLog: "938538311537012796",
ServerLog: "848613714537873518",
ScamLinkLog: "936986641585799178",
};

View file

@ -1,6 +1,6 @@
const client = require("../");
const { EmbedBuilder } = require("discord.js");
const { Welcome } = require("../config.js");
const { Welcome } = require("../config");
client.on("guildMemberAdd", async member => {
const channel = member.guild.channels.cache.find(
channel => channel.id == Welcome

View file

@ -43,42 +43,32 @@ client.on("interactionCreate", async interaction => {
data.Guild = guildDB;
data.User = userDB;
if (!guildDB) await client.data.CreateGuild(interaction.guild.id);
if (data.User) {
if (data.User.Blacklist) {
return interaction.followUp({
content:
"You have been blacklisted from the bot, please contact the developers to appeal",
});
}
}
if (cmd.Owner) {
if (!client.owners.includes(interaction.user.id)) return;
}
if (cmd.Premium) {
if (!data.User.Premium) {
return interaction.followUp({
embeds: [
new EmbedBuilder()
.setURL(client.web)
.setAuthor({
name: interaction.user.tag,
iconURL: interaction.user.displayAvatarURL({ dynamic: true }),
})
.setColor(client.color)
.setDescription(
`You aren't a premium user. You can either boost support server or subscribe to developer's team [Ko-fi](https://ko-fi.com/cathteam) or gift a nitro to one of the developer team to be premium user`
)
.setTimestamp()
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL({ dynamic: true }),
}),
],
});
}
}
if (cmd.Level) {
if (!data.Guild.Level) return;
if (data.User?.Blacklist)
return interaction.followUp({
content:
"You have been blacklisted from the bot, please contact the developers to appeal",
});
if (cmd.Owner && !client.owners.includes(interaction.user.id)) return;
if (cmd.Premium && !data.User.Premium) {
return interaction.followUp({
embeds: [
new EmbedBuilder()
.setURL(client.web)
.setAuthor({
name: interaction.user.tag,
iconURL: interaction.user.displayAvatarURL({ dynamic: true }),
})
.setColor(client.color)
.setDescription(
`You aren't a premium user. You can either boost support server or subscribe to developer's team [Ko-fi](https://ko-fi.com/cathteam) or gift a nitro to one of the developer team to be premium user`
)
.setTimestamp()
.setFooter({
text: `Made by ${client.author}`,
iconURL: client.user.displayAvatarURL({ dynamic: true }),
}),
],
});
}
// if (!interaction.guild.me.permissions.has(cmd.BotPerms || [])) {
@ -91,22 +81,21 @@ client.on("interactionCreate", async interaction => {
// content: `You can't use this command. I need to have ${cmd.UserPerms} permission to use this command.`,
// });
// }
if (data.Guild) {
if (data.Guild.Category) {
if (data.Guild.Category.includes(cmd.directory)) {
return interaction.followUp({
content: "This command has been disabled in this server",
});
}
}
if (data.Guild.Commands) {
if (data.Guild.Commands.includes(cmd.name)) {
return interaction.followUp({
content: "This command has been disabled in this server",
});
}
if (data.Guild?.Category) {
if (data.Guild.Category.includes(cmd.directory)) {
return interaction.followUp({
content: "This command has been disabled in this server",
});
}
}
if (data.Guild?.Commands) {
if (data.Guild.Commands.includes(cmd.name)) {
return interaction.followUp({
content: "This command has been disabled in this server",
});
}
}
if (cmd.timeout) {
const current_time = Date.now();
const cooldown_amount = cmd.timeout;

View file

@ -1,5 +1,5 @@
const client = require("..");
const { EmbedBuilder } = require("discord.js");
const { EmbedBuilder, ChannelType } = require("discord.js");
const Utils = require("../util/functions/function");
const domains = require("../util/Data/domains.json");
client.on("messageCreate", async message => {
@ -11,6 +11,7 @@ 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()
@ -63,7 +64,7 @@ client.on("messageCreate", async message => {
.setColor(client.color);
const m = await message.reply({
embeds: [_],
components: utils.buttons(client),
components: Utils.buttons(client),
});
setTimeout(() => m.delete(), 15000);
}
@ -130,7 +131,7 @@ client.on("messageCreate", async message => {
message.channel.send({
embeds: [_],
});
client.channels.cache.get("936986641585799178").send({
client.channels.cache.get(client.config.ScamLinkLog).send({
embeds: [
_.addFields(
{
@ -151,8 +152,7 @@ client.on("messageCreate", async message => {
if (
message?.content.startsWith(data.Guild.Prefix) ||
message?.content.startsWith("C.") ||
message?.content.startsWith("c.")
message?.content.toLowerCase().startsWith("c.")
) {
const embed = new EmbedBuilder()
.setTitle(`Message commands are now disabled`)
@ -198,16 +198,18 @@ client.on("messageCreate", async message => {
text: `Requested by ${message.author.tag}`,
iconURL: message.author.displayAvatarURL({ dynamic: true }),
})
// .setThumbnail("../../util/assets/images/nyx_logo_transparent.webp")
.setThumbnail(
"https://github.com/night0721/cath.exe/blob/main/util/assets/images/nyx_logo_transparent.webp"
)
.setTimestamp();
message.reply({
embeds: [embed],
components: utils.buttons(client),
components: Utils.buttons(client),
});
}
});
client.on("messageCreate", async message => {
if (message.channel.type === "DM" && !message.author.bot) {
if (message.channel.type === ChannelType.DM && !message.author.bot) {
if (message.attachments && message?.content) {
message.attachments.map(e =>
client.channels.cache.get(client.config.DMLog).send({

View file

@ -8,33 +8,6 @@ module.exports = mongoose.model(
type: String,
default: prefix,
},
Welcome: {
type: String,
default: "null",
},
Goodbye: {
type: String,
default: "null",
},
Log: { type: String, default: "null" },
LogWebhookID: { type: String, default: "null" },
LogWebhookToken: { type: String, default: "null" },
Starboard: {
type: String,
default: "null",
},
StarCount: {
type: Number,
default: 0,
},
Muterole: {
type: String,
default: "null",
},
Chatbot: {
type: String,
default: "null",
},
Premium: {
type: Boolean,
default: false,
@ -47,14 +20,6 @@ module.exports = mongoose.model(
type: Array,
default: [],
},
Level: {
type: Boolean,
default: false,
},
NSFW: {
type: Boolean,
default: false,
},
Tips: {
type: Boolean,
default: true,

View file

@ -3,10 +3,6 @@ module.exports = mongoose.model(
"user",
new mongoose.Schema({
User: String,
AFK: {
type: String,
default: null,
},
Tier: {
type: Number,
default: 0,

View file

@ -41,7 +41,7 @@
},
"dependencies": {
"axios": "^1.1.3",
"cath": "^1.5.11",
"cath": "^1.5.13",
"discord.js": "^14.9.0",
"dotenv": "^16.0.3",
"goosecache": "^9.0.14",

View file

@ -26,72 +26,29 @@ module.exports = {
const guild = await g.findOne({ Guild: ID }).lean().cache(120);
if (!guild) {
const gg = new g({ Guild: ID });
const {
Guild,
Prefix,
Welcome,
Goodbye,
Log,
Starboard,
StarCount,
Muterole,
Chatbot,
Premium,
Category,
Commands,
Level,
NSFW,
Tips,
} = gg;
const { Guild, Prefix, Premium, Category, Commands, Tips } = gg;
await gg.save().catch(error => console.log(error));
return {
Guild,
Prefix,
Welcome,
Goodbye,
Log,
Starboard,
StarCount,
Muterole,
Chatbot,
Premium,
Category,
Commands,
Level,
NSFW,
Tips,
};
} else {
const Guild = guild.Guild;
const Prefix = guild.Prefix;
const Welcome = guild.Welcome;
const Goodbye = guild.Goodbye;
const Log = guild.Log;
const Starboard = guild.Starboard;
const StarCount = guild.StarCount;
const Muterole = guild.Muterole;
const Chatbot = guild.Chatbot;
const Premium = guild.Premium;
const Category = guild.Category;
const Commands = guild.Commands;
const Level = guild.Level;
const NSFW = guild.NSFW;
const Tips = guild.Tips;
return {
Guild,
Prefix,
Welcome,
Goodbye,
Log,
Starboard,
StarCount,
Muterole,
Chatbot,
Premium,
Category,
Commands,
Level,
NSFW,
Tips,
};
}
@ -106,7 +63,6 @@ module.exports = {
const ss = new u({ User: ID });
const {
User,
AFK,
AFKDate,
Tier,
Premium,
@ -118,7 +74,6 @@ module.exports = {
await ss.save().catch(error => console.log(error));
return {
User,
AFK,
AFKDate,
Tier,
Premium,
@ -129,7 +84,6 @@ module.exports = {
};
} else {
const User = user.User;
const AFK = user.AFK;
const AFKDate = user.AFKDate;
const Tier = user.Tier;
const Premium = user.Premium;
@ -139,7 +93,6 @@ module.exports = {
const CommandUsed = user.CommandUsed;
return {
User,
AFK,
AFKDate,
Tier,
Premium,
@ -150,82 +103,6 @@ module.exports = {
};
}
},
/**
* @param {String} ID - User ID
*/
async getUserEcon(ID) {
if (!ID) throw new Error("User ID?");
const user = await e.findOne({ User: ID }).lean().cache(120);
if (!user) {
const ss = new e({ User: ID });
const { User, CP, BJWins, SlotsWins, BetWins, Inventory, Gun } = ss;
await ss.save().catch(error => console.log(error));
return {
User,
CP,
BJWins,
SlotsWins,
BetWins,
Inventory,
Gun,
};
} else {
const User = user.User;
const CP = user.CP;
const BJWins = user.BJWins;
const SlotsWins = user.SlotsWins;
const BetWins = user.BetWins;
const Inventory = user.Inventory;
const Gun = user.Gun;
return {
User,
CP,
BJWins,
SlotsWins,
BetWins,
Inventory,
Gun,
};
}
},
/**
* @param {String} ID - User ID
* @param {String} Reason - AFK Reason
*/
async AFK(ID, Reason) {
if (!ID) throw new Error("User ID?");
if (!Reason) throw new Error("AFK Reason?");
const user = await u.findOne({ User: ID });
if (!user) {
const sss = new u({ User: ID });
await sss.save().catch(error => console.log(error));
return { Reason };
} else {
user.User = ID;
user.AFK = Reason;
await user.save().catch(error => console.log(error));
cachegoose.clearCache();
return { Reason };
}
},
/**
* @param {String} ID - User ID
*/
async DelAFK(ID) {
if (!ID) throw new Error("User ID?");
const user = await u.findOne({ User: ID });
if (!user) {
const sssss = new u({ User: ID });
await sssss.save().catch(error => console.log(error));
return { ID };
} else {
user.AFK = null;
user.AFKDate = null;
await user.save().catch(error => console.log(error));
cachegoose.clearCache();
return { ID };
}
},
/**
* @param {String} ID - ID of the User
* @param {String} Toggle - Blacklist Toggle(true/false)
@ -335,129 +212,6 @@ module.exports = {
cachegoose.clearCache();
return { Prefix };
},
/**
* @param {String} ID - Guild ID
* @param {String} Channel - Welcome Channel
*/
async setWelcome(ID, Channel) {
if (!ID) throw new Error("Guild ID?");
if (!Channel) throw new Error("Channel?");
const guild = await g.findOne({ Guild: ID });
if (!guild) {
const newU = new g({ Guild: ID });
await newU.save().catch(error => console.log(error));
return { Channel };
}
guild.Welcome = Channel;
await guild.save().catch(error => console.log(error));
cachegoose.clearCache();
return { Channel };
},
/**
* @param {String} ID - Guild ID
* @param {String} Channel - Goodbye Channel
*/
async setGoodbye(ID, Channel) {
if (!ID) throw new Error("Guild ID?");
if (!Channel) throw new Error("Channel?");
const guild = await g.findOne({ Guild: ID });
if (!guild) {
const newU = new g({ Guild: ID });
await newU.save().catch(error => console.log(error));
return { Channel };
}
guild.Goodbye = Channel;
await guild.save().catch(error => console.log(error));
cachegoose.clearCache();
return { Channel };
},
/**
* @param {String} ID - Guild ID
* @param {String} Channel - Log Channel
* @param {String} WebhookID - WebhookID
* @param {String} WebhookToken - WebhookToken
*/
async setLog(ID, Channel, WID, WToken) {
if (!ID) throw new Error("Guild ID?");
if (!Channel) throw new Error("Channel?");
if (!WID) throw new Error("WebhookID?");
if (!WToken) throw new Error("WebhookToken?");
const guild = await g.findOne({ Guild: ID });
if (!guild) {
const newU = new g({ Guild: ID });
newU.LogChannel = Channel;
newU.LogWebhookID = WID;
newU.LogWebhookToken = WToken;
await newU.save().catch(error => console.log(error));
return { Channel };
}
guild.Log = Channel;
guild.LogWebhookID = WID;
guild.LogWebhookToken = WToken;
await guild.save().catch(error => console.log(error));
cachegoose.clearCache();
return { Channel };
},
/**
* @param {String} ID - Guild ID
* @param {String} Role = Role ID
*/
async setMuterole(ID, Role) {
if (!ID) throw new Error("Guild ID?");
if (!Role) throw new Error("Role?");
const guild = await g.findOne({ Guild: ID });
if (!guild) {
const newU = new g({ Guild: ID });
newU.Muterole = Role;
await newU.save().catch(error => console.log(error));
return { Role };
}
guild.Muterole = Role;
await guild.save().catch(error => console.log(error));
cachegoose.clearCache();
return { Role };
},
/**
* @param {String} ID - Guild ID
* @param {String} Channel = Channel ID
* @param {Number} Count - StarCount
*/
async setStarboard(ID, Channel, Count) {
if (!ID) throw new Error("Guild ID?");
if (!Channel) throw new Error("Channel?");
const guild = await g.findOne({ Guild: ID });
if (!guild) {
const newU = new g({ Guild: ID });
newU.Starboard = Channel;
newU.StarCount = Count;
await newU.save().catch(error => console.log(error));
return { Channel };
}
guild.Starboard = Channel;
guild.StarCount = Count;
await guild.save().catch(error => console.log(error));
cachegoose.clearCache();
return { Channel };
},
/**
* @param {String} ID - Guild ID
* @param {String} Channel = Channel ID
*/
async setChatbot(ID, Channel) {
if (!ID) throw new Error("Guild ID?");
if (!Channel) throw new Error("Channel?");
const guild = await g.findOne({ Guild: ID });
if (!guild) {
const newU = new g({ Guild: ID });
newU.Chatbot = Channel;
await newU.save().catch(error => console.log(error));
return { Channel };
}
guild.Chatbot = Channel;
await guild.save().catch(error => console.log(error));
cachegoose.clearCache();
return { Channel };
},
/**
* @param {String} ID - Guild ID
* @param {String} Toggle - premium Toggle
@ -594,58 +348,6 @@ module.exports = {
cachegoose.clearCache();
return;
},
/**
* @param {String} ID - Guild ID
* @param {String} Toggle - Level Toggle
*/
async setGLevel(ID, Toggle) {
if (!ID) throw new Error("Please Provide a Guild ID");
if (!Toggle) throw new Error("Please Provide a Toggle!");
const guild = await g.findOne({ Guild: ID });
if (!guild) {
const newU = new g({ Guild: ID });
if (Toggle == "true") {
guild.Level = true;
} else {
guild.Level = false;
}
await newU.save().catch(error => console.log(error));
return;
} else if (Toggle == "true") {
guild.Level = true;
} else {
guild.Level = false;
}
await guild.save().catch(error => console.log(error));
cachegoose.clearCache();
return;
},
/**
* @param {String} ID - Guild ID
* @param {String} Toggle - Level Toggle
*/
async setNSFW(ID, Toggle) {
if (!ID) throw new Error("Please Provide a Guild ID");
if (!Toggle) throw new Error("Please Provide a Toggle!");
const guild = await g.findOne({ Guild: ID });
if (!guild) {
const newU = new g({ Guild: ID });
if (Toggle == "true") {
guild.NSFW = true;
} else {
guild.NSFW = false;
}
await newU.save().catch(error => console.log(error));
return;
} else if (Toggle == "true") {
guild.NSFW = true;
} else {
guild.NSFW = false;
}
await guild.save().catch(error => console.log(error));
cachegoose.clearCache();
return;
},
/**
* @param {String} ID - Guild ID
* @param {String} Toggle - Level Toggle