Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const { readFileSync, writeFileSync } = require ("fs")
- const antilinks = JSON.parse (readFileSync("./antilinks.json", "utf-8"));
- const saveAnti = () => writeFileSync("./antilinks.json", JSON.stringify (antilinks, null, 2));
- client.on ("message", message => {
- if (!message.guild || message.author.bot) return;
- if (message.content.split(" ")[0] == "$antilinks") {
- if (!message.member.hasPermission ("MANAGE_GUILD")) return message.reply ("Access denied");
- const st = message.content.split(" ")[1];
- if (!st || !["on", "off"].includes (st)) return message.channel.send (`$antilinks on/off`);
- antilinks[message.guild.id] = {
- status: (st == "on" ? true : false)
- }
- saveAnti();
- message.channel.send (`Successfully ${(st == "on" ? "Enabled" : "Disabled")} AntiLinks.`);
- }
- })
- client.on("message", message => {
- if (!message.guild || message.author.bot || !message.member.hasPermission("MANAGE_GUILD") || !antilinks[message.guild.id] || !antilinks[message.guild.id].status) return false;
- if (/^(?:([A-Za-z]+):)?(\/{0,3})([0-9.\-A-Za-z]+)(?::(\d+))?(?:\/([^?#]*))?(?:\?([^#]*))?(?:#(.*))?$/.test (message.content.toLowerCase())) {
- message.delete ();
- message.channel.send (`**Do not share links.**`);
- }
- })
- //By 3Mo_Steve | Toxic Codes
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement