global starboard, esnipe snipe fix

This commit is contained in:
night0721 2021-09-21 07:51:56 +08:00
parent 3de5418cf1
commit d3ccdffbd9
49 changed files with 1131 additions and 1096 deletions

73
bot.js
View file

@ -1,9 +1,8 @@
const { Client, Collection, MessageEmbed, Intents } = require("discord.js");
const { GiveawaysManager } = require("discord-giveaways");
const config = require("./config.json");
const { MessageEmbed, Intents } = require("discord.js");
const Cath = require("./client/Cath");
const version = require("./package.json").version;
require("dotenv").config();
const client = new Client({
const config = require("./config.json");
const client = new Cath({
allowedMentions: { parse: ["users", "roles"], repliedUser: true },
presence: {
activities: [
@ -17,8 +16,9 @@ const client = new Client({
restTimeOffset: 0,
partials: ["MESSAGE", "CHANNEL", "REACTION", "GUILD_MEMBER"],
intents: [
Intents.FLAGS.GUILDS,
//Intents.FLAGS.GUILD_MEMBERS,
//Intents.FLAGS.GUILD_PRESENCES,
Intents.FLAGS.GUILDS,
Intents.FLAGS.GUILD_BANS,
Intents.FLAGS.GUILD_EMOJIS_AND_STICKERS,
Intents.FLAGS.GUILD_INVITES,
@ -26,68 +26,13 @@ const client = new Client({
Intents.FLAGS.GUILD_MESSAGES,
Intents.FLAGS.GUILD_MESSAGE_REACTIONS,
Intents.FLAGS.DIRECT_MESSAGES,
//Intents.FLAGS.GUILD_PRESENCES,
Intents.FLAGS.DIRECT_MESSAGE_TYPING,
],
});
module.exports = client;
require("./util/functions/economy")(client);
require("./util/dist/manager")(client);
require("./util/dist/handler")(client);
client.commands = new Collection();
client.slashCommands = new Collection();
client.aliases = new Collection();
client.esnipes = new Collection();
client.hide = new Collection();
client.snipes = new Array();
client.queue = new Map();
client.Timers = new Map();
client.config = config;
client.function = require("./util/functions/function");
client.data = require("./util/functions/mongoose");
client.err = require("./util/dist/err");
client.serr = require("./util/dist/slash");
client.cat = client.config.ca;
client.SuggestionLog = client.config.Suggestion;
client.ReportLog = client.config.Report;
client.DMLog = client.config.DMLog;
client.CMDLog = client.config.CMDLog;
client.ServerLog = client.config.ServerLog;
client.ErrorLog = client.config.ErrorLog;
client.color = client.config.color;
client.author = "Cath Team";
client.invite = "https://discord.gg/SbQHChmGcp";
client.web = client.config.URL;
client.data
.connect(process.env.MONGO)
.then(() => console.log("Connected to MongoDB!"))
.catch(e => console.log(e));
client.owners = [
"452076196419600394", //Night
"766645910087139338", //chekseaa
"755476040029306952", //Kałÿ
"534027706325532694", //Cat drinking a cat
"381442059111759883", //Thunder
"556808365574193194", //chunchunmaru
];
client.currency = "<:cp:840231933933387797>";
client.path = [
"614423108388126731",
"767173194943168542",
"783633408738721834",
"718762019586572341",
"784052348561522730",
"840225563193114624",
"800396461229080619",
];
client.giveaways = new GiveawaysManager(client, {
storage: "./util/Data/giveaways.json",
updateCountdownEvery: 1000,
default: {
botsCanWin: false,
embedColor: client.color,
reaction: "🎉",
},
});
process.on("unhandledRejection", async err => {
if (client.user) {
if (client.user.id === client.user.id) {
@ -100,6 +45,6 @@ process.on("unhandledRejection", async err => {
client.channels.cache.get(client.ErrorLog).send({ embeds: [embed] });
}
}
return console.log(err);
return console.error(err);
});
client.login(process.env.TOKEN);
client.start();

72
client/Cath.js Normal file
View file

@ -0,0 +1,72 @@
const { Client, Collection } = require("discord.js");
const config = require("../config.json");
const { GiveawaysManager } = require("discord-giveaways");
require("dotenv").config();
class Cath extends Client {
/**
* @param {Client.options} options
*/
constructor(options = {}) {
super(options);
this.commands = new Collection();
this.slashCommands = new Collection();
this.aliases = new Collection();
this.esnipes = new Collection();
this.hide = new Collection();
this.snipes = new Collection();
this.queue = new Map();
this.Timers = new Map();
this.config = config;
this.function = require("../util/functions/function");
this.data = require("../util/functions/mongoose");
this.err = require("../util/dist/err");
this.serr = require("../util/dist/slash");
this.cat = this.config.ca;
this.SuggestionLog = this.config.Suggestion;
this.ReportLog = this.config.Report;
this.DMLog = this.config.DMLog;
this.CMDLog = this.config.CMDLog;
this.ServerLog = this.config.ServerLog;
this.ErrorLog = this.config.ErrorLog;
this.color = this.config.color;
this.author = "Cath Team";
this.invite = "https://discord.gg/SbQHChmGcp";
this.web = this.config.URL;
this.owners = [
"452076196419600394", //Night
"766645910087139338", //chekseaa
"755476040029306952", //Kałÿ
"534027706325532694", //Cat drinking a cat
"381442059111759883", //Thunder
"556808365574193194", //chunchunmaru
];
this.currency = "<:cp:840231933933387797>";
this.path = [
"614423108388126731",
"767173194943168542",
"783633408738721834",
"718762019586572341",
"784052348561522730",
"840225563193114624",
"800396461229080619",
];
this.giveaways = new GiveawaysManager(this, {
storage: "./util/Data/giveaways.json",
updateCountdownEvery: 1000,
default: {
botsCanWin: false,
embedColor: this.color,
reaction: "🎉",
},
});
}
start() {
this.data
.connect(process.env.MONGO)
.then(() => console.log("Connected to MongoDB!"))
.catch(e => console.log(e));
this.login(process.env.TOKEN);
}
}
module.exports = Cath;

View file

@ -0,0 +1,6 @@
const { StarboardClient } = require("cath");
const client = require("../bot");
module.exports = new StarboardClient({
client,
color: "02023a",
});

119
command/Config/premium.js Normal file
View file

@ -0,0 +1,119 @@
const { MessageEmbed } = require("discord.js");
module.exports = {
name: "premiumserver",
category: "Config",
description: "Add premium to a server",
Premium: true,
options: [
{
type: 5,
name: "choice",
description: "Whether add or remove premium server",
required: true,
},
],
run: async (client, interaction, args) => {
try {
console.log(interaction.options.getBoolean("choice"));
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) {
return client.serr(interaction, "Config", "premium", 506);
}
if (
(user.Tier == 1 && user.PremiumServers.length >= 5) ||
(user.Tier == 2 && user.PremiumServers.length >= 2) ||
(user.Tier == 3 && user.PremiumServers.length >= 0)
) {
return client.serr(interaction, "Config", "premium", 505);
} else {
await client.data.setPremium(interaction.guild.id, "true");
await client.data.pushGuild(
interaction.user.id,
interaction.guild.id,
"push"
);
interaction.followUp({
embeds: [
new MessageEmbed()
.setTitle("Success!")
.setDescription(
`Premium added to **${interaction.guild.name}**! \n`
)
.setFooter("Thank you for supporting Cath!")
.setColor("GREEN")
.setTimestamp()
.setAuthor(
interaction.user.tag,
interaction.user.displayAvatarURL({ dynamic: true })
),
],
});
client.channels.cache.get(client.ServerLog).send({
embeds: [
new MessageEmbed()
.setTitle("New Premium Server")
.addField(
"Server Info",
`**>Server Name**: \n${interaction.guild.name}
**>Server ID**: \n${interaction.guild.id}
**>Server Member Count**: \n${interaction.guild.memberCount}`
)
.setTimestamp()
.setThumbnail(interaction.guild.iconURL({ dynamic: true }))
.setColor("GREEN"),
],
});
}
} else {
if (guild.Premium == false) {
return client.serr(interaction, "Config", "premium", 507);
}
if (!user.PremiumServers.includes(interaction.guild.id))
return client.serr(interaction, "Config", "premium", 509);
else {
await client.data.setPremium(interaction.guild.id, "false");
await client.data.pushGuild(
interaction.user.id,
interaction.guild.id,
"splice"
);
interaction.followUp({
embeds: [
new MessageEmbed()
.setTitle("Removed!")
.setDescription(
`Premium removed from **${interaction.guild.name}**! \n`
)
.setColor("RED")
.setTimestamp()
.setAuthor(
interaction.user.tag,
interaction.user.displayAvatarURL({ dynamic: true })
),
],
});
client.channels.cache.get(client.ServerLog).send({
embeds: [
new MessageEmbed()
.setTitle("Premium Server Removed")
.addField(
"Server Info",
`**>Server Name**: \n${interaction.guild.name}
**>Server ID**: \n${interaction.guild.id}
**>Server Member Count**: \n${interaction.guild.memberCount}`
)
.setTimestamp()
.setThumbnail(interaction.guild.iconURL({ dynamic: true }))
.setColor("RED"),
],
});
}
}
} catch (e) {
console.log(e);
return client.serr(interaction, "Config", "premium", 999);
}
},
};

220
command/Config/set.js Normal file
View file

@ -0,0 +1,220 @@
const starboardClient = require("../../client/StarboardClient");
module.exports = {
name: "set",
description: "Configure settings for the server",
UserPerms: ["ADMINISTRATOR"],
category: "Config",
options: [
{
type: 1,
name: "muterole",
description: "Set mute role for the server",
options: [
{
type: 8,
name: "role",
description: "The role for muted users",
required: true,
},
],
},
{
type: 1,
name: "prefix",
description: "Set prefix for the server",
options: [
{
type: 3,
name: "prefix",
description: "The prefix for the server",
required: true,
choices: [],
},
],
},
{
type: 1,
name: "welcome",
description: "Set welcome channel for the server",
options: [
{
type: 7,
name: "channel",
description: "The channel for welcome messages",
required: true,
},
],
},
{
type: 1,
name: "goodbye",
description: "Set goodbye channel for the server",
options: [
{
type: 7,
name: "channel",
description: "The channel for goodbye messages",
required: true,
},
],
},
{
type: 1,
name: "starboard",
description: "Set starboard channel for the server",
options: [
{
type: 7,
name: "channel",
description: "The channel for starboard messages",
required: true,
},
{
type: 4,
name: "starcount",
description: "The required amount of star to trigger the starboard",
required: true,
},
],
},
{
type: 1,
name: "chatbot",
description: "Set chatbot channel for the server",
options: [
{
type: 7,
name: "channel",
description: "The channel for chatbot messages",
required: true,
},
],
},
{
type: 1,
name: "log",
description: "Set log channel for the server",
options: [
{
type: 7,
name: "channel",
description: "The channel for log messages",
required: true,
},
],
},
{
type: 1,
name: "level",
description: "Set whether level system is activated for the server",
options: [
{
type: 5,
name: "choice",
description: "whether level system is activated for the server",
required: true,
},
],
},
],
run: async (client, interaction, args) => {
if (args[0].toLowerCase() === "muterole") {
const role = interaction.guild.roles.cache.get(args[1]);
if (role.managed) {
interaction.followUp({ content: "You must provide a non bot role" });
} else {
await client.data.setMuterole(interaction.guild.id, args[1]);
interaction.followUp({
content: `Saved **${role.name}** as the mute role`,
});
}
} else if (args[0].toLowerCase() === "prefix") {
await client.data.setPrefix(interaction.guild.id, args[1]);
interaction.followUp({ content: `Saved \`${args[1]}\` 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() === "starboard") {
const channel = interaction.guild.channels.cache.get(args[1]);
if (channel.type !== "GUILD_TEXT")
interaction.followUp({ content: "Please provide a text channel" });
else {
starboardClient.config.guilds.add({
id: interaction.guild.id,
options: {
starCount: args[2],
starboardChannel: args[1],
},
});
await client.data.setStarboard(interaction.guild.id, args[1], args[2]);
interaction.followUp({
content: `Saved **${channel}** as the starboard channel`,
});
}
} else if (args[0].toLowerCase() === "chatbot") {
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.setChatbot(interaction.guild.id, args[1]);
interaction.followUp({
content: `Saved **${channel}** as the chatbot 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() === "level") {
if (args[1]) {
await client.data.setGLevel(interaction.guild.id, "true");
interaction.followUp({
content: `Levelling is enabled in this server now.`,
});
} else {
await client.data.setGLevel(interaction.guild.id, "false");
interaction.followUp({
content: `Levelling is disabled in this server now.`,
});
}
}
},
};

44
command/Economy/drop.js Normal file
View file

@ -0,0 +1,44 @@
module.exports = {
name: "drop",
usage: "{Channel} (Number)",
description: "Drops money to a channel",
category: "Economy",
options: [
{
type: 7,
name: "channel",
description: "The channel you want to drop",
required: true,
},
{
type: 4,
name: "cp",
description: "The amount of CP to drop",
required: true,
},
],
run: async (client, interaction, args) => {
const channel = interaction.guild.channels.cache.get(args[0]);
const coinsAmount = args[1];
if ((await client.bal(interaction.user.id)) < coinsAmount) {
return client.serr(interaction, "Economy", "drop", 20);
}
const filter = msg =>
msg.guild.id === interaction.guild.id && msg.content === `claim`;
interaction.followUp({
content: "The drop has started in " + channel.toString(),
});
channel.send({
content: `${interaction.user.username} has dropped a ${client.currency} bomb! Type \`claim\` to claim ${client.currency}!!`,
});
client.rmv(interaction.user.id, parseInt(coinsAmount));
channel.awaitMessages({ filter, max: 1, time: 60000 }).then(async msg => {
const id = msg.first().author.id;
const coinsToClaim = parseInt(coinsAmount);
await client.add(id, coinsToClaim, interaction);
msg.first().reply({
content: `Congratultions! You have claimed **${coinsToClaim}** ${client.currency}!`,
});
});
},
};

View file

@ -129,12 +129,12 @@ module.exports = {
content: `There isn't any command or category named "${args[0]}"`,
});
} else {
if (command.UserPerm && Array.isArray(command.UserPerm)) {
UserPermissions = command.UserPerm;
} else UserPermissions = [command.UserPerm ? command.UserPerm : ""];
if (command.BotPerm && Array.isArray(command.BotPerm)) {
BotPermissions = command.BotPerm;
} else BotPermissions = [command.BotPerm ? command.BotPerm : ""];
if (command.UserPerms && Array.isArray(command.UserPerms)) {
UserPermissions = command.UserPerms;
} 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("_")
@ -164,7 +164,7 @@ module.exports = {
if (command.timeout) {
embed.addField("**Cooldown**:", utils.timer(command.timeout));
}
if (command.UserPerm) {
if (command.UserPerms) {
embed.addField("**Required User Permission**:", UserPerms);
}
if (command.BotPerm) {

View file

@ -0,0 +1,60 @@
const { MessageEmbed } = require("discord.js");
module.exports = {
name: "announce",
UserPerm: ["MANAGE_MESSAGES"],
BotPerm: ["MANAGE_MESSAGES"],
usage: "{Channel} (Message)",
description: "Announce a message to a channel.",
category: "Moderation",
options: [
{
type: 7,
name: "channel",
description: "The channel to announce",
required: true,
},
{
type: 3,
name: "message",
description: "The message to announce",
required: true,
},
],
run: async (client, interaction, args) => {
const channel = interaction.guild.channels.cache.get(args[0]);
if (channel.type !== "GUILD_TEXT") {
return interaction.followUp({
content: "Please provide a text channel",
});
}
try {
channel.send({
embeds: [
new MessageEmbed()
.setAuthor(
`Sent by ${interaction.member.displayName}`,
interaction.user.displayAvatarURL({ dynamic: true })
)
.setDescription(args[1])
.setTimestamp()
.setColor(client.color),
],
});
interaction.followUp({
embeds: [
new MessageEmbed()
.setTitle(`Message Announced`)
.addField("**Moderator**", interaction.user.tag, true)
.setTimestamp()
.setFooter(
interaction.member.displayName,
interaction.user.displayAvatarURL({ dynamic: true })
)
.setColor(client.color),
],
});
} catch (e) {
console.log(e);
}
},
};

View file

@ -5,13 +5,13 @@ module.exports = {
description: "Clear messages in a specific channel",
options: [
{
name: "channel",
name: 7,
description: "Channel where the messages to be deleted",
type: "CHANNEL",
required: true,
},
{
name: "amount",
name: 4,
description: "Amount of message in range of 1-100 to be deleted",
type: "NUMBER",
required: true,
@ -30,7 +30,7 @@ module.exports = {
}
if (channel.type !== "GUILD_TEXT") {
return interaction.followUp({
content: "Please provide a text channel instead of voice or category",
content: "Please provide a text channel",
});
}
const limit = await interaction.channel.messages.fetch({

View file

@ -1,7 +1,7 @@
const Discord = require("discord.js");
module.exports = {
name: "slowmode",
UserPerm: "MANAGE_CHANNELS",
UserPerms: ["MANAGE_CHANNELS"],
description: "Set slowmode at a specific channel",
BotPerm: "MANAGE_CHANNELS",
usage: "(Time)",

View file

@ -0,0 +1,43 @@
module.exports = {
name: "blacklist",
category: "Owner",
usage: "(User) (Toggle) (Reason)",
description: "Blacklist someone from the bot",
Owner: true,
options: [
{
type: 6,
name: "user",
description: "The user to blacklist/whitelist",
required: true,
},
{
type: 5,
name: "yesno",
description: "Whether blacklist or whitelist",
required: true,
},
{
type: 3,
name: "reason",
description: "The reason to blacklist",
required: true,
},
],
run: async (client, interaction, args) => {
let user = interaction.options.getUser("user");
toggle = interaction.options.getBoolean("yesno");
reason = interaction.options.getString("reason");
if (toggle === true) {
await client.data.BK(user.id, toggle, reason);
interaction.followUp({
content: `**Blacklisted** ${user.username}.\n**Reason: **${reason}`,
});
} else {
await client.data.BK(user.id, toggle, reason);
interaction.followUp({
content: `Removed blacklist from ${user.username}`,
});
}
},
};

View file

@ -0,0 +1,34 @@
module.exports = {
name: "emojiadd",
usage: "(Link) (Name)",
description: "Show an emoji URL or add the emoji to the server",
category: "Utilities",
UserPerm: ["MANAGE_EMOJIS_AND_STICKERS"],
BotPerm: ["MANAGE_EMOJIS_AND_STICKERS"],
options: [
{
type: 3,
name: "link",
description: "The link you want to add",
required: true,
},
{
type: 3,
name: "name",
description: "The emoji name you want to add",
required: true,
},
],
run: async (client, interaction, args) => {
try {
if (args[1].length < 2 || args[1].match(/\W/))
return client.serr(interaction, "Utilities", "emojiadd", 49);
interaction.guild.emojis.create(args[0], args[1]).then(msg => {
const em = interaction.guild.emojis.cache.find(a => a.name == args[1]);
interaction.followUp(`Added <:${em.name}:${em.id}> to the server`);
});
} catch (e) {
console.log(e);
}
},
};

129
command/Utilities/esnipe.js Normal file
View file

@ -0,0 +1,129 @@
const { MessageEmbed } = require("discord.js");
const moment = require("moment");
module.exports = {
name: "editsnipe",
description: "Snipes a edited message",
category: "Utilities",
options: [
{
type: 7,
name: "channel",
description: "The sniped channel",
required: true,
},
{
type: 4,
name: "message",
description: "The sniped message",
required: false,
},
],
run: async (client, interaction, args) => {
var i = 0;
var description = "";
const embed = new MessageEmbed()
.setAuthor(
`Sniped by ${interaction.user.tag}`,
interaction.user.displayAvatarURL({ dynamic: true })
)
.setColor(client.color)
.setFooter(`Made by ${client.author}`)
.setTimestamp()
.setURL(client.web);
const snipes = client.esnipes.get(args[0]) || [];
if (interaction.guild.channels.cache.get(args[0]).type !== "GUILD_TEXT")
interaction.followUp({ content: "Please provide a text channel" });
else if (args[1]) {
const msg = snipes[args[1] - 1];
if (!msg) {
snipes.forEach(m => {
const map = [];
for (var i = 0; i < m.attachment?.length; i++) {
map.push(
`**Attchment ${i + 1}:** [Click to view](${m.attachment[i]})`
);
}
if (m.author !== "No Author") {
description += `\n\n**Author:** ${m.author.username}#${
m.author.discriminator
} (Deleted ${moment(m.date).fromNow()})\n**ID:** ${
m.author.id
}\n**Old Content:** ${m.oldContent}\n**New Content:** ${
m.newContent
}\n${map ? map.join("\n") : ""}`;
i++;
} else {
description += `\n\n**Author:** None (Deleted ${moment(
m.date
).fromNow()})\n\n**Old Content:** ${
m.oldContent
}\n**New Content:** ${m.newContent}\n${map ? map.join("\n") : ""}`;
i++;
}
});
embed.setDescription(description);
return interaction.followUp({ embeds: [embed] });
} else {
const map = [];
for (var i = 0; i < msg.attachment?.length; i++) {
map.push(
`**Attchment ${i + 1}:** [Click to view](${msg.attachment[i]})`
);
}
if (msg.author !== "No Author") {
description += `\n\n**Author:** ${msg.author.username}#${
msg.author.discriminator
} (Deleted ${moment(msg.date).fromNow()})\n**ID:** ${
msg.author.id
}\n**Old Content:** ${m.oldContent}\n**New Content:** ${
m.newContent
}\n${map ? map.join("\n") : ""}`;
i++;
} else {
description += `\n\n**Author:** None (Deleted ${moment(
msg.date
).fromNow()})\n\n**Old Content:** ${m.oldContent}\n**New Content:** ${
m.newContent
}\n${map ? map.join("\n") : ""}`;
i++;
}
embed.setDescription(description);
return interaction.followUp({ embeds: [embed] });
}
} else {
if (!snipes.length) {
interaction.followUp({
content: "There isn't any snipe in this channel yet",
});
} else {
snipes.forEach(m => {
const map = [];
for (var i = 0; i < m.attachment?.length; i++) {
map.push(
`**Attchment ${i + 1}:** [Click to view](${m.attachment[i]})`
);
}
if (m.author !== "No Author") {
description += `\n\n**Author:** ${m.author.username}#${
m.author.discriminator
} (Deleted ${moment(m.date).fromNow()})\n**ID:** ${
m.author.id
}\n**Old Content:** ${m.oldContent}\n**New Content:** ${
m.newContent
}\n${map ? map.join("\n") : ""}`;
i++;
} else {
description += `\n\n**Author:** None (Deleted ${moment(
m.date
).fromNow()})\n\n**Old Content:** ${
m.oldContent
}\n**New Content:** ${m.newContent}\n${map ? map.join("\n") : ""}`;
i++;
}
});
embed.setDescription(description);
return interaction.followUp({ embeds: [embed] });
}
}
},
};

View file

@ -2,8 +2,22 @@ const { MessageEmbed } = require("discord.js");
const moment = require("moment");
module.exports = {
name: "snipe",
description: "Snipes a deleted message.",
description: "Snipes a deleted message",
category: "Utilities",
options: [
{
type: 7,
name: "channel",
description: "The sniped channel",
required: true,
},
{
type: 4,
name: "message",
description: "The sniped message",
required: false,
},
],
run: async (client, interaction, args) => {
var i = 0;
var description = "";
@ -14,95 +28,96 @@ module.exports = {
)
.setColor(client.color)
.setFooter(`Made by ${client.author}`)
.setTimestamp()
.setURL(client.web);
client.snipes.reverse().forEach(msg => {
if (msg.channel.id != interaction.channel.id) return;
if (i >= 5) return;
if (msg.attachment) {
if (msg.attachment.length == 1) {
if (msg.author !== "No Author") {
description =
description +
`\n\n**Author:** ${msg.author.username}#${
msg.author.discriminator
} (Deleted ${moment(msg.date).fromNow()})\n**ID:** ${
msg.author.id
}\n**Content:** ${
msg.content
}\n**Attachment URL:** [Click to view](${msg.attachment})`;
const snipes = client.snipes.get(args[0]) || [];
if (interaction.guild.channels.cache.get(args[0]).type !== "GUILD_TEXT")
interaction.followUp({ content: "Please provide a text channel" });
else if (args[1]) {
const msg = snipes[args[1] - 1];
if (!msg) {
snipes.forEach(m => {
const map = [];
for (var i = 0; i < m.attachment?.length; i++) {
map.push(
`**Attchment ${i + 1}:** [Click to view](${m.attachment[i]})`
);
}
if (m.author !== "No Author") {
description += `\n\n**Author:** ${m.author.username}#${
m.author.discriminator
} (Deleted ${moment(m.date).fromNow()})\n**ID:** ${
m.author.id
}\n**Content:** ${m.content}\n${map ? map.join("\n") : ""}`;
i++;
} else
description =
description +
`\n\n**Author:** None (Deleted ${moment(
msg.date
).fromNow()})\n\n**Content:** ${
msg.content
}\n**Attachment URL:** [Click to view](${msg.attachment})`;
i++;
} else if (msg.attachment.length > 1) {
const map = msg.attachment.map(
(s, i) => `**${i + 1}:** [Click to view](${s})`
);
if (msg.author !== "No Author") {
description += `\n\n**Author:** ${msg.author.username}#${
msg.author.discriminator
} (Deleted ${moment(msg.date).fromNow()})\n**ID:** ${
msg.author.id
}\n**Content:** ${msg.content}\n**Attachment URLs:** \n${map.join(
"\n"
)}`;
i++;
} else
} else {
description += `\n\n**Author:** None (Deleted ${moment(
msg.date
).fromNow()})\\n**Content:** ${
msg.content
}\n**Attachment URLs:** \n${map.join("\n")}`;
m.date
).fromNow()})\n\n**Content:** ${m.content}\n${
map ? map.join("\n") : ""
}`;
i++;
}
});
embed.setDescription(description);
return interaction.followUp({ embeds: [embed] });
} else {
const map = [];
for (var i = 0; i < msg.attachment?.length; i++) {
map.push(
`**Attchment ${i + 1}:** [Click to view](${msg.attachment[i]})`
);
}
if (msg.author !== "No Author") {
description += `\n\n**Author:** ${msg.author.username}#${
msg.author.discriminator
} (Deleted ${moment(msg.date).fromNow()})\n**ID:** ${
msg.author.id
}\n**Content:** ${msg.content}\n${map ? map.join("\n") : ""}`;
i++;
} else {
if (msg.author !== "No Author") {
description =
description +
`\n\n**Author:** ${msg.author.username}#${
msg.author.discriminator
} (Deleted ${moment(msg.date).fromNow()})\n**ID:** ${
msg.author.id
}\n**Content:** ${msg.content}`;
i++;
} else
description =
description +
`\n\n**Author:** None (Deleted ${moment(
msg.date
).fromNow()})\n\n**Content:** ${msg.content}`;
description += `\n\n**Author:** None (Deleted ${moment(
msg.date
).fromNow()})\n\n**Content:** ${msg.content}\n${
map ? map.join("\n") : ""
}`;
i++;
}
} else {
if (msg.author !== "No Author") {
description =
description +
`\n\n**Author:** ${msg.author.username}#${
msg.author.discriminator
} (Deleted ${moment(msg.date).fromNow()})\n**ID:** ${
msg.author.id
}\n**Content:** ${msg.content}`;
i++;
} else
description =
description +
`\n\n**Author:** None (Deleted ${moment(
msg.date
).fromNow()})\n\n**Content:** ${msg.content}`;
i++;
embed.setDescription(description);
return interaction.followUp({ embeds: [embed] });
}
});
if (i == 0)
return await interaction.followUp({
content: "There isn't any snipe in this server yet",
});
embed.setDescription(description);
embed.setTimestamp();
return await interaction.followUp({ embeds: [embed] });
} else {
if (!snipes.length) {
interaction.followUp({
content: "There isn't any snipe in this channel yet",
});
} else {
snipes.forEach(m => {
const map = [];
for (var i = 0; i < m.attachment?.length; i++) {
map.push(
`**Attchment ${i + 1}:** [Click to view](${m.attachment[i]})`
);
}
if (m.author !== "No Author") {
description += `\n\n**Author:** ${m.author.username}#${
m.author.discriminator
} (Deleted ${moment(m.date).fromNow()})\n**ID:** ${
m.author.id
}\n**Content:** ${m.content}\n${map ? map.join("\n") : ""}`;
i++;
} else {
description += `\n\n**Author:** None (Deleted ${moment(
m.date
).fromNow()})\n\n**Content:** ${m.content}\n${
map ? map.join("\n") : ""
}`;
i++;
}
});
embed.setDescription(description);
return interaction.followUp({ embeds: [embed] });
}
}
},
};

View file

@ -1,37 +0,0 @@
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) => {
message.channel
.send({ content: "**Do you want to reset your prefix?**" })
.then(async msg => {
const emoji = await utils.confirmation(
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}**`,
});
}
if (emoji === "❌") {
msg.delete();
message.channel.send({ content: "Cancelled." });
}
});
},
};

View file

@ -1,32 +0,0 @@
const { Client, Message, MessageEmbed } = require("discord.js");
const schema = require("../../models/guilds");
module.exports = {
name: "prefix",
usage: "(Prefix)",
description: "Set the prefix at the server",
UserPerm: "ADMINISTRATOR",
category: "Config",
run: async (client, message, args) => {
const res = args.join(" ");
if (!res) return client.err(message, "Config", "prefix", 46);
schema.findOne({ Guild: message.guild.id }, async (err, data) => {
if (err) throw err;
if (data) {
schema.findOne({ Guild: message.guild.id }, async (err, data) => {
data.Prefix = res;
await schema.findOneAndUpdate({ Guild: message.guild.id }, data);
});
message.channel.send(`Your prefix has been updated to **${res}**`);
} else {
data = new schema({
Guild: message.guild.id,
Prefix: res,
});
data.save();
message.channel.send(
`Custom prefix in this server is now set to **${res}**`
);
}
});
},
};

View file

@ -1,58 +0,0 @@
const { Client, Message, MessageEmbed } = require("discord.js");
module.exports = {
name: "premiumserveradd",
category: "Config",
timeout: 1000 * 60,
aliases: ["psadd", "psa", "premiumserver"],
description: "Add premium to a server",
Premium: true,
run: async (client, message, args) => {
try {
const user = await client.data.getUser(message.author.id);
const guild = await client.data.getGuild(message.guild.id);
if (guild.Premium == true) {
return client.err(message, "Config", "premium", 506);
}
if (
(user.Tier == 1 && user.PremiumServers.length >= 5) ||
(user.Tier == 2 && user.PremiumServers.length >= 2) ||
(user.Tier == 3 && user.PremiumServers.length >= 0)
) {
return client.err(message, "Config", "premium", 505);
}
await client.data.setPremium(message.guild.id, "true");
await client.data.pushGuild(message.author.id, message.guild.id, "push");
message.channel.send(
new MessageEmbed()
.setTitle("Success!")
.setDescription(`Premium added to **${message.guild.name}**! \n`)
.setFooter("Thank you for supporting Cath!")
.setColor("GREEN")
.setTimestamp()
.setAuthor(
message.author.tag,
message.author.displayAvatarURL({ dynamic: true })
)
);
client.ServerLog.send(
new MessageEmbed()
.setTitle("New Premium Server")
.addField("Server Info", [
`**>Server Name**: \n${message.guild.name}`,
`**>Server ID**: \n${message.guild.id}`,
`**>Server Member Count**: \n${message.guild.memberCount}`,
])
.addField("Owner Info", [
`**>Owner Tag**: \n${message.guild.owner.user.tag}`,
`**>Owner ID**: \n${message.guild.owner.id}`,
])
.setTimestamp()
.setThumbnail(message.guild.iconURL({ dynamic: true }))
.setColor("GREEN")
);
} catch (e) {
console.log(e);
return client.err(message, "Config", "premium", 999);
}
},
};

View file

@ -1,55 +0,0 @@
const { Client, Message, MessageEmbed } = require("discord.js");
module.exports = {
name: "set",
description: "Set Goodbye/Welcome/Log Channel for the server",
usage: "(goodbye/welcome/log) (#Channel)",
UserPerm: "ADMINISTRATOR",
category: "Config",
run: async (client, message, args) => {
if (!args[0]) return client.err(message, "Config", "set", 45);
if (args[0].toLowerCase() === "goodbye") {
const channel = message.mentions.channels.first();
if (!channel) return client.err(message, "Config", "set", 28);
await client.data.setGoodbye(message.guild.id, channel.id);
message.channel.send(`Saved ${channel} as the goodbye channel.`);
} else if (args[0].toLowerCase() === "log") {
const channel = message.mentions.channels.first();
if (!channel) return client.err(message, "Config", "set", 28);
let webhookid;
let webhooktoken;
await channel
.createWebhook(message.guild.name, {
avatar: message.guild.iconURL({ format: "png" }),
})
.then(webhook => {
webhookid = webhook.id;
webhooktoken = webhook.token;
});
await client.data.setLog(
message.guild.id,
channel.id,
webhookid,
webhooktoken
);
message.channel.send(`Saved ${channel} as the log channel.`);
} else if (args[0].toLowerCase() === "welcome") {
const channel = message.mentions.channels.first();
if (!channel) return client.err(message, "Config", "set", 28);
await client.data.setWelcome(message.guild.id, channel.id);
message.channel.send(`Saved ${channel} as the welcome channel.`);
} else if (args[0].toLowerCase() === "level") {
if (args[1].toLowerCase() === "on" || args[1].toLowerCase() === "true") {
await client.data.setGLevel(message.guild.id, "true");
message.channel.send(`Levelling is enabled in this server now.`);
} else if (
args[1].toLowerCase() === "off" ||
args[1].toLowerCase() === "false"
) {
await client.data.setGLevel(message.guild.id, "false");
message.channel.send(`Levelling is disabled in this server now.`);
} else return client.err(message, "Config", "set", 45);
} else {
return client.err(message, "Config", "set", 45);
}
},
};

View file

@ -1,35 +0,0 @@
const { Client, Message, MessageEmbed } = require("discord.js");
module.exports = {
name: "drop",
usage: "{Channel} (Number)",
description: "Drops money to a channel",
category: "Economy",
run: async (client, message, args) => {
const p = await client.prefix(message);
const channel = message.mentions.channels.first() || message.channel;
const coinsAmount = args[0];
if (!coinsAmount) {
return client.err(message, "Economy", "drop", 5);
}
if ((await client.bal(message.author.id)) < coinsAmount) {
return client.err(message, "Economy", "drop", 20);
}
const filter = msg =>
msg.guild.id === message.guild.id && msg.content === `${p}claim`;
message.channel.send("The drop has started in " + channel.toString());
channel.send(
`${message.author.username} has dropped a ${client.currency} bomb! Use ${p}claim to claim ${client.currency}!!`
);
client.rmv(message.author.id, parseInt(coinsAmount));
channel.awaitMessages(filter, { max: 1, time: 60000 }).then(async msg => {
const id = msg.first().author.id;
const coinsToClaim = parseInt(coinsAmount);
await client.add(id, coinsToClaim, message);
msg
.first()
.reply(
`Congratultions! You have claimed **${coinsToClaim}** ${client.currency}!`
);
});
},
};

View file

@ -1,40 +0,0 @@
const { Client, Message, MessageEmbed } = require("discord.js");
module.exports = {
name: "announce",
UserPerm: "MANAGE_MESSAGES",
BotPerm: "MANAGE_MESSAGES",
usage: "{Channel} (Message)",
description: "Announce a message to a channel.",
category: "Moderation",
run: async (client, message, args) => {
const channel = message.mentions.channels.first() || message.channel;
if (!args[0]) return client.err(message, "Moderation", "announce", 4);
try {
message.delete();
channel.send(
new MessageEmbed()
.setAuthor(
`Sent by ${message.member.displayName}`,
message.author.displayAvatarURL({ dynamic: true })
)
.setDescription(args.slice(0).join(" "))
.setTimestamp()
.setColor(client.color)
);
message.reply(
new MessageEmbed()
.setTitle(`Message Announced`)
.addField("**Moderator**", message.author.tag, true)
.setTimestamp()
.setFooter(
message.member.displayName,
message.author.displayAvatarURL({ dynamic: true })
)
.setColor(client.color)
);
} catch (e) {
console.log(e);
return client.err(message, "Moderation", "announce", 999);
}
},
};

View file

@ -1,42 +0,0 @@
const { Client, Message, MessageEmbed } = require("discord.js");
const ms = require("ms");
module.exports = {
name: "purge",
aliases: ["clear", "c"],
UserPerm: "MANAGE_MESSAGES",
BotPerm: "MANAGE_MESSAGES",
description: "Clear/Purge 1-100 messages in the channel",
usage: "(Number)",
category: "Moderation",
run: async (client, message, args) => {
if (
!args[0] ||
isNaN(args[0]) ||
parseInt(args[0]) > 100 ||
parseInt(args[0] < 0)
)
return client.err(message, "Moderation", "clear", 7);
const messages = await message.channel.messages.fetch({
limit: parseInt(args[0]),
});
const usable = messages.filter(
m => m.createdTimestamp - Date.now() < ms("14d") && !m.pinned
);
await message.delete();
await message.channel.bulkDelete(usable).then(() =>
message.channel
.send(
new MessageEmbed()
.setTitle(`Message Cleared`)
.addField("**Moderator**", message.author.tag, true)
.setTimestamp()
.setFooter(
message.member.displayName,
message.author.displayAvatarURL({ dynamic: true })
)
.setColor(client.color)
)
.then(m => m.delete({ timeout: 10000 }))
);
},
};

View file

@ -1,26 +0,0 @@
const { Client, Message, MessageEmbed } = require("discord.js");
module.exports = {
name: "bk",
category: "Owner",
usage: "(User) (Toggle) (Reason)",
description: "Blacklist someone from the bot",
Owner: true,
run: async (client, message, args) => {
let user = args[0];
toggle = args[1];
reason = args.slice(2).join(" ");
if (toggle === "true") {
await client.data.BK(user, toggle, reason);
message.reply(
`**Blacklisted** ${message.guild.members.cache.get(
user
)}.\n**Reason: **${reason}`
);
} else {
await client.data.BK(user, toggle, reason);
message.reply(
`Removed blacklist from ${message.guild.members.cache.get(user)}`
);
}
},
};

View file

@ -1,4 +1,4 @@
const { Client, Message, MessageEmbed } = require("discord.js");
const { MessageEmbed } = require("discord.js");
module.exports = {
name: "info",
Owner: true,
@ -9,102 +9,8 @@ module.exports = {
message.guild.iconURL({ dynamic: true, size: 4096 })
)
.setColor(client.color)
.addFields(
{
name: "<@&840539971068755989>",
value: "The Server Owner",
inline: false,
},
{
name: "<@&827182913002012694>",
value: "🤐",
inline: true,
},
{
name: "<@&765928569397575750>",
value: "The unpingable ones",
inline: true,
},
{
name: "<@&854306717977935882>",
value: "The Server Owner's Bots",
inline: true,
},
{
name: "<@&832145795523280907>",
value: "The unpingable ones",
inline: true,
},
{
name: "<@&756805977298305135>",
value: "The ones who can control the server",
inline: true,
},
{
name: "<@&840537065984491531>",
value: "Premium users of Cath",
inline: true,
},
{
name: "<@&856223068782723093>",
value: "The developers and the helpers of Cath",
inline: true,
},
{
name: "<@&836279963069710336>",
value: "VIPs of this server. Chosen by the server owner",
inline: true,
},
{
name: "<@&807976942066204674>",
value: "Partner of Cath or the server",
inline: true,
},
{
name: "<@&828273514497835059>",
value: "The wealthy ones",
inline: true,
},
{
name: "<@&756805886244028427>",
value: "Old VIPs",
inline: true,
},
{
name: "<@&749676662098100235>",
value: "Maybe useful for the server",
inline: true,
},
{
name: "<@&840536973126270976>",
value: "Platium camo color",
inline: true,
},
{
name: "<@&841200768706543636>",
value: "Gold camo color",
inline: true,
},
{
name: "<@&841026716181069824>",
value: "Receive announcements",
inline: true,
},
{
name: "<@&841200845885538325>",
value: "Recevie updates for Cath(s)",
inline: true,
},
{
name: "<@&841026772790673448>",
value: "Recevie updates for Night's YouTube",
inline: true,
},
{
name: "<@&840926118617809006>",
value: "People who are bad",
inline: true,
}
.setDescription(
"<@&840539971068755989>\nThe Server Owner\n<@&765928569397575750>\nThe unpingable ones\n<@&854306717977935882>\nThe Server Owner's Bots\n<@&832145795523280907>\nThe unpingable ones\n<@&756805977298305135>\nThe ones who can control the server\n<@&840537065984491531>\nPremium users of Cath\n<@&856223068782723093>\nThe developers and the helpers of Cath\n<@&836279963069710336>\nVIPs of this server. Chosen by the server owner\n<@&807976942066204674>\nPartner of Cath or the server\n<@&828273514497835059>\nThe wealthy ones\n<@&756805886244028427>\nOld VIPs\n<@&749676662098100235>\nMaybe useful for the server\n<@&840536973126270976>\nPlatium camo color\n<@&841200768706543636>\nGold camo color\n<@&841026716181069824>\nReceive announcements\n<@&841200845885538325>\nRecevie updates for Cath(s)\n<@&841026772790673448>\nRecevie updates for Night's YouTube\n<@&840926118617809006>\nPeople who are bad"
)
.setThumbnail(client.user.displayAvatarURL())
.setURL(client.web)

View file

@ -1,20 +0,0 @@
const { MessageEmbed } = require("discord.js");
module.exports = {
name: "setavatar",
category: "Owner",
usage: "(Link)",
description: "Set bot avatar from a link",
Owner: true,
run: async (client, message, args) => {
if (message.deletable) {
message.delete();
}
if (!args || args.length < 1) {
return client.err(message, "Owner", "setBotAvatar", 404);
}
client.user.setAvatar(args.join(" "));
message.channel
.send("Profile picture has been changed.")
.then(m => m.delete({ timeout: 10000 }));
},
};

View file

@ -1,22 +0,0 @@
const { Client, Message, MessageEmbed } = require("discord.js");
module.exports = {
name: "status",
usage: "(Boolean)",
description: "Maintenance mode",
category: "Owner",
Owner: true,
run: async (client, message, args) => {
if (!args[0]) return message.channel.send("True or False?");
if (args[0].toLowerCase() === "true") {
await client.data.maintenance(client.user.id, "true");
message.channel.send(
`**${client.user.username}** is under maintenance now`
);
} else if (args[0].toLowerCase() === "false") {
await client.data.maintenance(client.user.id, "false");
message.channel.send(`**${client.user.username}** back online`);
} else {
message.channel.send("True or False?");
}
},
};

View file

@ -1,59 +0,0 @@
const { Client, Message, MessageEmbed, Util } = require("discord.js");
module.exports = {
name: "emojiadd",
usage: "(Link/Photo) (Name)",
aliases: ["addemoji"],
description: "Show an emoji URL or add the emoji to the server",
category: "Utilities",
run: async (client, message, args) => {
if (!args.length) return client.err(message, "Utilities", "emojiadd", 0);
if (message.attachments) {
message.attachments.map(m => {
if (
m.name.endsWith(".png") ||
m.name.endsWith(".jpeg") ||
m.name.endsWith(".jpeg") ||
m.name.endsWith(".gif") ||
m.name.endsWith(".webp")
) {
try {
if (message.attachments.map(u => u.size) > 256000)
return client.err(message, "Utilities", "emojiadd", 50);
if (args[0].length < 2 || args[0].match(/\W/))
return client.err(message, "Utilities", "emojiadd", 49);
message.attachments.map(u => {
try {
message.guild.emojis.create(u.url, args[0]).then(msg => {
const em = message.guild.emojis.cache.find(
a => a.name == args[0]
);
message.reply(`Added <:${em.name}:${em.id}> to the server`);
});
} catch (e) {
console.log(e);
return client.err(message, "Utilities", "emojiadd", 999);
}
});
} catch (e) {
console.log(e);
return client.err(message, "Utilities", "emojiadd", 999);
}
} else return client.err(message, "Utilities", "emojiadd", 48);
});
}
if (args[0].includes("https")) {
try {
if (args[1].length < 2 || args[1].match(/\W/))
return client.err(message, "Utilities", "emojiadd", 49);
message.guild.emojis.create(args[0], args[1]).then(msg => {
const em = message.guild.emojis.cache.find(a => a.name == args[1]);
message.reply(`Added <:${em.name}:${em.id}> to the server`);
});
} catch (e) {
console.log(e);
return client.err(message, "Utilities", "emojiadd", 999);
}
} else return client.err(message, "Utilities", "emojiadd", 101);
},
};

View file

@ -1,157 +0,0 @@
const { Client, Message, MessageEmbed } = require("discord.js");
const moment = require("moment");
module.exports = {
name: "editsnipe",
category: "Utilities",
aliases: ["esnipe"],
usage: "{Channel}",
description: "Snipe an edited message",
run: async (client, message, args) => {
let channel =
message.mentions.channels.first() ||
message.guild.channels.cache.get(args[0]) ||
message.channel,
snipes = client.esnipes.get(channel.id),
page = 0,
reactions = ["◀️", "⏪", "⏩", "▶️"];
if (!snipes)
return message.reply(
`No snipes have been found for the channel \`${channel.name}\``
);
let users = await Promise.all(
snipes.map(snipe =>
client.users.fetch(
snipe.author === "No author found??" ? client.user.id : snipe.author
)
)
);
if (args[0] === "--history") {
let embed = new MessageEmbed()
.addField("Channel:", `${channel} (${channel.name})`)
.addField(
"History",
`${
snipes.length > 20
? `${snipes
.map(
(snipe, c) =>
`${users[c].tag} | ${moment
.utc(snipe.date)
.fromNow()} | snipe **${c + 1}**`
)
.slice(0, 20)
.join("\n")}\n ${snipes.length - 20} more...`
: `${snipes
.map(
(snipe, c) =>
`${users[c].tag} | ${moment
.utc(snipe.date)
.fromNow()} | snipe **${c + 1}**`
)
.slice(0, 20)
.join("\n")}`
}`
);
let msg = await message.channel.send(embed);
await Promise.all(reactions.map(r => msg.react(r)));
const backwardsFilter = (reaction, user) =>
user.id === message.author.id &&
reactions.includes(reaction.emoji.name);
const backwards = msg.createReactionCollector(backwardsFilter);
backwards.on("collect", r => {
switch (r.emoji.name) {
case "⏪":
page = 0;
break;
case "⏩":
page = snipes.length;
break;
case "◀️":
page === 1
? (page = 0)
: page === 0
? (page = snipes.length)
: page--;
break;
case "▶️":
page === snipes.length ? (page = 1) : page++;
break;
}
if (page === 0) {
let embed = new MessageEmbed()
.addField("Channel:", `${channel} (${channel.name})`)
.addField(
"History",
`${snipes.length
.map(
(snipe, c) =>
`${users[c].tag} | ${moment
.utc(snipe.date)
.fromNow()} | snipe **${c + 1}**`
)
.slice(0, 20)
.join("\n")}`
);
msg.edit(embed);
} else {
let newembed = new MessageEmbed()
.setAuthor(
`${client.users.cache.get(snipes[page - 1].author).tag}`,
`${client.users.cache
.get(snipes[page - 1].author)
.displayAvatarURL({ format: "png", dynamic: true })}`
)
.addField("Channel:", `${channel} (${channel.name})`)
.addField("When:", `${moment.utc(snipes[page - 1].date).fromNow()}`)
.addField(
"Content:",
snipes[page - 1].content || "No content could be found"
)
.addField(
"New content:",
snipes[page - 1].newContent || "No new content could be found"
)
.setFooter(`${page}/${snipes.length}`);
snipes[page - 1].image !== null
? newembed.setImage(snipes[page - 1].image)
: "";
msg.edit(newembed);
}
});
} else {
let num = isNaN(args[0])
? 0
: !args[0]
? 0
: args[0] < snipes.length && args[0] > 0
? args[0]
: 0;
let embed = new MessageEmbed()
.setAuthor(
`${
client.users.cache.get(snipes[num].author)
? client.users.cache.get(snipes[num].author).tag
: "no"
}`,
`${client.users.cache
.get(snipes[num].author)
.displayAvatarURL({ format: "png", dynamic: true })}`
)
.addField("Channel:", `${channel} (${channel.name})`)
.addField("When:", `${moment.utc(snipes[num].date).fromNow()}`)
.addField(
"Content:",
snipes[num].content || "No content could be found"
)
.addField(
"New content:",
snipes[num].newContent || "No new content could be found"
)
.setFooter(`Showing snipe ${parseInt(num) + 1}`);
snipes[0].image !== null ? embed.setImage(snipes[num].image) : "";
await message.channel.send(embed);
}
},
};

View file

@ -1,6 +1,4 @@
const Discord = require("discord.js");
const { readdirSync } = require("fs");
module.exports = {
name: "help",
aliases: ["h"],

View file

@ -58,6 +58,6 @@ client.prefix = async function (message) {
.findOne({ Guild: message.guild.id })
.catch(err => console.log(err));
if (data) custom = data.Prefix;
else custom = client.configprefix;
else custom = client.config.prefix;
return custom;
};

View file

@ -1,5 +1,6 @@
const client = require("../bot");
const utils = require("../util/functions/function");
const codmclient = require("../client/CODMClient");
client.on("interactionCreate", async interaction => {
if (interaction.isCommand()) {
await interaction.deferReply({ ephemeral: false }).catch(() => {});
@ -17,10 +18,68 @@ client.on("interactionCreate", async interaction => {
interaction.member = interaction.guild.members.cache.get(
interaction.user.id
);
if (!interaction.member.permissions.has(cmd.userPerms || []))
return await interaction.followUp({ content: "no perm" });
const data = {};
let guildDB = await client.data.getGuild(interaction.guild.id);
if (!guildDB) return;
let userDB = await client.data.getUser(interaction.user.id);
if (!userDB) return;
let userEconDB = await client.data.getUserEcon(interaction.user.id);
data.Guild = guildDB;
data.User = userDB;
data.UserEcon = userEconDB;
if (!guildDB) await client.data.CreateGuild(interaction.guild.id);
if (!userEconDB) await client.createProfile(interaction.user.id);
try {
cmd.run(client, interaction, args, utils);
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 MessageEmbed()
.setURL(client.web)
.setAuthor(
interaction.user.tag,
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(`Made by ${client.author}`),
],
});
}
}
if (cmd.Level) {
if (!data.Guild.Level) return;
}
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) {
if (data.Guild.Category) {
if (data.Guild.Category.includes(cmd.directory)) return;
}
if (data.Guild.Commands) {
if (data.Guild.Commands.includes(cmd.name)) return;
}
}
cmd.run(client, interaction, args, utils, codmclient);
client.channels.cache.get(client.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})\``,
});
@ -52,10 +111,8 @@ client.on("interactionCreate", async interaction => {
interaction.member = interaction.guild.members.cache.get(
interaction.user.id
);
if (!interaction.member.permissions.has(ownercmd.userPerms || []))
return await interaction.followUp({ content: "no perm" });
try {
ownercmd.run(client, interaction, args, utils);
ownercmd.run(client, interaction, args, utils, codmclient);
client.channels.cache.get(client.CMDLog).send({
content: `\`${interaction.user.tag}(${interaction.user.id})\`\n has used \n**${ownercmd.name}**\n command in \n\`${interaction.guild.name}(${interaction.guild.id})\``,
});

View file

@ -1,5 +1,5 @@
const client = require("../bot");
const codmclient = require("../client/codmclient");
const codmclient = require("../client/CODMClient");
const leven = require("leven");
const { MessageEmbed } = require("discord.js");
const cooldown = require("../models/cooldown");
@ -107,9 +107,6 @@ client.on("messageCreate", async message => {
return message.reply({
content: `You can't use this command. I need to have ${command.BotPerm} permission to use this command.`,
});
client.channels.cache.get(client.CMDLog).send({
content: `\`${message.author.tag}(${message.author.id})\`\n has used \n**${command.name}**\n command in \n\`${message.guild.name}(${message.guild.id})\``,
});
if (data.Guild) {
if (data.Guild.Category) {
if (data.Guild.Category.includes(command.directory)) return;

View file

@ -2,30 +2,26 @@ const client = require("../bot");
client.on("messageDelete", async message => {
let all = [];
if (message.attachments) {
const mapped = message.attachments.map(a => {
if (
a.name.endsWith(".png") ||
a.name.endsWith(".jpg") ||
a.name.endsWith(".jpeg") ||
a.name.endsWith(".gif") ||
a.name.endsWith(".webp")
)
return message.attachments.first().proxyURL;
else return message.attachments.first().url;
});
if (mapped.length == 1) {
all.push(mapped);
} else if (mapped.length > 1) {
message.attachments.map(b => {
all.push(mapped);
});
const files = message.attachments.map(e => e);
for (var i = 0; i < files.length; i++) {
const file = files[i];
all.push(file.url);
}
}
client.snipes.push({
if (message.embeds) {
for (var i = 0; i < message.embeds.length; i++) {
const files = message.embeds.map(e => e.image?.url);
all.push(files);
}
}
const snipes = client.snipes.get(message.channel.id) || [];
snipes.push({
channel: message.channel,
content: message.content ? message.content : "None",
author: message.author ? message.author : "No Author",
attachment: message.attachments ? all : null,
date: new Date(),
});
snipes.splice(10);
client.snipes.set(message.channel.id, snipes);
});

View file

@ -1,69 +1,28 @@
const client = require("../bot");
client.on("messageUpdate", (message, newMessage) => {
function getAllTextFromEmbed(embed) {
let text = "";
function getTime(now) {
const date = new Date(now);
const escape = value => `0${value}`.slice(-2);
const ampm = date.getHours() >= 12 ? "PM" : "AM";
return `${date.getMonth()}/${date.getDate()}/${date.getFullYear()} at ${escape(
date.getHours()
)}:${escape(date.getMinutes())}:${escape(date.getSeconds())}${ampm}`;
client.on("messageUpdate", async (message, newMessage) => {
let all = [];
if (message.attachments) {
const files = message.attachments.map(e => e);
for (var i = 0; i < files.length; i++) {
const file = files[i];
all.push(file.url);
}
if (embed.title)
text += `**${embed.title
.replace(/(https?:\/\/)?discord\.gg\/(\w+)/g, "Invite")
.replace(/\[(.*)\]\((.*)\)/g, "Hyper link")}**`;
if (embed.description)
text += `\n${embed.description
.replace(/(https?:\/\/)?discord\.gg\/(\w+)/g, "Invite")
.replace(/\[(.*)\]\((.*)\)/g, "Hyper link")}`;
if (embed.fields) {
text += "\n";
for (const field of embed.fields)
text += `\n**${field.name
.replace(/(https?:\/\/)?discord\.gg\/(\w+)/g, "Invite")
.replace(/\[(.*)\]\((.*)\)/g, "Hyper link")}**\n ${field.value
.replace(/(https?:\/\/)?discord\.gg\/(\w+)/g, "Invite")
.replace(/\[(.*)\]\((.*)\)/g, "Hyper link")}`;
}
if (embed.footer) {
let field = `\n\n**${embed.footer.text
.replace(/(https?:\/\/)?discord\.gg\/(\w+)/g, "Invite")
.replace(/\[(.*)\]\((.*)\)/g, "Hyper link")}`;
if (embed.timestamp) {
const time =
embed.timestamp instanceof Date
? getTime(embed.timestamp.getTime())
: embed.timestamp;
field += `at ${time}`;
}
text += `${field}**`;
}
return text;
}
let snipes = client.esnipes.get(message.channel.id) || [];
snipes.unshift({
content:
message.embeds.length > 0
? getAllTextFromEmbed(message.embeds[0])
: message.content,
newContent:
newMessage.embeds.length > 0
? getAllTextFromEmbed(newMessage.embeds[0])
: newMessage.content,
author: message.author ? message.author.id : "No author found??",
image: message.attachments.first()
? message.attachments.first().proxyURL
: message.embeds.length > 0 && message.embeds[0].image
? message.embeds[0].image.url
: "",
date: Date.now(),
if (message.embeds) {
for (var i = 0; i < message.embeds.length; i++) {
const files = message.embeds.map(e => e.image?.url);
all.push(files);
}
}
const esnipes = client.esnipes.get(message.channel.id) || [];
esnipes.push({
channel: message.channel,
oldContent: message.content ? message.content : "None",
newContent: newMessage.content ? newMessage.content : "None",
author: message.author ? message.author : "No Author",
attachment: message.attachments ? all : null,
date: new Date(),
});
client.esnipes.set(message.channel.id, snipes);
esnipes.splice(10);
client.esnipes.set(message.channel.id, esnipes);
});

View file

@ -1,6 +1,17 @@
const client = require("../bot");
const version = require("../package.json").version;
const starboardClient = require("../client/StarboardClient");
const g = require("../models/guilds");
client.on("ready", async () => {
client.manager.init(client.user.id);
const data = await g.find();
starboardClient.config.guilds.set(
data.map(x => {
return {
id: x.Guild,
options: { starCount: x.StarCount, starboardChannel: x.Starboard },
};
})
);
console.log(`${client.user.username}\nVersion: v${version}`);
});

View file

@ -1,83 +1,8 @@
const client = require("../bot");
const { MessageEmbed } = require("discord.js");
const starboardclient = require("../client/StarboardClient");
client.on("messageReactionAdd", async (reaction, user) => {
const star = async () => {
const starch = reaction.message.guild.channels.cache.find(
n => n.name.toLowerCase() === "starboard"
);
const msgs = await starch.messages.fetch({ limit: 100 });
const here = msgs.find(msg =>
msg.embeds.length === 1
? msg.embeds[0].footer.text.startsWith(reaction.message.id)
? true
: false
: false
);
if (here) here.edit(`${reaction.count} - ⭐`);
else {
const embed = new MessageEmbed()
.setColor(client.color)
.setTitle(
`From ${reaction.message.author.tag}`,
reaction.message.author.displayAvatarURL({ dynamic: true })
)
.setThumbnail(
reaction.message.author.displayAvatarURL({ dynamic: true })
)
.addField(`Message`, `[Jump!](${reaction.message.url})`)
.setDescription(
`Content: ${
reaction.message.content ? reaction.message.content : "None"
}`
)
.setImage(
reaction.message.attachments.length
? reaction.message.attachments.first().url
: null
)
.setFooter(`${reaction.message.id}`)
.setTimestamp(reaction.message.createdTimestamp);
if (starch) {
starch.send({ content: "1 - ⭐", embeds: [embed] });
}
}
};
if (reaction.emoji.name === "⭐") {
if (reaction.message.channel.name.toLowerCase() === "starboard") return;
if (reaction.message.partial) {
await reaction.fetch();
await reaction.message.fetch();
star();
} else star();
}
starboardclient.listener(reaction);
});
client.on("messageReactionRemove", async (reaction, user) => {
const star = async () => {
const starch = reaction.message.guild.channels.cache.find(
n => n.name.toLowerCase() === "starboard"
);
const msgs = await starch.messages.fetch({ limit: 100 });
const here = msgs.find(msg =>
msg.embeds.length === 1
? msg.embeds[0].footer.text.startsWith(reaction.message.id)
? true
: false
: false
);
if (here) {
if (reaction.count === 0) {
setTimeout(function () {
here.delete();
}, 5000);
} else here.edit(`${reaction.count} - ⭐`);
}
};
if (reaction.emoji.name === "⭐") {
if (reaction.message.channel.name.toLowerCase() === "starboard") return;
if (reaction.message.partial) {
await reaction.fetch();
await reaction.message.fetch();
star();
} else star();
}
client.on("messageReactionRemove", async reaction => {
starboardclient.listener(reaction);
});

11
events/typingStart.js Normal file
View file

@ -0,0 +1,11 @@
const client = require("../bot");
client.on("typingStart", async typing => {
if (!typing.user) return;
if (typing.user.bot) return;
if (!typing.channel) return;
if (typing.channel.type !== "DM") return;
typing.user.send({
content:
"```DMs is reserved for bug reports/suggestions/feedbacks/queries and is forwarded to the developers. Please refrain from using it as a clipboard or trying to run commands in here [by violating this condition, you agree to let us sell your data]```",
});
});

View file

@ -1,11 +0,0 @@
const mongoose = require("mongoose");
module.exports = mongoose.model(
"custom-commands",
new mongoose.Schema({
Guild: String,
Command: String,
Response: Array,
Delete: Boolean,
Random: Boolean,
})
);

View file

@ -19,6 +19,22 @@ module.exports = mongoose.model(
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,

View file

@ -1,11 +0,0 @@
const mongoose = require("mongoose");
module.exports = mongoose.model(
"modmail",
new mongoose.Schema({
Guild: String,
Category: String,
Choices: Object,
Role: String,
})
);

View file

@ -1,10 +0,0 @@
const mongoose = require("mongoose");
module.exports = mongoose.model(
"reaction-roles",
new mongoose.Schema({
Guild: String,
Message: String,
Roles: Object,
})
);

View file

@ -1,5 +1,5 @@
const client = require("../bot");
const codmclient = require("../client/codmclient");
const codmclient = require("../client/CODMClient");
const leven = require("leven");
const { MessageEmbed } = require("discord.js");
const schema = require("../unused/models/custom-commands");

View file

@ -1,4 +1,4 @@
const client = require("../bot");
const client = require("../../bot");
const Schema = require("../models/reaction");
client.on("messageReactionAdd", async (reaction, user) => {

File diff suppressed because one or more lines are too long

View file

@ -1,44 +0,0 @@
const { readdirSync } = require("fs");
module.exports = client => {
readdirSync("./commands/").forEach(dir => {
const commands = readdirSync(`./commands/${dir}/`).filter(file =>
file.endsWith(".js")
);
for (let file of commands) {
let pull = require(`../commands/${dir}/${file}`);
if (pull.name) {
client.commands.set(pull.name, pull);
} else {
continue;
}
if (pull.aliases && Array.isArray(pull.aliases))
pull.aliases.forEach(alias => client.aliases.set(alias, pull.name));
}
});
readdirSync("./cat/").forEach(dir => {
const commands = readdirSync(`./cat/${dir}/`).filter(file =>
file.endsWith(".js")
);
for (let file of commands) {
let pull = require(`../cat/${dir}/${file}`);
if (pull.name) {
client.hide.set(pull.name, pull);
} else {
continue;
}
}
});
readdirSync("./events/").forEach(file => {
const events = readdirSync("./events/").filter(file =>
file.endsWith(".js")
);
for (let file of events) {
let pull = require(`../events/${file}`);
if (pull) {
client.events.set(file, file);
} else {
continue;
}
}
});
};

View file

@ -75,8 +75,9 @@ module.exports = async client => {
return [...accumulator, { id: v.id, permissions }];
}, []);
client.guilds.cache.forEach(g =>
g.commands.permissions.set({ fullPermissions })
g.commands.permissions.set({ fullPermissions }).catch(e => null)
);
});
//.catch(e => null);
});
};

6
util/dist/slash.js vendored
View file

@ -189,6 +189,12 @@ module.exports = async (interaction, dir, file, err) => {
case 506:
err = "This server is already premium";
break;
case 507:
err = "This server isn't premium yet";
break;
case 508:
err = "You didn't make the server premium";
break;
case 999:
err = "An unexpected error occured. Please try again.";
break;

View file

@ -348,6 +348,56 @@ async function confirmation(message, author, validReactions, time = 60000) {
console.log(e);
}
}
function selectRandom(array = []) {
return array[Math.floor(Math.random() * array.length)];
}
function getAllTextFromEmbed(embed) {
let text = "";
function getTime(now) {
const date = new Date(now);
const escape = value => `0${value}`.slice(-2);
const ampm = date.getHours() >= 12 ? "PM" : "AM";
return `${date.getMonth()}/${date.getDate()}/${date.getFullYear()} at ${escape(
date.getHours()
)}:${escape(date.getMinutes())}:${escape(date.getSeconds())}${ampm}`;
}
if (embed.title)
text += `**${embed.title
.replace(/(https?:\/\/)?discord\.gg\/(\w+)/g, "Invite")
.replace(/\[(.*)\]\((.*)\)/g, "Hyper link")}**`;
if (embed.description)
text += `\n${embed.description
.replace(/(https?:\/\/)?discord\.gg\/(\w+)/g, "Invite")
.replace(/\[(.*)\]\((.*)\)/g, "Hyper link")}`;
if (embed.fields) {
text += "\n";
for (const field of embed.fields)
text += `\n**${field.name
.replace(/(https?:\/\/)?discord\.gg\/(\w+)/g, "Invite")
.replace(/\[(.*)\]\((.*)\)/g, "Hyper link")}**\n ${field.value
.replace(/(https?:\/\/)?discord\.gg\/(\w+)/g, "Invite")
.replace(/\[(.*)\]\((.*)\)/g, "Hyper link")}`;
}
if (embed.footer) {
let field = `\n\n**${embed.footer.text
.replace(/(https?:\/\/)?discord\.gg\/(\w+)/g, "Invite")
.replace(/\[(.*)\]\((.*)\)/g, "Hyper link")}`;
if (embed.timestamp) {
const time =
embed.timestamp instanceof Date
? getTime(embed.timestamp.getTime())
: embed.timestamp;
field += `at ${time}`;
}
text += `${field}**`;
}
return text;
}
module.exports = {
rndint,
toBool,
@ -363,4 +413,6 @@ module.exports = {
cooldown,
ms,
confirmation,
selectRandom,
getAllTextFromEmbed,
};

View file

@ -33,6 +33,10 @@ module.exports = {
Welcome,
Goodbye,
Log,
Starboard,
StarCount,
Muterole,
Chatbot,
Premium,
Category,
Commands,
@ -45,6 +49,10 @@ module.exports = {
Welcome,
Goodbye,
Log,
Starboard,
StarCount,
Muterole,
Chatbot,
Premium,
Category,
Commands,
@ -56,6 +64,10 @@ module.exports = {
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;
@ -66,6 +78,10 @@ module.exports = {
Welcome,
Goodbye,
Log,
Starboard,
StarCount,
Muterole,
Chatbot,
Premium,
Category,
Commands,
@ -204,12 +220,12 @@ module.exports = {
*/
async BK(ID, Toggle, Reason) {
if (!ID) throw new Error("User ID?");
if (!Toggle) throw new Error("Blacklist Toggle?");
//if (!Toggle) throw new Error("Blacklist Toggle?");
if (!Reason) throw new Error("Blacklist Feason?");
const user = await u.findOne({ User: ID });
if (!user) {
const sus = new u({ User: ID });
if (Toggle == "true") {
if (Toggle == true) {
user.Blacklist = true;
user.Blacklist_Reason = Reason;
} else {
@ -220,7 +236,7 @@ module.exports = {
cachegoose.clearCache();
return { Reason };
} else {
if (Toggle == "true") {
if (Toggle == true) {
user.Blacklist = true;
user.Blacklist_Reason = Reason;
} else {
@ -369,6 +385,63 @@ module.exports = {
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

View file

@ -35,7 +35,7 @@ module.exports = class Util {
((currPage % contents.length) + contents.length) % contents.length;
const embed = msg.embeds[0]
.setDescription(contents[currPage])
.setFooter(`Page ${currPage + 1} of ${contents.length}.`);
.setFooter(`Page ${currPage + 1} of ${contents.length}`);
msg.edit({ embeds: [embed] });
this.pagination(msg, author, contents, false, currPage);
})