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

Commit

Permalink
feat: fully remove attachments
Browse files Browse the repository at this point in the history
  • Loading branch information
wdhdev committed Jul 10, 2023
1 parent 2570dcc commit a9470f5
Show file tree
Hide file tree
Showing 6 changed files with 6 additions and 14 deletions.
1 change: 0 additions & 1 deletion src/buttons/logs/delete-message.js
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,6 @@ module.exports = {

if(user) message.setAuthor({ name: user.tag.endsWith("#0") ? user.username : user.tag, iconURL: user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${user.id}` });
if(data.content) message.setDescription(data.content);
if(data.attachment) message.setImage(data.attachment);

modLogsChannel.send({ embeds: [log, message] });
})
Expand Down
4 changes: 1 addition & 3 deletions src/commands/info/bot.js
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,6 @@ module.exports = {
const donators = await User.find({ donator: true });

const messages = await Message.find();
const images = await Message.find({ attachment: { $ne: null } });

const guild = await client.guilds.fetch(client.config_default.guild);
const members = await guild.members.fetch();
Expand All @@ -48,14 +47,13 @@ module.exports = {
const stat_supporters = `💖 ${boosters.size} Supporter${boosters.size === 1 ? "" : "s"}`;

const stat_messages = `💬 ${messages.length} Message${messages.length === 1 ? "" : "s"}`;
const stat_images = `🖼️ ${images.length} Image${images.length === 1 ? "" : "s"}`;

const statistics = new Discord.EmbedBuilder()
.setColor(client.config_embeds.default)
.addFields (
{ name: "🤖 Bot", value: `${stat_guilds}\n${stat_users}`, inline: true },
{ name: "🎭 Roles", value: `${stat_developers}\n${stat_moderators}\n${stat_verified}\n${stat_donators}\n${stat_supporters}`, inline: true },
{ name: "🌐 Global Chat", value: `${stat_messages}\n${stat_images}`, inline: true }
{ name: "🌐 Global Chat", value: `${stat_messages}`, inline: true }
)

const buttons = new Discord.ActionRowBuilder()
Expand Down
2 changes: 0 additions & 2 deletions src/context-menu/message/Delete Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -89,9 +89,7 @@ module.exports = {
.setTimestamp(new Date(Number((BigInt(data._id) >> 22n) + 1420070400000n)))

if(user) message.setAuthor({ name: user.tag.endsWith("#0") ? user.username : user.tag, iconURL: user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${user.id}` });

if(data.content) message.setDescription(data.content);
if(data.attachment) message.setImage(data.attachment);

modLogsChannel.send({ embeds: [log, message] });
})
Expand Down
2 changes: 0 additions & 2 deletions src/context-menu/message/Report Message.js
Original file line number Diff line number Diff line change
Expand Up @@ -71,9 +71,7 @@ module.exports = {
.setTimestamp(new Date(Number((BigInt(msgData._id) >> 22n) + 1420070400000n)))

if(user) messageEmbed.setAuthor({ name: user.tag.endsWith("#0") ? user.username : user.tag, iconURL: user.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${user.id}` });

if(msgData.content) messageEmbed.setDescription(msgData.content);
if(msgData.attachment) messageEmbed.setImage(msgData.attachment);

reportChannel.send({ content: `<@&${client.config_roles.mod}>`, embeds: [report, messageEmbed], components: [actions] });
} catch(err) {
Expand Down
2 changes: 2 additions & 0 deletions src/util/filter/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ module.exports = async (message, client, Discord) => {
const phishing = require("./tests/phishing");
const profanity = require("./tests/profanity");

if(!message.content.length) return false;

// Phishing
if(await phishing(message, client, Discord)) return true;

Expand Down
9 changes: 3 additions & 6 deletions src/util/send.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,8 @@ module.exports = async function (message, client, Discord) {

const blockedChannel = client.channels.cache.get(client.config_channels.blocked);

if(await BannedUser.exists({ _id: message.author.id })) return
if(await BannedUser.exists({ _id: message.author.id })) return;
if(!message.content.length) return;

if(message.content.length > 2000) {
const blocked = new Discord.EmbedBuilder()
Expand Down Expand Up @@ -60,9 +61,7 @@ module.exports = async function (message, client, Discord) {
return;
}

if(message.content.length) {
if(await test(message, client, Discord)) return;
}
if(await test(message, client, Discord)) return;

const id = message.id;

Expand All @@ -89,7 +88,6 @@ module.exports = async function (message, client, Discord) {

if(referenceUser) replyEmbed.setAuthor({ name: referenceUser.tag.endsWith("#0") ? referenceUser.username : referenceUser.tag, iconURL: referenceUser.displayAvatarURL({ format: "png", dynamic: true }), url: `https://discord.com/users/${referenceUser.id}` });;
if(data.content) replyEmbed.setDescription(data.content);
if(data.attachment) replyEmbed.setImage(data.attachment);
replyEmbed.setTimestamp(new Date(Number((BigInt(data._id) >> 22n) + 1420070400000n)));
}

Expand Down Expand Up @@ -232,7 +230,6 @@ module.exports = async function (message, client, Discord) {
user: message.author.id,
guild: message.guild.id,
content: message.content,
attachment: null,
messages: messages
}).save()

Expand Down

0 comments on commit a9470f5

Please sign in to comment.