Skip to content

Commit

Permalink
link filter
Browse files Browse the repository at this point in the history
  • Loading branch information
skysthelimitt committed Feb 28, 2024
1 parent 56c2f45 commit a543434
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions events/messageCreate.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
const { Events } = require("discord.js");
const { widgets } = require("../config.json");
const { widgets, logs_channel } = require("../config.json");
const profanity = require("@2toad/profanity").profanity;
const BadWordsNext = require("bad-words-next");
const en = require("bad-words-next/data/en.json");
Expand Down Expand Up @@ -54,8 +54,12 @@ module.exports = {
name: Events.MessageCreate,
async execute(interaction) {
if (interaction.channelId == widgets) {
if (profanity.exists(interaction.content) || badwords.check(interaction.content)) {
let linkRegex = /[-a-zA-Z0-9@:%._\+~#=]{1,256}\.[a-zA-Z0-9()]{2,6}\b([-a-zA-Z0-9()@:%_\+.~#?&//=]*)/;
let ghostedRegex = /QJM9bSW/;
if (profanity.exists(interaction.content) || badwords.check(interaction.content) || linkRegex.test(interaction.content) || ghostedRegex.test(interaction.content)) {
interaction.delete();
const logsChannel = interaction.client.channels.cache.get(logs_channel.toString());
logsChannel.send(`Message in #widgets deleted by ${interaction.author.username}\nprofanity 1, profanity 2, link, linker doc\n${profanity.exists(interaction.content)} ${badwords.check(interaction.content)} ${linkRegex.test(interaction.content)} ${ghostedRegex.test(interaction.content)}`);
} else if (profanity.exists(interaction.author.tag) || badwords.check(interaction.author.tag)) {
msg = await interaction.reply("Please change your name.");
interaction.delete();
Expand Down

0 comments on commit a543434

Please sign in to comment.