├── LICENSE ├── README.md ├── commands ├── anti-swear │ ├── addword.js │ ├── delword.js │ ├── set-warn-msg.js │ └── words.js └── info │ ├── help.js │ └── ping.js ├── config.json ├── handlers └── command.js ├── index.js └── package.json /LICENSE: -------------------------------------------------------------------------------- 1 | NOTE 2 | 3 | Collaborator ( ZeroDiscord ) / alias. Zero [ Legal Associate - Contact ~ 0_0#6666 { Discord } ] alongwith the copyright holder have the discretion as to submit takedown requests upon any material that is possibly infringing 4 | the license holder's rights. This includes the following: 5 | - Commercial use 6 | - Modification & Distribution Under A Trademark Without Explicit Permit 7 | - Patent use 8 | - Warranty & Liability ( States The Code Owner Would Not Be Held Responsible In Cases of Unprecidented actions such as raids. ) 9 | All claims upon infringing material may route via DMCA Strikes 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # anti-swear 2 | ## things not to do: 3 | - dont remove credits. 4 | - dont copy paste or youll never learn. 5 | ## things you should do 6 | - star this repo 7 | - dont be dumb 8 | -------------------------------------------------------------------------------- /commands/anti-swear/addword.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js") 2 | module.exports = { 3 | name: "addword", 4 | run: async (client, message, args, db) => { 5 | if (!message.channel.permissionsFor(message.author).has("MANAGE_GUILD")) return message.channel.send(":x: | **You dont have permissions to use this Command!**"); 6 | let pog = db.get(`words_${message.guild.id}`) 7 | let word = args[0] 8 | if (!word) { 9 | let embed = new Discord.MessageEmbed() 10 | .setTitle("Error") 11 | .setDescription(`:x: | **No word provided**\nFormat: \`+addword fk\``) 12 | .setFooter(message.author.tag + " | made by legendjs#0001", message.author.displayAvatarURL()) 13 | .setThumbnail(message.guild.iconURL()) 14 | .setColor("#FF0000") 15 | return message.channel.send({ 16 | embed: embed 17 | }) 18 | } 19 | if (pog && pog.find((find) => find.word == word)) { 20 | let embed = new Discord.MessageEmbed() 21 | embed.setAuthor(message.guild.name, message.guild.iconURL()) 22 | embed.setTitle("Error") 23 | embed.setDescription(`:x: | **The word is already on the database**`) 24 | embed.setFooter(message.author.tag + " | made by legendjs#0001", message.author.displayAvatarURL({ dynamic: true })); 25 | embed.setTimestamp() 26 | embed.setThumbnail(message.author.displayAvatarURL({ dynamic: true })) 27 | return message.channel.send({ 28 | embed: embed 29 | }); 30 | } 31 | let yes = { 32 | word: word, 33 | author: message.author.tag 34 | } 35 | db.push(`words_${message.guild.id}`, yes) 36 | let embed = new Discord.MessageEmbed() 37 | embed.setAuthor(message.guild.name, message.guild.iconURL()) 38 | embed.setTitle("Success") 39 | embed.setThumbnail(message.guild.iconURL()) 40 | embed.setDescription(`**The word has been added!**`) 41 | embed.setFooter(message.author.tag + " | made by legendjs#0001", message.author.displayAvatarURL({ dynamic: true })) 42 | embed.setColor("RANDOM") 43 | embed.setTimestamp() 44 | message.channel.send({ 45 | embed: embed 46 | }) 47 | } 48 | } 49 | -------------------------------------------------------------------------------- /commands/anti-swear/delword.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js") 2 | module.exports = { 3 | name: "delword", 4 | run: async (client, message, args, db) => { 5 | if (!message.channel.permissionsFor(message.author).has("MANAGE_GUILD")) return message.channel.send(":x: | **You dont have permissions to use this Command!**"); 6 | let pog = db.get(`words_${message.guild.id}`) 7 | let word = args[0] 8 | if (!word) { 9 | let embed = new Discord.MessageEmbed() 10 | .setTitle("Error") 11 | .setDescription(`:x: | **No word provided**\nFormat: \`+delword fk\``) 12 | .setFooter(message.author.tag + " | made by legendjs#0001", message.author.displayAvatarURL()) 13 | .setThumbnail(message.guild.iconURL()) 14 | .setColor("#FF0000") 15 | return message.channel.send({ 16 | embed: embed 17 | }) 18 | } 19 | if (pog) { 20 | let data = pog.find((x) => x.word.toLowerCase() === word.toLowerCase()); 21 | let No = new Discord.MessageEmbed() 22 | No.setAuthor(message.author.tag, message.author.displayAvatarURL({ dynamic: true })) 23 | No.setDescription(`:x: | **Word Not Found**`) 24 | No.setColor("#FF0000") 25 | No.setFooter(message.guild.name + " | made by legendjs#0001", message.guild.iconURL()); 26 | No.setThumbnail(message.guild.iconURL()) 27 | 28 | if (!data) return message.channel.send({ embed: No }); 29 | 30 | let yes = pog.indexOf(data); 31 | delete pog[yes]; 32 | 33 | var filter = pog.filter((x) => { 34 | return x != null && x != ''; 35 | }); 36 | db.set(`words_${message.guild.id}`, filter); 37 | let embed = new Discord.MessageEmbed() 38 | embed.setAuthor(message.author.tag, message.author.displayAvatarURL()) 39 | embed.setDescription(`**The word has been deleted!** `) 40 | embed.setFooter(message.guild.name + " | made by legendjs#0001", message.guild.iconURL()); 41 | embed.setColor("GREEN") 42 | embed.setTimestamp() 43 | return message.channel.send({ embed: embed }); 44 | } else { 45 | let embed = new Discord.MessageEmbed() 46 | embed.setAuthor(message.author.tag, message.author.displayAvatarURL()) 47 | embed.setDescription(`:x: | **The word was not found!**`) 48 | embed.setFooter(message.guild.name + " | made by legendjs#0001", message.guild.iconURL()); 49 | embed.setColor("#FF0000") 50 | embed.setTimestamp() 51 | 52 | return message.channel.send({ embed: embed }); 53 | } 54 | } 55 | } 56 | -------------------------------------------------------------------------------- /commands/anti-swear/set-warn-msg.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js") 2 | module.exports = { 3 | name: "set-warn-msg", 4 | run: async (client, message, args, db) => { 5 | if (!message.channel.permissionsFor(message.author).has("MANAGE_GUILD")) return message.channel.send(":x: | **You dont have permissions to use this Command!**"); 6 | let msg = args.join(" ") 7 | if (!msg) { 8 | return message.channel.send("Provide a message.") 9 | } 10 | db.set(`message_${message.guild.id}`, msg) 11 | let embed = new Discord.MessageEmbed() 12 | embed.setTitle("Message Set!") 13 | embed.setFooter(message.author.tag + " | made by legendjs#0001", message.author.displayAvatarURL({ dynamic: true })) 14 | embed.setTimestamp() 15 | embed.setAuthor(message.guild.name, message.guild.iconURL()) 16 | embed.addField("message", msg) 17 | embed.addField("preview", msg.split("{user-mention}").join("<@"+message.author.id+">").split("{server-name}").join(message.guild.name).split("{user-tag}").join(message.author.tag).split("{user-username}").join(message.author.username)) 18 | embed.setThumbnail(message.author.displayAvatarURL({ dynamic: true })) 19 | embed.setColor("GREEN") 20 | return message.channel.send({ embed: embed }) 21 | } 22 | } 23 | -------------------------------------------------------------------------------- /commands/anti-swear/words.js: -------------------------------------------------------------------------------- 1 | const Discord = require('discord.js'); 2 | module.exports = { 3 | name: "words", 4 | run: async (client, message, args, db) => { 5 | let embed = new Discord.MessageEmbed() 6 | embed.setTitle(`${message.guild.name} | Anti Swear words list`) 7 | embed.setThumbnail(message.guild.iconURL()) 8 | embed.setFooter(message.author.tag, message.author.displayAvatarURL()); 9 | embed.setColor("GREEN") 10 | let words = db.get(`words_${message.guild.id}`); 11 | if (words && words.length) { 12 | let array = []; 13 | words.forEach((x) => { 14 | array.push(`**Word:** ${x.word} | **added By:** ${x.author}`); 15 | }); 16 | 17 | embed.setDescription(`${array.join('\n')}`); 18 | embed.setFooter(message.author.tag + " | made by legendjs#0001", message.author.displayAvatarURL({ dynamic: true })) 19 | } else { 20 | return message.channel.send(":x: | **There are No words.**") 21 | } 22 | 23 | return message.channel.send({ embed: embed }); 24 | } 25 | } 26 | -------------------------------------------------------------------------------- /commands/info/help.js: -------------------------------------------------------------------------------- 1 | const Discord = require("discord.js") 2 | module.exports = { 3 | name: "help", 4 | run: async (client, message, args) => { 5 | const embed = new Discord.MessageEmbed() 6 | embed.setTitle("Help | " + client.user.username) 7 | embed.setThumbnail(client.user.displayAvatarURL()) 8 | embed.setFooter(client.user.tag + " | made by legendjs#0001", client.user.displayAvatarURL()) 9 | embed.setTimestamp() 10 | embed.setDescription(`The commands are listed below:`) 11 | embed.addField("anti-swear", '`addword` | `delword` | `set-warn-msg` | `words`') 12 | embed.addField("info", '`help` | `ping`') 13 | embed.setColor("GREEN") 14 | message.channel.send({ embed: embed }) 15 | } 16 | } 17 | -------------------------------------------------------------------------------- /commands/info/ping.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | name: "ping", 3 | category: "info", 4 | description: "Returns latency and API ping", 5 | run: async (client, message, args) => { 6 | message.channel.send(`Pong! 🏓 (${client.ws.ping}ms)`) 7 | } 8 | } 9 | -------------------------------------------------------------------------------- /config.json: -------------------------------------------------------------------------------- 1 | { 2 | "token": "token", 3 | "prefix": "+" 4 | } 5 | -------------------------------------------------------------------------------- /handlers/command.js: -------------------------------------------------------------------------------- 1 | const { readdirSync } = require("fs"); 2 | 3 | module.exports = (client) => { 4 | readdirSync("./commands/").forEach(dir => { 5 | const commands = readdirSync(`./commands/${dir}/`).filter(file => file.endsWith(".js")); 6 | for (let file of commands) { 7 | let pull = require(`../commands/${dir}/${file}`); 8 | 9 | if (pull.name) { 10 | client.commands.set(pull.name, pull); 11 | } else { 12 | continue; 13 | } 14 | 15 | if (pull.aliases && Array.isArray(pull.aliases)) pull.aliases.forEach(alias => client.aliases.set(alias, pull.name)); 16 | } 17 | }); 18 | console.log("[INFO]: Commands Loaded!") 19 | } 20 | -------------------------------------------------------------------------------- /index.js: -------------------------------------------------------------------------------- 1 | console.log("[INFO]: Loading...") 2 | //anti Swear bot coded by legend :D 3 | const { Client, Collection } = require("discord.js"); 4 | const { prefix, token } = require("./config.json") 5 | //dont touch the credits or i will find you and u will have to commit die >:) 6 | const client = new Client({ 7 | disableMentions: "everyone" 8 | }) 9 | const db = require("quick.db") 10 | 11 | client.commands = new Collection(); 12 | client.aliases = new Collection(); 13 | 14 | ["command"].forEach(handler => { 15 | require(`./handlers/${handler}`)(client); 16 | }); 17 | 18 | console.log("-------------------------------------") 19 | console.log(` 20 | ██╗ ███████╗ ██████╗ ███████╗███╗ ██╗██████╗ ██╗███████╗ 21 | ██║ ██╔════╝██╔════╝ ██╔════╝████╗ ██║██╔══██╗ ██║██╔════╝ 22 | ██║ █████╗ ██║ ███╗█████╗ ██╔██╗ ██║██║ ██║ ██║███████╗ 23 | ██║ ██╔══╝ ██║ ██║██╔══╝ ██║╚██╗██║██║ ██║ ██ ██║╚════██║ 24 | ███████╗███████╗╚██████╔╝███████╗██║ ╚████║██████╔╝██╗╚█████╔╝███████║ 25 | ╚══════╝╚══════╝ ╚═════╝ ╚══════╝╚═╝ ╚═══╝╚═════╝ ╚═╝ ╚════╝ ╚══════╝ 26 | `) 27 | console.log("-------------------------------------") 28 | //this took me a long time so dont you dare remove credits, if u do remove credits then you will have copy right issues. 29 | client.on("ready", () => { 30 | console.log(`[INFO]: Ready on client (${client.user.tag})`) 31 | client.user.setActivity("anti-swear bot by legendjs :D", { type: "WATCHING" }) 32 | }) 33 | 34 | client.on("message", async message => { 35 | 36 | 37 | if (message.author.bot) return; 38 | if (!message.guild) return; 39 | if (!message.content.startsWith(prefix)) return; 40 | if (!message.member) message.member = await message.guild.fetchMember(message); 41 | 42 | const args = message.content.slice(prefix.length).trim().split(/ +/g); 43 | const cmd = args.shift().toLowerCase(); 44 | 45 | if (cmd.length === 0) return; 46 | 47 | let command = client.commands.get(cmd); 48 | if (!command) command = client.commands.get(client.aliases.get(cmd)); 49 | if (command) 50 | command.run(client, message, args, db); 51 | }); 52 | 53 | client.on("message", async (message) => { 54 | if (message.author.bot) return; 55 | let words = db.get(`words_${message.guild.id}`) 56 | let yus = db.get(`message_${message.guild.id}`) 57 | if (yus === null) { 58 | yus = ":x: | **{user-mention}, The Word You said is blacklisted!**" 59 | } 60 | if (message.content.startsWith(prefix + "addword")) return; 61 | if (message.content.startsWith(prefix + "delword")) return; 62 | if (message.content.startsWith(prefix + "set-warn-msg")) return; 63 | if (message.content.startsWith(prefix + "words")) return; 64 | let pog = yus.split("{user-mention}").join("<@"+message.author.id+">").split("{server-name}").join(message.guild.name).split("{user-tag}").join(message.author.tag).split("{user-username}").join(message.author.username) 65 | if (words === null) return; 66 | function check(msg) { //is supposed to check if message includes da swear word 67 | return words.some(word => message.content.toLowerCase().split(" ").join("").includes(word.word.toLowerCase())) 68 | } 69 | if (check(message.content) === true) { 70 | message.delete() 71 | message.channel.send(pog) 72 | } 73 | }) 74 | 75 | client.login(token).catch(err => { 76 | console.log("[ERROR]: Invalid Token Provided") 77 | }) 78 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "anti-swear", 3 | "version": "1.0.0", 4 | "description": "anti-swear by legend", 5 | "main": "index.js", 6 | "scripts": { 7 | "test": "echo \"Error: no test specified\" && exit 1" 8 | }, 9 | "keywords": [], 10 | "author": "legend", 11 | "license": "ISC", 12 | "dependencies": { 13 | "discord.js": "^12.5.1", 14 | "quick.db": "^7.1.3" 15 | } 16 | } 17 | --------------------------------------------------------------------------------