Skip to content
This repository has been archived by the owner on Jul 15, 2024. It is now read-only.

Commit

Permalink
feat: remove cdn + banning guilds
Browse files Browse the repository at this point in the history
  • Loading branch information
wdhdev committed Jun 24, 2023
1 parent 2f656dc commit a4d65ff
Show file tree
Hide file tree
Showing 17 changed files with 54 additions and 739 deletions.
135 changes: 2 additions & 133 deletions src/commands/ban.js
Original file line number Diff line number Diff line change
@@ -1,59 +1,19 @@
const emoji = require("../config.json").emojis;

const bannedGuildSchema = require("../models/bannedGuildSchema");
const bannedUserSchema = require("../models/bannedUserSchema");
const channelSchema = require("../models/channelSchema");
const devSchema = require("../models/devSchema");
const modSchema = require("../models/modSchema");
const verifiedSchema = require("../models/verifiedSchema");

module.exports = {
name: "ban",
description: "Ban a user or guild.",
description: "Ban management commands.",
options: [
{
type: 1,
name: "guild",
description: "Ban a guild.",
options: [
{
type: 3,
name: "id",
description: "The ID of the guild you want to ban.",
min_length: 17,
max_length: 19,
required: true
},

{
type: 3,
name: "reason",
description: "Why you want to ban the guild.",
max_length: 1024,
required: true
}
]
},

{
type: 2,
name: "info",
description: "Get information about a ban.",
options: [
{
type: 1,
name: "guild",
description: "Get information about a guild ban.",
options: [
{
type: 3,
name: "id",
description: "The ID of the guild to get ban information from.",
required: true
}
]
},

{
type: 1,
name: "user",
Expand Down Expand Up @@ -120,42 +80,6 @@ module.exports = {
}

if(interaction.options.getSubcommandGroup() === "info") {
if(interaction.options.getSubcommand() === "guild") {
const id = interaction.options.getString("id");

if(!await bannedGuildSchema.exists({ _id: id })) {
const error = new Discord.EmbedBuilder()
.setColor(client.config_embeds.error)
.setDescription(`${emoji.error} The guild \`${id}\` is not banned!`)

await interaction.editReply({ embeds: [error], ephemeral: true });
return;
}

const data = await bannedGuildSchema.findOne({ _id: id });

if(!data.timestamp || !data.reason || !data.mod) {
const error = new Discord.EmbedBuilder()
.setColor(client.config_embeds.error)
.setDescription(`${emoji.error} No information is available about this ban!`)

await interaction.editReply({ embeds: [error], ephemeral: true });
return;
}

const banInfo = new Discord.EmbedBuilder()
.setColor(client.config_embeds.default)
.setTitle("Ban Information")
.addFields (
{ name: "🕰️ Timestamp", value: `<t:${data.timestamp.slice(0, -3)}>` },
{ name: "❓ Reason", value: `${data.reason}` },
{ name: "🔨 Moderator", value: `<@${data.mod}>` }
)

await interaction.editReply({ embeds: [banInfo] });
return;
}

if(interaction.options.getSubcommand() === "user") {
const user = interaction.options.getUser("user");

Expand Down Expand Up @@ -197,64 +121,9 @@ module.exports = {
return;
}

const reason = interaction.options.getString("reason");

if(interaction.options.getSubcommand() === "guild") {
const id = interaction.options.getString("id");

if(id === client.config_default.guild) {
const error = new Discord.EmbedBuilder()
.setColor(client.config_embeds.error)
.setDescription(`${emoji.error} You cannot ban that guild!`)

await interaction.editReply({ embeds: [error], ephemeral: true });
return;
}

if(await bannedGuildSchema.exists({ _id: id })) {
const error = new Discord.EmbedBuilder()
.setColor(client.config_embeds.error)
.setDescription(`${emoji.error} That guild is already banned!`)

await interaction.editReply({ embeds: [error], ephemeral: true });
return;
}

new bannedGuildSchema({
_id: id,
timestamp: Date.now(),
reason: reason,
mod: interaction.user.id
}).save()

const guild = client.guilds.cache.get(id);

if(guild) guild.leave();

await channelSchema.findOneAndDelete({ _id: id });

const banned = new Discord.EmbedBuilder()
.setColor(client.config_embeds.default)
.setDescription(`${emoji.successful} Banned Guild: \`${id}\``)

await interaction.editReply({ embeds: [banned] });

const banLog = new Discord.EmbedBuilder()
.setColor(client.config_embeds.default)
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? `@${interaction.user.username}` : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setTitle("Guild Banned")
.addFields (
{ name: "🔢 Guild ID", value: `${id}` },
{ name: "❓ Reason", value: `${reason}` }
)
.setTimestamp()

modLogsChannel.send({ embeds: [banLog] });
return;
}

if(interaction.options.getSubcommand() === "user") {
const user = interaction.options.getUser("user");
const reason = interaction.options.getString("reason");
const appealable = interaction.options.getBoolean("appealable");

if(user.id === interaction.user.id) {
Expand Down
80 changes: 0 additions & 80 deletions src/commands/cdn.js

This file was deleted.

6 changes: 1 addition & 5 deletions src/commands/eval.js
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
const emoji = require("../config.json").emojis;

const devSchema = require("../models/devSchema");

module.exports = {
name: "eval",
description: "Evaluate code on the bot.",
Expand All @@ -21,9 +19,7 @@ module.exports = {
hidden: true,
async execute(interaction, client, Discord) {
try {
const dev = await devSchema.exists({ _id: interaction.user.id });

if(!dev) {
if(interaction.user.id !== client.config_default.owner) {
const error = new Discord.EmbedBuilder()
.setColor(client.config_embeds.error)
.setDescription(`${emoji.error} You do not have permission to run this command!`)
Expand Down
86 changes: 43 additions & 43 deletions src/commands/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -172,49 +172,49 @@ module.exports = {
return;
}

if(interaction.options.getSubcommand() === "list") {
// const filter = interaction.options.getString("filter");
const filter = "block";

const data = await filterSchema.findOne({ _id: filter });

if(!data) {
const error = new Discord.EmbedBuilder()
.setColor(client.config_embeds.error)
.setDescription(`${emoji.error} There are no words on the filter!`)

await interaction.editReply({ embeds: [error], ephemeral: true });
return;
}

const filters = {
"block": "Block",
// "unblock": "Unblock"
}

const embed = new Discord.EmbedBuilder()
.setColor(client.config_embeds.default)
.setTitle(`${filters[filter]} Filter`)
.setDescription(`\`${data.words.sort().join("\`, \`")}\``)

try {
await interaction.user.send({ embeds: [embed] });
} catch {
const error = new Discord.EmbedBuilder()
.setColor(client.config_embeds.error)
.setDescription(`${emoji.error} I could not DM you!`)

await interaction.editReply({ embeds: [error], ephemeral: true });
return;
}

const sent = new Discord.EmbedBuilder()
.setColor(client.config_embeds.default)
.setDescription(`${emoji.successful} Check your DMs!`)

await interaction.editReply({ embeds: [sent] });
return;
}
// if(interaction.options.getSubcommand() === "list") {
// // const filter = interaction.options.getString("filter");
// const filter = "block";

// const data = await filterSchema.findOne({ _id: filter });

// if(!data) {
// const error = new Discord.EmbedBuilder()
// .setColor(client.config_embeds.error)
// .setDescription(`${emoji.error} There are no words on the filter!`)

// await interaction.editReply({ embeds: [error], ephemeral: true });
// return;
// }

// const filters = {
// "block": "Block",
// // "unblock": "Unblock"
// }

// const embed = new Discord.EmbedBuilder()
// .setColor(client.config_embeds.default)
// .setTitle(`${filters[filter]} Filter`)
// .setDescription(`\`${data.words.sort().join("\`, \`")}\``)

// try {
// await interaction.user.send({ embeds: [embed] });
// } catch {
// const error = new Discord.EmbedBuilder()
// .setColor(client.config_embeds.error)
// .setDescription(`${emoji.error} I could not DM you!`)

// await interaction.editReply({ embeds: [error], ephemeral: true });
// return;
// }

// const sent = new Discord.EmbedBuilder()
// .setColor(client.config_embeds.default)
// .setDescription(`${emoji.successful} Check your DMs!`)

// await interaction.editReply({ embeds: [sent] });
// return;
// }

if(interaction.options.getSubcommand() === "remove") {
const word = interaction.options.getString("word");
Expand Down
4 changes: 2 additions & 2 deletions src/commands/message.js
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ module.exports = {

await interaction.editReply({ embeds: [result] });

const cdnLog = new Discord.EmbedBuilder()
const log = new Discord.EmbedBuilder()
.setColor(client.config_embeds.default)
.setAuthor({ name: interaction.user.tag.endsWith("#0") ? `@${interaction.user.username}` : interaction.user.tag, iconURL: interaction.user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${interaction.user.id}` })
.setTitle("🗑️ Message Deleted")
Expand All @@ -104,7 +104,7 @@ module.exports = {
)
.setTimestamp()

modLogsChannel.send({ embeds: [cdnLog] });
modLogsChannel.send({ embeds: [log] });
})

return;
Expand Down
Loading

0 comments on commit a4d65ff

Please sign in to comment.