Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- const Discord = require("discord.js");
- const bot = new Discord.Client({ disableEveryone: true });
- const settings = require("./settings.json");
- const gamename = settings.game;
- const ownerID = settings.owner;
- const botstatus = settings.status;
- const botID = settings.botID;
- const fs = require("fs");
- const prefix = settings.prefix;
- const password = settings.password;
- const ytSearch = require("yt-search");
- const urban = require("relevant-urban");
- const DBL = require("dblapi.js");
- const dbr = require("dbrlib");
- let talkedRecently = new Set();
- let ratedrec = new Set();
- // send the stats every hour to DBL
- const dbl = new DBL(
- "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjUyMjc3MTUxNzM2NTQyMDAzMiIsImJvdCI6dHJ1ZSwiaWF0IjoxNTQ4MTY4NTU2fQ.ZxKgX15Wvt9MfxM00cFkgHvbqQZA7DLSq9T-4HZXTgQ",
- { statsInterval: 3600000 },
- bot
- );
- dbl.on("error", e => {
- console.log(`DBL Error! ${e}`);
- });
- // Optional events
- dbl.on("posted", () => {
- console.log("Server count posted!");
- });
- bot.on("ready", () => {
- const dbrbot = new dbr.dbrbot()
- dbrbot.post("522771517365420032", ".dOpFSa4oy9VkCvT37Zk3CaiJUy8ivyXKqZJKStj6gsREX9mO8Ub.h4dkhPAc7XfUkctPMrt-uAO9GOa", bot.guilds.size)
- });
- //---------------------------------------------------------------------------------------------------
- bot.on("ready", async () => {
- var text = gamename;
- var values = {
- servers: bot.guilds.size,
- users: bot.users.size
- };
- var games = text.replace(/\{\{([^}]+)\}\}/g, function(i, match) {
- return values[match];
- });
- var datetoday = new Date();
- var days = datetoday.getDate();
- var month = datetoday.getMonth() + 1;
- var year = datetoday.getFullYear();
- var time1 = datetoday.getSeconds();
- var time2 = datetoday.getHours();
- var time3 = datetoday.getMinutes();
- fs.writeFile(
- "./botstart.txt",
- days + "." + month + "." + year + " \n" + time2 + ":" + time3 + ":" + time1,
- function(err) {
- console.log(
- "Logged in as " +
- bot.user.username +
- "#" +
- bot.user.discriminator +
- "\n" +
- "\n"
- );
- console.log("Server Count: " + bot.guilds.size + "\n" + "\n");
- console.log("Prefix: " + settings.prefix + "\n" + "\n");
- console.log(
- "<<<<<<<<<<|| Moddest will now log commands below this line ||>>>>>>>>>>"
- );
- bot.user.setPresence({
- game: { name: ">>help || moddest.xyz", type: "WATCHING" }
- });
- const snek = require("snekfetch");
- muscii(bot);
- }
- );
- });
- //---------------------------------------------------------------------------------------------------
- bot.on("guildCreate", guild => {
- const channelToSend =
- guild.systemChannel ||
- guild.channels
- .filter(guildChannel => guildChannel.type === "text")
- .filter(guildChannel =>
- guildChannel.permissionsFor(bot.user).has("SEND_MESSAGES")
- )
- .first();
- const serveradd = new Discord.RichEmbed()
- .setColor("00ae86")
- .setDescription(
- "<:yes:534711053511163914> Thank you for adding me to " +
- guild.name +
- "! \n Use `>>help` to see what I can do!"
- );
- channelToSend.send(serveradd).catch(err => {
- console.log(err);
- });
- log(`I have been added to: ` + guild.name + "(" + guild.id + ")");
- });
- bot.on("message", async message => {
- if (message.author.bot) return;
- if (message.channel.type === "dm") return;
- let messageArray = message.content.split(" ");
- let command = messageArray[0];
- let args = messageArray.slice(1);
- const mentionprefix = message.guild.member(botID).toString();
- fs.readFile(`./blacklisted/${message.author.id}/black.txt`, function(
- err,
- data
- ) {
- if (data === "true") return;
- if (err) {
- if (message.content.startsWith(prefix)) {
- var dir = `./usagelogs/${message.guild.id}`;
- if (!fs.existsSync(dir)) {
- fs.mkdirSync(dir);
- }
- const nd = new Date();
- const nowdate = nd.getDate();
- const nowdate2 = nd.getMonth() + 1;
- const nowdate3 = nd.getFullYear();
- const minute1 = nd.getHours();
- const minute2 = nd.getMinutes();
- const minute3 = nd.getSeconds();
- fs.appendFile(
- `./usagelogs/${message.guild.id}/logs.txt`,
- "\n" +
- nowdate +
- "." +
- nowdate2 +
- "." +
- nowdate3 +
- " " +
- minute1 +
- ":" +
- minute2 +
- ":" +
- minute3 +
- " " +
- message.author.id +
- " " +
- message.author.username +
- "#" +
- message.author.discriminator +
- ":: " +
- message.content,
- function(err) {}
- );
- }
- // console.log('');
- global.log = require("./util/logger");
- if (message.content.startsWith(prefix)) {
- log(
- message.author.tag +
- " (" +
- message.author.id +
- ")" +
- " used command " +
- message.content +
- " in " +
- message.guild.name +
- " (" +
- message.guild.id +
- ")"
- );
- }
- // dbl
- // .hasVoted(message.author.id)
- // .then(voted => {
- // if (voted) {
- // fs.writeFile('./votelock/' + author.id + ".txt", "DATA TO WRITE", function(err) {
- // if(err) return message.channel.send(" ")
- // });
- // }
- // });
- //---------------------------------------------------------------------------------------------------
- if (
- command === `${prefix}blacklist` ||
- command === `${mentionprefix}blacklist`
- ) {
- const blacklister = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> Only the bot owner can use this command!"
- );
- if (message.author.id !== ownerID)
- return message.channel.send(blacklister);
- const who = args[0];
- const who2 = args.slice(1).join(" ");
- var dir = `./blacklisted/${who}`;
- if (!fs.existsSync(dir)) {
- fs.mkdirSync(dir);
- }
- fs.writeFile(`./blacklisted/${who}/black.txt`, "true", function(err) {
- fs.writeFile(`./blacklisted/${who}/reason.txt`, who2, function(err) {
- let se = bot.users
- .get(who)
- .send(
- "`" +
- "Hello, You have been added to " +
- bot.user.username +
- "'s blacklist for the following reason: " +
- who2 +
- " / This means you are no longer permitted to use the bot. If you think this was unfair/wish to get un-blacklisted, please join the support server." +
- "`"
- );
- if (!se) return;
- message.channel.send(
- "`" +
- "User was blacklisted and was sent a message saying they were blacklisted for: " +
- who2 +
- "`"
- );
- setTimeout(function() {
- let lol = bot.guilds.filter(r => r.owner.id === who);
- lol.forEach(async (guild, id) => {
- guild.leave();
- });
- }, 1000);
- });
- });
- }
- if (
- command === `${mentionprefix}unblacklist` ||
- command === `${prefix}unblacklist`
- ) {
- const unblacklister = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> Only the bot owner can use this command!"
- );
- if (message.author.id !== ownerID)
- return message.channel.send(unblacklister);
- var dir = `./blacklisted/${message.author.id}`;
- if (!fs.existsSync(dir)) {
- fs.mkdirSync(dir);
- }
- const who = args[0];
- const who2 = args.slice(1).join(" ");
- fs.unlink(`./blacklisted/${who}/black.txt`, function(err) {
- fs.unlink(`./blacklisted/${who}/reason.txt`, function(err) {
- let se = bot.users
- .get(who)
- .send(
- "`" +
- "You have been removed from " +
- bot.user.username +
- "'s blacklist, you can now use the bot again!" +
- "`"
- );
- if (!se) return;
- message.channel.send(
- "`" + "User was successfully unblacklisted." + "`"
- );
- });
- });
- }
- if (
- command === `${mentionprefix}setgame` ||
- command === `${prefix}setgame`
- ) {
- const setgamer = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> Only the bot owner can use this command!"
- );
- if (message.author.id !== ownerID)
- return message.channel.send(setgamer);
- const what = args.join(" ");
- var text = gamename;
- var values = {
- servers: bot.guilds.size
- };
- var games = text.replace(/\{\{([^}]+)\}\}/g, function(i, match) {
- return values[match];
- });
- bot.user.setPresence({ game: { name: what, type: 0 } });
- message.channel.send("`" + "Game set!" + "`");
- }
- if (command === `${prefix}eval` || command === `${mentionprefix}eval`) {
- const evaler = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> Only the bot owner can use this command!"
- );
- if (message.author.id !== ownerID) return message.channel.send(evaler);
- const that = message.content.split(" ").slice(1);
- try {
- const code = args.join(" ");
- let evaled = eval(code);
- if (typeof evaled !== "string")
- evaled = require("util").inspect(evaled);
- const ss = new Discord.RichEmbed()
- .setDescription("**EVAL**")
- .setColor("GREEN")
- .addField("INPUT", "```" + code + "```")
- .addField("OUTPUT", "```" + evaled + "```");
- return message.channel.send(ss);
- } catch (e) {
- console.log(e.stack);
- const err = new Discord.RichEmbed()
- .setDescription("**ERROR**")
- .setColor("RED")
- .addField("Error:", e);
- return message.channel.send(err);
- }
- }
- if (command === `${prefix}ls` || command === mentionprefix + "ls") {
- const lister = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> Only the bot owner can use this command!"
- );
- if (message.author.id !== ownerID) return message.channel.send(lister);
- var index = 1;
- var guilds = bot.guilds.map(g => g.name);
- var guilds1 = bot.guilds.map(
- g => `\`${index++}\` ` + `**${g.name}**` + ` == ${g.members.size}`
- );
- try {
- let perChunk = 25;
- let arrays = guilds1.reduce((resultArray, item, x) => {
- const chunkIndex = Math.floor(x / perChunk);
- if (!resultArray[chunkIndex]) {
- resultArray[chunkIndex] = []; // start a new chunk
- }
- resultArray[chunkIndex].push(item);
- return resultArray;
- }, []);
- for (var i = 0; i < arrays.length; i++) {
- message.channel.send(arrays[i].join("\n"));
- }
- } catch (err) {}
- const reply = new Discord.RichEmbed()
- .setColor("7f7f7f")
- .setDescription(
- "<:arrow:536727698932891672> Reply with a name/number to output an invite link."
- );
- message.channel.send(reply);
- try {
- var response = message.channel
- .awaitMessages(
- message2 => message2.author.id === message.author.id,
- {
- maxMatches: 1,
- time: 60000,
- errors: ["time"]
- }
- )
- .then(collected => {
- var msg1 = collected.first().content;
- var msg = parseInt(msg1) - 1 || msg1;
- var idx = guilds.indexOf(msg);
- if (idx == -1) {
- idx = msg;
- }
- var guild = bot.guilds.find(g => g.name == guilds[idx]);
- var channels = guild.channels.map(c => c.id);
- var channel = bot.channels.get(channels[1]);
- channel
- .createInvite()
- .then(invite => message.channel.send(`${invite.url}`))
- .catch(err => message.channel.send(`${err}`));
- })
- .catch(err => {
- console.log(err);
- const timeout = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription("<:no:534824114767265823> Response timed out.");
- message.channel.send(timeout);
- });
- } catch (err) {}
- }
- if (
- command === `${prefix}restart` ||
- command === mentionprefix + "restart"
- ) {
- const restarter = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> Only the bot owner can use this command!"
- );
- if (message.author.id !== ownerID)
- return message.channel.send(restarter);
- const pass = args.join(" ");
- const blacklister = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> Enter the password in order to restart Moddest."
- );
- if (pass.length < 1) return message.channel.send(blacklister);
- if (pass === settings.password) {
- const success = new Discord.RichEmbed()
- .setColor("00ae86")
- .setDescription(
- "<:yes:534711053511163914> Successful... Give me 10 seconds..."
- );
- message.channel.send(success);
- setTimeout(function() {
- process.exit();
- }, 1000);
- } else return message.channel.send(wrong);
- }
- //---------------------------------------------------------------------------------------------------
- // HELP COMMANDS
- if (command === prefix + "help" || command === mentionprefix + "help") {
- var color = [
- "#000001",
- "#000001",
- "#000001",
- "#000001",
- "#000001",
- "#000001",
- "#000001"
- ];
- var colors = color[Math.floor(Math.random() * color.length)];
- let killoff = args[0];
- if (killoff == null) {
- const help = new Discord.RichEmbed()
- .setDescription(
- "Hello, " +
- message.author.username +
- `! I am ${bot.user.username} and here are my commands:`
- )
- .setColor(colors)
- .setThumbnail("https://downloadmoredownloads.download/i/huoq.gif")
- .addField(
- "<:red_ballons:534809072952803338> fun",
- `**[>>help fun](https://moddest.xyz/commands/fun)**`
- )
- .addField(
- "<:brown_scroll:534809207934025728> basic",
- "**[>>help basic](https://moddest.xyz/commands/basic)**"
- )
- .addField(
- "<:grey_gear:534809164963250176> config",
- "**[>>help config](https://moddest.xyz/commands/configural)**"
- )
- .addField(
- "<:mod_hammer:534809245560995850> mod",
- "**[>>help mod](https://moddest.xyz/commands/moderation)**"
- )
- .addField(
- "<:sync:534809138086281227> sync",
- "**[>>help sync](https://moddest.xyz/commands/sync)**"
- )
- .addField(
- "<:hidden_image:534810635528306698>",
- "[Support Server](https://discord.gg/z2PdSqH) / [Website](https://moddest.xyz/) / [Vote](https://discordbots.org/bot/522771517365420032/vote)"
- )
- .setFooter(
- "You can also click on the blue commands to go to the bot's online documentation."
- );
- message.channel.send(help);
- }
- if (killoff === "basic") {
- const basic = new Discord.RichEmbed()
- .setColor(colors)
- .setDescription("<:brown_scroll:534809207934025728> - basic")
- .addField(
- `${prefix}invite`,
- "sends an invite link for you to add this bot to your server"
- )
- .addField(
- `${prefix}support`,
- "retrieves the support server's invite link for you."
- )
- .addField(
- `${prefix}youtube <SEARCHSTRING>`,
- "Searches youtube for a video."
- )
- .addField(
- `${prefix}urban <searchstring>`,
- "Searches a word using urban dictionary"
- )
- .addField(`${prefix}info`, "shows the bot information")
- .addField(
- `${prefix}serverinfo`,
- "view some information about the server"
- )
- .addField(
- `${prefix}addrole <ROLE ID>`,
- "will give a role to the author (you must have manage roles permission, and the bot must be higher than the role you are trying to give)."
- )
- .addField(
- `${prefix}avatar <USERMENTION OR NOTHING>`,
- "gets avatar of you or someone else"
- )
- .addField(
- `${prefix}goodbye`,
- "bot leaves the server, server owner can only use this command."
- )
- .addField(
- `${prefix}find <USER_ID>`,
- "finds the user ID and displays their name & some information (they don't have to be in the server)"
- )
- .addField(
- `${prefix}setregion <regionname>`,
- "sets the server region ('japan', 'singapore', 'eu-central', 'us-central', 'london', 'eu-west', 'amsterdam', 'brazil', 'us-west', 'hongkong', 'us-south', 'southafrica', 'us-east', 'sydney', 'frankfurt', 'russia')"
- );
- message.channel.send(basic);
- }
- if (killoff === "fun") {
- const fun = new Discord.RichEmbed()
- .setColor(colors)
- .setDescription("<:red_ballons:534809072952803338> - fun")
- .addField(
- `${prefix}roast <USERMENTION OR NOTHING>`,
- "roast someone like a boss"
- )
- .addField(
- `${prefix}clone <USERID> <MESSAGE>`,
- "clone someone"
- )
- .addField(
- `${prefix}impost <NAME> <IMAGE URL> <MESSAGE>`,
- "create a custom impost message."
- )
- .addField(`${prefix}dice <0-whatever>`, "rolls a dice")
- .addField(
- `${prefix}poll <QUESTION>`,
- "generates a yes/no poll (reactions)"
- )
- .addField(
- `${prefix}charactercount <MESSAGE>`,
- "counts how many characters you have in a message."
- )
- .addField(`${prefix}reverse <MESSAGE>`, "reverses your message")
- .addField(`${prefix}say <QUOTE>`, "gets the bot to say something");
- message.channel.send(fun);
- }
- if (killoff === "mod") {
- const moderator = new Discord.RichEmbed()
- .setColor(colors)
- .setDescription("<:mod_hammer:534809245560995850> - mod")
- .addField(
- `${prefix}kick <USERMENTION>`,
- "kick someone from the server (Sends them a reason if provided)"
- )
- .addField(
- `${prefix}ban <USERMENTION>`,
- "ban someone from the server (Sends them a reason if provided)"
- )
- .addField(
- `${prefix}rolekick <ROLEMENTION OR NAME>`,
- "kicks every member in that role"
- )
- .addField(
- `${prefix}roleban <ROLEMENTION OR NAME>`,
- "bans every member in that role"
- )
- .addField(
- `${prefix}idban <ID>`,
- "bans someone by ID, they can even not be in the server"
- )
- .addField(
- `${prefix}unban <username/id>`,
- "unbans the user, works both with username & ID, if it cannot find the user by ID it will search through the banned users"
- )
- .addField(
- `${prefix}purge <NUMBER OR NOTHING>`,
- "deletes specified amount of messages in the channel."
- )
- .addField(`${prefix}mute <USERMENTION>`, "mute someone")
- .addField(`${prefix}unmute <USERMENTION>`, "unmute someone");
- message.channel.send(moderator);
- }
- if (killoff === "sync") {
- const http = new Discord.RichEmbed()
- .setColor(colors)
- .setDescription("<:sync:534809138086281227> - sync")
- .addField(
- `${prefix}bansync <USER ID>`,
- "or >>sban <USER_ID>, bans a member from all servers you have administrator permissions in."
- )
- .addField(
- `${prefix}kicksync <USER ID>`,
- "or >>skick <USER_ID>, kicks a member from all servers you have administrator permissions in."
- )
- .addField(
- `${prefix}synced`,
- "lists all the servers the synced commands will work in with your current permissions."
- )
- .addField(
- `${prefix}unbansync <USER ID>`,
- "unbans a member from all servers you have administrator permissions in."
- );
- message.channel.send(http);
- }
- if (killoff === "config") {
- const confi = new Discord.RichEmbed()
- .setColor(colors)
- .setDescription("<:grey_gear:534809164963250176> - config")
- .addField(`${prefix}cinfo`, "shows server configuration info.")
- .addField(`${prefix}nick <NICKNAME>`, "changes the bot's nickname")
- .addField(`${prefix}resetnick`, "resets the bot's nickname")
- .addField(
- `${prefix}toggleantialt <on/off> <1-Whatever>`,
- "prevents alt accounts, if setting is on, accounts must be older than from 1 to whatever you typed Day(s) in order to join this server."
- )
- .addField(
- `${prefix}toggleantiads <on/off> <delete/kick/ban>`,
- "toggle anti advertisement links on/off, this will either delete the message if it was posted, kick the member if they post ads, or ban the member if they post ads, your choice to select one of them."
- )
- .addField(
- `${prefix}antiadswhitelist <CHANNELMENTION>`,
- "set a whitelisted channel for anti-advertisement links, only one can get selected (users will not get deleted/kicked/banned if they post links in that channel)"
- )
- .addField(`${prefix}removewhitelist`, "remove whitelisted channel")
- .addField(
- `${prefix}userads <on/off> <kick/ban>`,
- "kicks or bans user if their username contains discord.gg ads (Only works when user joins)"
- )
- .addField(
- `${prefix}togglemodlog <on/off> <channel>`,
- "sets where to place modlogs (MODLOGS ARE: ban, unban, kick, mute and unmute) bot automaticly log them there if one of these events are initiated"
- );
- message.channel.send(confi);
- }
- if (killoff === "owner") {
- const hidden = new Discord.RichEmbed()
- .setColor(colors)
- .addField(`${prefix}eval`, "Evaluates code")
- .addField(
- `${prefix}ls`,
- "Lists all the servers with the current members"
- )
- .addField(
- `${prefix}blacklist <USER ID> <REASON>`,
- "blacklists someone from using the bot"
- )
- .addField(`${prefix}unblacklist <USERID>`, "unblacklists the user")
- .addField(
- `${prefix}setgame <GAMENAME>`,
- "sets the playing status for the bot"
- )
- .addField(`${prefix}restart <PASSWORD>`, "restarts the bot");
- message.channel.send(hidden);
- }
- }
- //---------------------------------------------------------------------------------------------------
- // SYNC COMMANDS
- if (
- command === `${prefix}synced` ||
- command === mentionprefix + "synced"
- ) {
- const syncer = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> You must have 'ADMINISTRATOR' permission to use this command."
- );
- if (
- !message.member.hasPermission("ADMINISTRATOR") &&
- message.author.id !== ownerID
- )
- return message.channel.send(syncer);
- let lol = bot.guilds.filter(
- r =>
- r.members.has(message.member.id) &&
- r.members.get(message.member.id).hasPermission("ADMINISTRATOR")
- );
- lol.forEach(async (guild, id) => {});
- const syncer2 = new Discord.RichEmbed()
- .setColor("00ae86")
- .setDescription(
- "<:yes:534711053511163914> Sync commands will work on " +
- lol.size +
- " servers: \n (" +
- lol.map(r => r.name) +
- ") \n But you must [vote](https://discordbots.org/bot/522771517365420032/vote) to use them!"
- );
- message.channel.send(syncer2);
- }
- if (
- command === `${prefix}bansync` ||
- command === `${mentionprefix}bansync`
- ) {
- dbl
- .hasVoted(message.author.id)
- .then(voted => {
- if (voted) {
- const bansyncer1 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> You must have 'ADMINISTRATOR' permission to use this command."
- );
- if (
- !message.member.hasPermission("ADMINISTRATOR") &&
- message.author.id !== ownerID
- )
- return message.channel.send(bansyncer1);
- const who = args.join(" ");
- const bansyncer2 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> Please provide a valid user ID to use bansync."
- );
- if (who.length < 1) return message.channel.send(bansyncer2);
- let lol = bot.guilds.filter(
- r =>
- r.members.has(message.member.id) &&
- r.members
- .get(message.member.id)
- .hasPermission("ADMINISTRATOR")
- );
- bot
- .fetchUser(who)
- .then(r => {
- lol.forEach(async (guild, id) => {
- guild.ban(who);
- });
- const bansyncer3 = new Discord.RichEmbed()
- .setColor("00ae86")
- .setDescription(
- "<:yes:534711053511163914> ID: " +
- r.id +
- " (" +
- r.tag +
- ")" +
- " has been bansynced from: \n (" +
- lol.map(r => r.name) +
- ")"
- );
- message.channel.send(bansyncer3);
- })
- .catch(err =>
- message.channel.send(
- "<:no:534824114767265823> `User could not be found.`"
- )
- );
- } else {
- const nonvoter = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> You must [vote](https://discordbots.org/bot/522771517365420032/vote) to use this command! \n Note: It can take up to 5 minutes to register, although highliy unlikely. "
- );
- message.channel.send(nonvoter);
- }
- })
- .catch(e => {
- console.log(e);
- });
- }
- if (
- command === `${prefix}kicksync` ||
- command === `${mentionprefix}kicksync`
- ) {
- dbl
- .hasVoted(message.author.id)
- .then(voted => {
- if (voted) {
- const kicksyncer1 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> You must have 'ADMINISTRATOR' permission to use this command."
- );
- if (
- !message.member.hasPermission("ADMINISTRATOR") &&
- message.author.id !== ownerID
- )
- return message.channel.send(kicksyncer1);
- const who = args.join(" ");
- const kicksyncer2 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> Please provide a valid user ID to use kicksync."
- );
- if (who.length < 1) return message.channel.send(kicksyncer2);
- let lol = bot.guilds.filter(
- r =>
- r.members.has(message.member.id) &&
- r.members
- .get(message.member.id)
- .hasPermission("ADMINISTRATOR")
- );
- bot
- .fetchUser(who)
- .then(r => {
- lol.forEach(async (guild, id) => {
- guild.kick(who);
- });
- const kicksyncer3 = new Discord.RichEmbed()
- .setColor("00ae86")
- .setDescription(
- "<:yes:534711053511163914> ID: " +
- r.id +
- " (" +
- r.tag +
- ")" +
- " has been kicksynced from: \n (" +
- lol.map(r => r.name) +
- ")"
- );
- message.channel.send(kicksyncer3);
- })
- .catch(err =>
- message.channel.send(
- "<:no:534824114767265823> `User could not be found.`"
- )
- );
- } else {
- const nonvoter = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> You must [vote](https://discordbots.org/bot/522771517365420032/vote) to use this command! \n Note: It can take up to 5 minutes to register, although highliy unlikely. "
- );
- message.channel.send(nonvoter);
- }
- })
- .catch(e => {
- console.log(e);
- });
- }
- if (
- command === `${prefix}unbansync` ||
- command === `${mentionprefix}unbansync`
- ) {
- dbl
- .hasVoted(message.author.id)
- .then(voted => {
- if (voted) {
- const unbansyncer1 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> You must have 'ADMINISTRATOR' permission to use this command."
- );
- if (
- !message.member.hasPermission("ADMINISTRATOR") &&
- message.author.id !== ownerID
- )
- return message.channel.send(unbansyncer1);
- const who = args.join(" ");
- const unbansyncer2 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> Please provide a valid user ID to use unbansync."
- );
- if (who.length < 1) return message.channel.send(unbansyncer2);
- let lol = bot.guilds.filter(
- r =>
- r.members.has(message.member.id) &&
- r.members
- .get(message.member.id)
- .hasPermission("ADMINISTRATOR")
- );
- bot
- .fetchUser(who)
- .then(r => {
- lol.forEach(async (guild, id) => {
- guild.unban(who);
- });
- const unbansyncer3 = new Discord.RichEmbed()
- .setColor("00ae86")
- .setDescription(
- "<:yes:534711053511163914> ID: " +
- r.id +
- " (" +
- r.tag +
- ")" +
- " has been unbansynced from: \n (" +
- lol.map(r => r.name) +
- ")"
- );
- message.channel.send(unbansyncer3);
- })
- .catch(err =>
- message.channel.send(
- "<:no:534824114767265823> `User could not be found.`"
- )
- );
- } else {
- const nonvoter = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> You must [vote](https://discordbots.org/bot/522771517365420032/vote) to use this command! \n Note: It can take up to 5 minutes to register, although highliy unlikely. "
- );
- message.channel.send(nonvoter);
- }
- })
- .catch(e => {
- console.log(e);
- });
- }
- //---------------------------------------------------------------------------------------------------
- // MOD COMMANDS
- if (command === `${prefix}mute`) {
- const muter1 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> You must have 'MANAGE_MESSAGES' permission to use this command"
- );
- if (
- !message.member.hasPermission("MANAGE_MESSAGES") &&
- message.author.id !== ownerID
- )
- return message.channel.send(muter1);
- let role = message.guild.roles.find(r => r.name === "Muted");
- let toMute = message.guild.member(
- message.mentions.users.first() || bot.users.get(args[0])
- );
- const muter2 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> Please add 'MANAGE_MESSAGES' permission to me."
- );
- if (!message.guild.member(botID).hasPermission("MANAGE_MESSAGES"))
- return message.channel.sendMessage(muter2);
- const muter3 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> Please enter a valid ID or mention a user to mute them."
- );
- if (!toMute) return message.channel.sendMessage(muter3);
- const muter4 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription("<:no:534824114767265823> You cannot mute yourself.");
- if (toMute.id === message.author.id)
- return message.channel.sendMessage(muter4);
- const muter5 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> You cannot mute someone higher role than you."
- );
- if (toMute.highestRole.position >= message.member.highestRole.position)
- return message.channel.sendMessage(muter5);
- if (!role) {
- try {
- role = message.guild.createRole({
- name: "Muted",
- color: "#000001",
- permissions: []
- });
- message.guild.channels.forEach(async (channel, id) => {
- channel.overwritePermissions(role.id, {
- SEND_MESSAGES: false,
- ADD_REACTIONS: false
- });
- });
- } catch (e) {
- console.log(e.stack);
- }
- }
- if (role) {
- try {
- message.guild.channels.forEach(async (channel, id) => {
- channel.overwritePermissions(role.id, {
- SEND_MESSAGES: false,
- ADD_REACTIONS: false
- });
- });
- } catch (e) {
- console.log(e.stack);
- }
- const muter6 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> " +
- toMute.user.username +
- " (" +
- toMute.user.id +
- ") is already muted."
- );
- if (toMute.roles.has(role.id))
- return message.channel.sendMessage(muter6);
- toMute.addRole(role);
- const muter7 = new Discord.RichEmbed()
- .setColor("00ae86")
- .setDescription(
- "<:yes:534711053511163914> " +
- toMute.user.username +
- " (" +
- toMute.user.id +
- ") has been muted. \n Execute `>>unmute " +
- toMute.user.id +
- "` to undo."
- );
- message.channel.sendMessage(muter7);
- return;
- }
- }
- if (command === `${prefix}unmute`) {
- const unmuter1 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> You must have 'MANAGE_MESSAGES' permission to use this command."
- );
- if (
- !message.member.hasPermission("MANAGE_MESSAGES") &&
- message.author.id !== ownerID
- )
- return message.channel.send(unmuter1);
- const who = message.mentions.users.first() || bot.users.get(args[0]);
- const unmuter2 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> Please enter a valid ID or mention a user to unmute them."
- );
- if (!who) return message.channel.send(unmuter2);
- const role = message.guild.roles.find(r => r.name === "Muted");
- if (role) {
- message.guild.members.get(who.id).removeRole(role.id);
- const unmuter3 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> Please add 'MANAGE_MESSAGES' permission to me."
- );
- if (!message.guild.member(botID).hasPermission("MANAGE_MESSAGES"))
- return message.channel.sendMessage(unmuter3);
- const unmuter4 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> You cannot unmute yourself."
- );
- if (who.id === message.author.id)
- return message.channel.sendMessage(unmuter4);
- const unmuter5 = new Discord.RichEmbed()
- .setColor("00ae86")
- .setDescription(
- "<:yes:534711053511163914> " +
- who.username +
- " (" +
- who.id +
- ") has been unmuted."
- );
- message.channel.send(unmuter5);
- }
- }
- if (
- command === `${prefix}rolekick` ||
- command === `${mentionprefix}rolekick`
- ) {
- dbl
- .hasVoted(message.author.id)
- .then(voted => {
- if (voted) {
- const rkicker1 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> You must have 'KICK_MEMBERS' permission to use this command."
- );
- if (
- !message.member.hasPermission("KICK_MEMBERS") &&
- message.author.id !== ownerID
- )
- return message.channel.send(rkicker1);
- const rkicker2 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> Please add 'KICK_MEMBERS' permission to me."
- );
- if (!message.guild.member(botID).hasPermission("KICK_MEMBERS"))
- return message.channel.send(rkicker2);
- const which =
- message.mentions.roles.first() ||
- message.guild.roles.find(r => r.name === args.join(" "));
- const rkicker3 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription("<:no:534824114767265823> Role not found.");
- if (!which) return message.channel.send(rkicker3);
- let lmao = message.guild.fetchMembers().then(them => {
- let rofl = message.guild.members.filter(r =>
- r.roles.has(which.id)
- );
- rofl.forEach(async (member, id) => {
- member.kick();
- });
- const rkicker4 = new Discord.RichEmbed()
- .setColor("00ae86")
- .setDescription(
- "<:yes:534711053511163914> Kicked " +
- rofl.size +
- " member(s)."
- );
- message.channel.send(rkicker4);
- });
- } else {
- const nonvoter = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> You must [vote](https://discordbots.org/bot/522771517365420032/vote) to use this command! \n Note: It can take up to 5 minutes to register, although highliy unlikely. "
- );
- message.channel.send(nonvoter);
- }
- })
- .catch(e => {
- console.log(e);
- });
- }
- if (
- command === `${prefix}roleban` ||
- command === `${mentionprefix}roleban`
- ) {
- dbl
- .hasVoted(message.author.id)
- .then(voted => {
- if (voted) {
- const rbanner1 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> You must have 'BAN_MEMBERS' permission to use this command."
- );
- if (
- !message.member.hasPermission("BAN_MEMBERS") &&
- message.author.id !== ownerID
- )
- return message.channel.send(rbanner1);
- const rbanner2 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> Please add 'BAN_MEMBERS' permission to me."
- );
- if (!message.guild.member(botID).hasPermission("BAN_MEMBERS"))
- return message.channel.send(rbanner2);
- const which =
- message.mentions.roles.first() ||
- message.guild.roles.find(r => r.name === args.join(" "));
- const rbanner3 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription("<:no:534824114767265823> Role not found.");
- if (!which) return message.channel.send(rbanner3);
- let lmao = message.guild.fetchMembers().then(them => {
- let rofl = message.guild.members.filter(r =>
- r.roles.has(which.id)
- );
- rofl.forEach(async (member, id) => {
- member.ban();
- });
- const rbanner4 = new Discord.RichEmbed()
- .setColor("00ae86")
- .setDescription(
- "<:yes:534711053511163914> Banned " +
- rofl.size +
- " member(s)."
- );
- message.channel.send(rbanner4);
- });
- } else {
- const nonvoter = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> You must [vote](https://discordbots.org/bot/522771517365420032/vote) to use this command! \n Note: It can take up to 5 minutes to register, although highliy unlikely. "
- );
- message.channel.send(nonvoter);
- }
- })
- .catch(e => {
- console.log(e);
- });
- }
- if (command === `${prefix}purge` || command === mentionprefix + "purge") {
- message.delete();
- if (
- !message.member.hasPermission("MANAGE_MESSAGES") &&
- message.author.id !== ownerID
- )
- return message.channel.send(
- "`You must have 'MANAGE_MESSAGES' permission to use this command`"
- );
- const messagecount = args[0];
- console.log(messagecount);
- const purger1 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> Please add 'MANAGE_MESSAGES' Permission to me. "
- );
- if (!message.guild.member(botID).hasPermission("MANAGE_MESSAGES"))
- return message.channel.send(purger1);
- message.channel
- .fetchMessages({
- limit: messagecount,
- before: message.id
- })
- .then(messages => message.channel.bulkDelete(messages))
- .then(messages =>
- message.channel.send(
- "<:yes:534711053511163914> Deleting..."
- )
- )
- .then(r => r.delete("1000"));
- }
- if (command === `${prefix}kick` || command === mentionprefix + "kick") {
- const kicker1 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> You must have 'KICK_MEMBERS' permission to use this command."
- );
- if (
- !message.member.hasPermission("KICK_MEMBERS") &&
- message.author.id !== ownerID
- )
- return message.channel.send(kicker1);
- const who = message.mentions.users.first() || bot.users.get(args[0]);
- const kicker2 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> Please enter a valid ID or mention a user to kick them."
- );
- if (!who) return message.channel.send(kicker2);
- const reason = args.slice(1).join(" ");
- const reason2 =
- reason !== args.slice(1).join(" ").length > 1
- ? reason
- : "Admin has not given a reason.";
- const kicker3 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> Please add 'KICK_MEMBERS' permission to me."
- );
- if (!message.guild.member(botID).hasPermission("KICK_MEMBERS"))
- return message.channel.send(kicker3);
- const kicker4 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription("<:no:534824114767265823> You cannot kick yourself.");
- if (who.id === message.author.id) return message.channel.send(kicker4);
- const kicker5 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> " + who.username + " cannot be kicked."
- );
- if (!message.guild.member(who.id).kickable)
- return message.channel.send(kicker5);
- const kicker6 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> You have been kicked from " +
- message.guild.name +
- ". You can rejoin at anytime."
- );
- let lmao = who.send(kicker6);
- setTimeout(function() {
- message.guild.member(who).kick();
- }, 1000);
- const kicker7 = new Discord.RichEmbed()
- .setColor("00ae86")
- .setDescription(
- "<:yes:534711053511163914> " +
- who.username +
- " (" +
- who.id +
- ") has been kicked, but can rejoin at anytime."
- );
- message.channel.send(kicker7);
- }
- if (command === `${prefix}ban` || command === mentionprefix + "ban") {
- const banner1 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> You must have 'BAN_MEMBERS' permission to use this command."
- );
- if (
- !message.member.hasPermission("BAN_MEMBERS") &&
- message.author.id !== ownerID
- )
- return message.channel.send(banner1);
- const who = message.mentions.users.first() || bot.users.get(args[0]);
- const banner2 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> Please enter a valid ID or mention a user to ban them."
- );
- if (!who) return message.channel.send(banner2);
- const reason = args.slice(1).join(" ");
- const reason2 =
- reason !== args.slice(1).join(" ").length > 1
- ? reason
- : "Admin has not given a reason.";
- const banner3 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> Please add 'BAN_MEMBERS' permission to me."
- );
- if (!message.guild.member(botID).hasPermission("BAN_MEMBERS"))
- return message.channel.send(banner3);
- const banner4 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription("<:no:534824114767265823> You cannot ban yourself.");
- if (who.id === message.author.id) return message.channel.send(banner4);
- const banner5 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> " + who.username + " cannot be banned."
- );
- if (!message.guild.member(who.id).bannable)
- return message.channel.send(banner5);
- const banner6 = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> You have been banned from " +
- message.guild.name +
- " \n Reason: `" +
- reason2 +
- "`"
- );
- let lmao = who.send(banner6);
- setTimeout(function() {
- message.guild
- .member(who)
- .ban({ reason: reason2 + " || Banned by: " + message.author.tag });
- }, 1000);
- const banner7 = new Discord.RichEmbed()
- .setColor("00ae86")
- .setDescription(
- "<:yes:534711053511163914> " +
- who.username +
- " (" +
- who.id +
- ") has been banned. \n Reason: `" +
- reason2 +
- "`"
- );
- message.channel.send(banner7);
- }
- // if(command === `${prefix}ban` || command === mentionprefix + "ban") {
- // const banner1 = new Discord.RichEmbed()
- // .setColor("FF3131")
- // .setDescription("<:no:534824114767265823> You must have 'BAN_MEMBERS' permission to use this command.")
- // if(!message.member.hasPermission("BAN_MEMBERS") && message.author.id !== ownerID) return message.channel.send(banner1)
- // const who = message.mentions.users.first() || bot.users.get(args[0])
- // const banner2 = new Discord.RichEmbed()
- // .setColor("FF3131")
- // .setDescription("<:no:534824114767265823> Please enter a valid ID or mention a user to ban them.")
- // if(!who) return message.channel.send(banner2)
- // const reason = args.slice(1).join(' ')
- // const reason2 = reason !== args.slice(1).join(' ').length > 1 ? reason : "Admin has not given a reason."
- // const banner3 = new Discord.RichEmbed()
- // .setColor("FF3131")
- // .setDescription("<:no:534824114767265823> Please add 'BAN_MEMBERS' permission to me.")
- // if(!message.guild.member(botID).hasPermission("BAN_MEMBERS")) return message.channel.send(banner3)
- // const banner4 = new Discord.RichEmbed()
- // .setColor("FF3131")
- // .setDescription("<:no:534824114767265823> You cannot ban yourself.")
- // if(who.id === message.author.id) return message.channel.send(banner4)
- // const banner5 = new Discord.RichEmbed()
- // .setColor("FF3131")
- // .setDescription("<:no:534824114767265823> " + who.username + " cannot be banned.")
- // if(!message.guild.member(who.id).bannable) return message.channel.send(banner5)
- // const banner6 = new Discord.RichEmbed()
- // .setColor("FF3131")
- // .setDescription("<:no:534824114767265823> You have been banned from " + message.guild.name + ". \n Reason: " + reason2 + " ")
- // const banner7 = new Discord.RichEmbed()
- // .setColor("FF3131")
- // .setDescription("<:no:534824114767265823> Failed to send message to " + who.username + "most likely they have disabled direct messages, or the bot was too slow.")
- // let lmao = who.send(banner6).catch(err=> message.channel.send(banner7))
- // setTimeout(function() {
- // message.guild.member(who).ban({reason: reason2 + " || Banned by: " + message.author.tag})
- // }, 1000)
- // const banner8 = new Discord.RichEmbed()
- // .setColor("00ae86")
- // .setDescription("<:yes:534711053511163914> " + who.username + " Has been banned. \n Reason: " + reason)
- // message.channel.send(banner8)
- // }
- if (command === `${prefix}unban` || command === mentionprefix + "unban") {
- if (
- !message.member.hasPermission("BAN_MEMBERS") &&
- message.author.id !== ownerID
- )
- return message.channel.send(
- "`You must have 'BAN_MEMBERS' permission to use this command`"
- );
- if (!message.guild.member(bot.user.id).hasPermission("BAN_MEMBERS"))
- return message.channel.send(
- "`I need 'BAN_MEMBERS' permission to unban users`"
- );
- const who = args.join(" ");
- message.guild
- .fetchBans()
- .then(r => {
- const what = r.filter(
- r => r.username.startsWith(who) || r.id === who
- );
- message.guild.unban(what.first().id);
- message.channel.send("`Unbanned '" + what.map(r => r.tag) + "'`");
- })
- .catch(err => message.channel.send("`Could not find the user`"));
- }
- if (command === `${prefix}idban` || command === mentionprefix + "idban") {
- if (
- !message.member.hasPermission("BAN_MEMBERS") &&
- message.author.id !== ownerID
- )
- return message.channel.send(
- "`You must have 'BAN_MEMBERS' permission to use this command`"
- );
- if (!message.guild.member(bot.user.id).hasPermission("BAN_MEMBERS"))
- return message.channel.send(
- "`I need 'BAN_MEMBERS' permission to ban users`"
- );
- const who = args.join(" ");
- if (who.length < 1)
- return message.channel.send(
- "`" + "Please provide an ID to ban" + "`"
- );
- bot
- .fetchUser(who)
- .then(r => {
- message.guild.ban(who, { reason: "ID Banned" });
- message.channel.send("`" + "Banned ID: " + who + "`");
- })
- .catch(err => message.channel.send("`Could not find the user ID`"));
- }
- //---------------------------------------------------------------------------------------------------
- // CONGIFURAL COMMANDS
- if (command === `${prefix}cinfo` || command === mentionprefix + "info") {
- if (!message.member.hasPermission("MANAGE_GUILD"))
- return message.channel.send(
- "`You must have 'MANAGE_GUILD' permission to use this command`"
- );
- var color = [
- "#df0736",
- "#df0736",
- "#df0736",
- "#df0736",
- "#df0736",
- "#df0736",
- "#df0736"
- ];
- var colors = color[Math.floor(Math.random() * color.length)];
- fs.readFile(
- "./config/" + message.guild.id + "/setting.txt",
- "utf8",
- function(err, data) {
- fs.readFile(
- "./config/" + message.guild.id + "/message.txt",
- "utf8",
- function(err2, data2) {
- fs.readFile(
- "./config/" + message.guild.id + "/channel.txt",
- "utf8",
- function(err3, data3) {
- fs.readFile(
- "./config/" + message.guild.id + "/gsetting.txt",
- "utf8",
- function(err4, data4) {
- fs.readFile(
- "./config/" + message.guild.id + "/gchannel.txt",
- "utf8",
- function(err5, data5) {
- fs.readFile(
- "./config/" + message.guild.id + "/gmessage.txt",
- "utf8",
- function(err6, data6) {
- fs.readFile(
- "./antialt/" +
- message.guild.id +
- "/config.txt",
- "utf8",
- function(err7, data7) {
- fs.readFile(
- "./antialt/" +
- message.guild.id +
- "/date.txt",
- "utf8",
- function(err7, data8) {
- fs.readFile(
- "./antiads/" +
- message.guild.id +
- "/en.txt",
- "utf8",
- function(err7, data9) {
- fs.readFile(
- "./antiads/" +
- message.guild.id +
- "/setting.txt",
- "utf8",
- function(err7, data10) {
- fs.readFile(
- `./antiads/${
- message.guild.id
- }/whitelist.txt`,
- "utf8",
- function(err, data11) {
- fs.readFile(
- `./modsetting/${
- message.guild.id
- }/setting.txt`,
- "utf8",
- function(err, data12) {
- fs.readFile(
- `./modchannel/${
- message.guild.id
- }/setting.txt`,
- "utf8",
- function(
- err,
- data13
- ) {
- fs.readFile(
- `./userads/${
- message.guild.id
- }/en.txt`,
- "utf8",
- function(
- err,
- data14
- ) {
- fs.readFile(
- `./userads/${
- message
- .guild.id
- }/setting.txt`,
- "utf8",
- function(
- err,
- data15
- ) {
- fs.readFile(
- `./customcom/prefix/${
- message
- .guild
- .id
- }/prefix.txt`,
- "utf8",
- function(
- err,
- data16
- ) {
- const info = new Discord.RichEmbed()
- .setDescription(
- message
- .guild
- .name +
- " Configuration Settings"
- )
- .setColor(
- colors
- )
- .addField(
- "Anti-alt",
- data7 ===
- undefined
- ? "None"
- : data7
- )
- .addField(
- "Anti-alt days",
- data8 +
- " day(s)"
- )
- .addField(
- "Anti-ads",
- data9 ===
- undefined
- ? "None"
- : data9
- )
- .addField(
- "Anti-ads setting",
- data10 ===
- undefined
- ? "None"
- : data10
- )
- .addField(
- "Whitelisted channel",
- data11 ===
- undefined
- ? "None"
- : "<#" +
- data11 +
- ">"
- )
- .addField(
- "Modlogs",
- data12 ===
- undefined
- ? "None"
- : data12
- )
- .addField(
- "Modlog channel",
- data13 ===
- undefined
- ? "None"
- : "<#" +
- data13 +
- ">"
- )
- .addField(
- "Anti-user ads",
- data14 ===
- undefined
- ? "None"
- : data14
- )
- .addField(
- "Anti-user ads configuration",
- data15 ===
- undefined
- ? "None"
- : data15
- );
- message.channel.send(
- info
- );
- }
- );
- }
- );
- }
- );
- }
- );
- }
- );
- }
- );
- }
- );
- }
- );
- }
- );
- }
- );
- }
- );
- }
- );
- }
- );
- }
- );
- }
- );
- }
- );
- }
- if (command === `${prefix}nick` || command === `${mentionprefix}nick`) {
- if (!message.member.hasPermission("MANAGE_NICKNAMES"))
- return message.channel.send(
- "<:no:534824114767265823> You must have 'MANAGE_NICKNAMES' permission to use this command."
- );
- const what = args.join(" ");
- if (!what)
- return message.channel.send("<:no:534824114767265823> You must provide a nickname.");
- message.guild.member(botID).setNickname(what);
- message.channel.send("<:yes:534711053511163914> Nickname set to: `" + what + "`");
- }
- if (
- command === `${prefix}resetnick` ||
- command === `${mentionprefix}resetnick`
- ) {
- if (!message.member.hasPermission("MANAGE_NICKNAMES"))
- return message.channel.send(
- "<:no:534824114767265823> You must have 'MANAGE_NICKNAMES' permission to use this command."
- );
- message.guild.member(botID).setNickname(" ");
- message.channel.send("<:yes:534711053511163914> Nickname has been reset.");
- }
- if (
- command === `${prefix}toggleantiads` ||
- command === `${mentionprefix}toggleantiads`
- ) {
- if (!message.member.hasPermission("ADMINISTRATOR"))
- return message.channel.send(
- "<:no:534824114767265823>You must have 'ADMINISTRATOR' permission to use this command."
- );
- var dir = `./antiads/${message.guild.id}`;
- if (!fs.existsSync(dir)) {
- fs.mkdirSync(dir);
- }
- const what = args[0];
- if (what === "on") {
- const what2 = args.slice(1).join(" ");
- if (what2 === "delete") {
- fs.writeFile(`./antiads/${message.guild.id}/en.txt`, "on", function(
- err
- ) {
- fs.writeFile(
- `./antiads/${message.guild.id}/setting.txt`,
- "delete",
- function(err) {
- message.channel.send(
- "<:yes:534711053511163914> Advertisements will now be deleted immediately."
- );
- }
- );
- });
- }
- if (what2 === "kick") {
- fs.writeFile(`./antiads/${message.guild.id}/en.txt`, "on", function(
- err
- ) {
- fs.writeFile(
- `./antiads/${message.guild.id}/setting.txt`,
- "kick",
- function(err) {
- message.channel.send(
- "<:yes:534711053511163914> Advertisement posters will now be kicked immediately."
- );
- }
- );
- });
- }
- if (what2 === "ban") {
- fs.writeFile(`./antiads/${message.guild.id}/en.txt`, "on", function(
- err
- ) {
- fs.writeFile(
- `./antiads/${message.guild.id}/setting.txt`,
- "ban",
- function(err) {
- message.channel.send(
- "<:yes:534711053511163914> Advertisement posters will now be banned immediately."
- );
- }
- );
- });
- }
- }
- if (what === "off") {
- fs.writeFile(`./antiads/${message.guild.id}/en.txt`, "off", function(
- err
- ) {
- message.channel.send("`" + "Disabled anti ads" + "`");
- });
- }
- }
- if (
- command === `${prefix}antiadswhitelist` ||
- command === `${mentionprefix}antiadswhitelist`
- ) {
- if (!message.member.hasPermission("ADMINISTRATOR"))
- return message.channel.send(
- "<:no:534824114767265823> You must have 'ADMINISTRATOR' permission to use this command."
- );
- const chann = message.mentions.channels.first();
- if (!chann)
- return message.channel.send("<:no:534824114767265823> You must mention a channel.");
- fs.writeFile(
- `./antiads/${message.guild.id}/whitelist.txt`,
- chann.id,
- function(err) {
- message.channel.send(
- "<:yes:534711053511163914> `" +
- chann.name +
- " has been marked as a 'whitelisted channel' for advertisements." +
- "`"
- );
- }
- );
- }
- if (
- command === `${prefix}removewhitelist` ||
- command === `${mentionprefix}removewhitelist`
- ) {
- if (!message.member.hasPermission("ADMINISTRATOR"))
- return message.channel.send(
- "<:no:534824114767265823> You must have 'ADMINISTRATOR' permission to use this command."
- );
- fs.writeFile(
- `./antiads/${message.guild.id}/whitelist.txt`,
- "None",
- function(err) {
- message.channel.send(
- "<:yes:534711053511163914> Removed whitelisted channel for anti-ads."
- );
- }
- );
- }
- if (
- command === `${prefix}toggleantialt` ||
- command === `${mentionprefix}toggleantialt`
- ) {
- if (!message.member.hasPermission("ADMINISTRATOR"))
- return message.channel.send(
- "<:no:534824114767265823> You must have 'ADMINISTRATOR' permission to use this command."
- );
- var dir = `./antialt/${message.guild.id}`;
- if (!fs.existsSync(dir)) {
- fs.mkdirSync(dir);
- }
- const what = args[0];
- const what2 = args.slice(1).join(" ");
- if (what === "on") {
- if (what2.length < 1)
- return message.channel.send(
- "<:no:534824114767265823> Please provide a number of days from 1/3/7/14."
- );
- fs.writeFile(
- `./antialt/${message.guild.id}/config.txt`,
- "on",
- function(err) {
- fs.writeFile(
- `./antialt/${message.guild.id}/date.txt`,
- what2,
- function(err) {
- if (isNaN(what2))
- return message.channel.send("<:no:534824114767265823> You must provide a number. \n Example: >>toggleanitalt on 1");
- if (what2 === "0")
- return message.channel.send("<:no:534824114767265823> Anti-alt's minimum is 1 Day.");
- message.channel.send(
- "<:yes:534711053511163914> Accounts must now be older than `" +
- what2 +
- "` day(s) in order to join this server."
- );
- }
- );
- }
- );
- }
- if (what === "off") {
- fs.writeFile(
- `./antialt/${message.guild.id}/config.txt`,
- "off",
- function(err) {
- message.channel.send("<:yes:534711053511163914> Disabled Anti-alt.");
- }
- );
- }
- }
- if (
- command === `${prefix}userads` ||
- command === mentionprefix + "userads"
- ) {
- if (!message.member.hasPermission("ADMINISTRATOR"))
- return message.channel.send(
- "<:no:534824114767265823> You must have 'ADMINISTRATOR' permission to use this command."
- );
- var dir = `./userads/${message.guild.id}/`;
- if (!fs.existsSync(dir)) {
- fs.mkdirSync(dir);
- }
- const what = args[0];
- const what2 = args.slice(1).join(" ");
- if (what === "on") {
- if (what2 === "kick") {
- fs.writeFile(`./userads/${message.guild.id}/en.txt`, "on", function(
- err
- ) {
- fs.writeFile(
- `./userads/${message.guild.id}/setting.txt`,
- "kick",
- function(err) {
- message.channel.send("<:yes:534711053511163914> Anyone who joins the server with an advertisement in their name will now be kicked.");
- }
- );
- });
- }
- if (what2 === "ban") {
- fs.writeFile(`./userads/${message.guild.id}/en.txt`, "on", function(
- err
- ) {
- fs.writeFile(
- `./userads/${message.guild.id}/setting.txt`,
- "ban",
- function(err) {
- message.channel.send("<:yes:534711053511163914> Anyone who joins the server with an advertisement in their name will now be banned.");
- }
- );
- });
- }
- }
- if (what === "off") {
- fs.writeFile(`./userads/${message.guild.id}/en.txt`, "off", function(
- err
- ) {
- message.channel.send("<:yes:534711053511163914> User-ads is now disabled.");
- });
- }
- }
- // TOGGLEMODLOG is at the end of the code.
- //---------------------------------------------------------------------------------------------------
- // BASIC COMMANDS
- if (
- command === `${prefix}addrole` ||
- command === mentionprefix + "addrole"
- ) {
- if (
- !message.member.hasPermission("MANAGE_ROLES") &&
- message.author.id !== ownerID
- )
- return message.channel.send(
- "`You must have 'MANAGE_ROLES' permission to use this command`"
- );
- const whichrole = message.content.split(" ").slice(1)[0];
- if (!message.guild.roles.has(whichrole))
- return message.channel.send("`" + "Please provide a valid ID." + "`");
- message.member.addRole(whichrole);
- message.channel.send("`The role has been added successfully.`");
- }
- if (
- command === `${prefix}setregion` ||
- command === `${prefix}setregion`
- ) {
- if (!message.member.hasPermission("MANAGE_GUILD"))
- return message.channel.send(
- "`You don't have 'MANAGE_GUILD' permission`"
- );
- if (!message.guild.member(bot.user.id).hasPermission("MANAGE_GUILD"))
- return message.channel.send(
- "`I need 'MANAGE_GUILD' permission to execute this command`"
- );
- const what = args.join(" ");
- if (what.length < 1) return message.channel.send("`Provide a region`");
- message.guild.setRegion(what).catch(err => {
- if (err)
- return message.channel.send(
- "`Error, regions can be: 'japan', 'singapore', 'eu-central', 'us-central', 'london', 'eu-west', 'amsterdam', 'brazil', 'us-west', 'hongkong', 'us-south', 'southafrica', 'us-east', 'sydney', 'frankfurt', 'russia'`"
- );
- });
- message.channel.send("`Region has been set to " + what + "`");
- }
- if (message.guild.me.hasPermission("BAN_MEMBERS")) {
- message.guild
- .fetchBans()
- .then(r => {
- // use `r`
- })
- .catch(console.error);
- }
- if (
- command === `${prefix}invite` ||
- command === mentionprefix + "invite"
- ) {
- const invite = new Discord.RichEmbed()
- .setColor("00ae86")
- .setDescription(
- "<:yes:534711053511163914> [Use this link to add me to your server!](https://discordapp.com/oauth2/authorize?client_id=522771517365420032&permissions=2146958847&redirect_uri=https%3A%2F%2Fdiscord.gg%2F2YcFVRg&response_type=code&scope=bot%20guilds.join) "
- );
- message.channel.send(invite);
- }
- if (
- command === `${prefix}support` ||
- command === mentionprefix + "support"
- ) {
- const support = new Discord.RichEmbed()
- .setColor("00ae86")
- .setDescription(
- "<:yes:534711053511163914> https://discord.gg/7r5P5ug "
- );
- message.channel.send(support);
- }
- if (
- command === `${prefix}goodbye` ||
- command === mentionprefix + "goodbye"
- ) {
- const goodbyer = new Discord.RichEmbed()
- .setColor("FF3131")
- .setDescription(
- "<:no:534824114767265823> Only the server owner can use this command!"
- );
- if (
- message.author.id !== message.guild.owner.id &&
- message.author.id !== ownerID
- )
- return message.channel.send(goodbyer);
- const support = new Discord.RichEmbed()
- .setColor("00ae86")
- .setDescription(
- "<:yes:534711053511163914> I will be leaving now, add me back with [this link](https://discordapp.com/oauth2/authorize?client_id=522771517365420032&permissions=2146958847&redirect_uri=https%3A%2F%2Fdiscord.gg%2F2YcFVRg&response_type=code&scope=bot%20guilds.join) anytime! "
- );
- message.channel.send(support);
- bot.users
- .get(ownerID)
- .send(
- "`" +
- message.author.username +
- "#" +
- message.author.discriminator +
- " // used command leave on " +
- message.guild.name +
- "`"
- );
- setTimeout(function() {
- message.guild.leave();
- }, 1000);
- }
- if (
- command === `${prefix}avatar` ||
- command === mentionprefix + "avatar"
- ) {
- const who =
- message.mentions.users.first() ||
- bot.users
- .filter(r => r.username.startsWith(args[0]) || r.id === args[0])
- .first() ||
- message.author;
- var dir = `./finished/${message.guild.id}`;
- if (!fs.existsSync(dir)) {
- fs.mkdirSync(dir);
- }
- message.channel.send(who.avatarURL || who.defaultAvatarURL);
- }
- if (command === `${prefix}find` || command === mentionprefix + "find") {
- const who = args.join(" ");
- if (who.length < 1)
- return message.channel.send("`Provide an ID to find.`");
- bot
- .fetchUser(who)
- .then(r => {
- const lol = r.presence.game;
- const what = new Discord.RichEmbed()
- .setDescription("INFORMATION")
- .addField("Username", r.username + "#" + r.discriminator)
- .addField("Status", r.presence.status)
- .addField("Bot", r.bot)
- .addField(
- "Playing status",
- lol == null ? lol : r.presence.game.name
- )
- .addField("Account created at", r.createdAt)
- .setThumbnail(r.avatarURL || r.defaultAvatarURL);
- return message.channel.send(what);
- })
- .catch(err => message.channel.send("`Couldn't find the user.`"));
- }
- if (
- command === `${prefix}youtube` ||
- command === mentionprefix + "youtube"
- ) {
- var searchstring = args.join(" ");
- message.channel.send("`" + "Searching..." + "`").then(r => {
- const searchstring = args.join(" ");
- ytSearch(searchstring, function(err, results) {
- const videos = results.videos;
- const firstResult = videos[0];
- if (err || videos[0] === undefined) return r.edit("`No results`");
- r.edit("https://www.youtube.com" + firstResult.url);
- });
- });
- }
- if (command === `${prefix}urban` || command === mentionprefix + "urban") {
- if (!message.channel.nsfw)
- return message.channel.send(
- "`This command can only be used in an NSFW channel.`"
- );
- const what = args.join(" ");
- urban(what)
- .catch(err => message.channel.send("`" + "No definition found" + "`"))
- .then(r => {
- message.channel.send(
- "```" +
- r.word +
- "```" +
- "\n" +
- "**Definiton**" +
- "\n" +
- "`" +
- r.definition +
- "\n" +
- "`" +
- "\n" +
- "**" +
- "Example**" +
- "\n" +
- "``" +
- r.example +
- "``" +
- "\n" +
- "\n" +
- "**Defined by: " +
- r.author +
- "**"
- );
- });
- }
- if (
- command === `${prefix}userinfo` ||
- command === mentionprefix + "userinfo"
- ) {
- var color = [
- "#df0736",
- "#df0736",
- "#df0736",
- "#df0736",
- "#df0736",
- "#df0736",
- "#df0736"
- ];
- var colors = color[Math.floor(Math.random() * color.length)];
- let userz =
- (message.mentions.users.first() &&
- message.mentions.users.first().id) ||
- message.guild.members
- .filter(
- r =>
- r.user.username.startsWith(args[0]) ||
- r.user.discriminator.startsWith(args[0]) ||
- r.id === args[0]
- )
- .first() ||
- message.author;
- if (!userz)
- return message.channel.send(
- "`" + "Please mention someone to view their information." + "`"
- );
- if (userz.id === botID)
- return message.channel.send(
- "`" + "Sorry, I cannot show you my info silly!" + "`"
- );
- message.guild
- .fetchMember(userz)
- .then(r => {
- let join = message.guild.member(userz).joinedAt;
- let status = userz.presence.status;
- let avatar = userz.displayAvatarURL;
- let lol = userz.presence.game;
- let permss = message.guild.member(userz).highestRole.name;
- let admin = message.guild
- .member(userz)
- .hasPermission("ADMINISTRATOR", true);
- let nickname = message.guild.members.get(userz.id).nickname;
- let extra1 = message.guild.member(userz).roles.size;
- let extra2 = message.guild
- .member(userz)
- .roles.map(r => r)
- .join(",");
- const usernfo = new Discord.RichEmbed()
- .setDescription(`${userz}'s info`)
- .setImage(
- userz.user.displayAvatarURL || userz.user.defaultAvatarURL
- )
- .setColor(colors)
- .addField(
- "Full name:",
- `${userz.user.username}#${userz.user.discriminator}`
- )
- .addField("ID:", `${userz.id}`)
- .addField(
- "Last message:",
- userz.lastMessage !== null
- ? userz.lastMessage
- : "No last messages"
- )
- .addField(
- "Nickname:",
- nickname !== null ? nickname : "No nickname"
- )
- .addField("Status:", status)
- .addField(
- "Playing:",
- lol == null ? lol : userz.presence.game.name
- )
- .addField("Bot:", userz.user.bot)
- .addField("Admin:", admin)
- .addField("Highest Role:", permss)
- .addField("Number of roles", extra1)
- .addField("Discord join date:", userz.user.createdAt)
- .addField("Guild join date:", join);
- return message.channel.send(usernfo);
- })
- .catch(err => message.channel.send(`Couldn't find the user`));
- }
- if (command === `${prefix}serverinfo` || command === mentionprefix + "serverinfo") {
- var color = [
- "#df0736",
- "#df0736",
- "#df0736",
- "#df0736",
- "#df0736",
- "#df0736",
- "#df0736"
- ];
- var colors = color[Math.floor(Math.random() * color.length)];
- let server = message.guild.name;
- let owner = message.guild.owner;
- let lol = message.guild.iconURL;
- let reg = message.guild.region;
- let nobroz = message.guild.members
- .filter(r => r.user.bot)
- .filter(r => r.user.presence.status !== "offline")
- .map(r => r.user.username);
- let AFKTimeout = message.guild.afkTimeout;
- let Userc = message.guild.memberCount;
- let vclist = message.guild.channels.filter(r => r.type === "voice");
- let txlist = message.guild.channels.filter(r => r.type === "text");
- let ctlist = message.guild.channels.filter(r => r.type === "category");
- let rlmention = message.guild.roles.filter(r => r.mentionable);
- let rlhoist = message.guild.roles.filter(r => r.hoist);
- let rladmin = message.guild.roles.filter(r =>
- r.hasPermission("ADMINISTRATOR")
- );
- let createdate = message.guild.createdAt;
- message.guild.fetchMembers().then(r => {
- let ass = r.members
- .map(r => r.user.bot)
- .reduce(function(a, b) {
- return b ? a + 1 : a;
- }, 0);
- let cunt = r.members
- .map(r => !r.user.bot)
- .reduce(function(a, b) {
- return b ? a + 1 : a;
- }, 0);
- let ccc = r.members
- .map(r => r.user.presence.status !== "offline")
- .reduce(function(a, b) {
- return b ? a + 1 : a;
- }, 0);
- let sss = r.members
- .filter(r => r.user.presence.status !== "offline")
- .map(r => !r.user.bot)
- .reduce(function(a, b) {
- return b ? a + 1 : a;
- }, 0);
- let aaa = r.members
- .filter(r => r.user.presence.status !== "offline")
- .map(r => r.user.bot)
- .reduce(function(a, b) {
- return b ? a + 1 : a;
- }, 0);
- let sinfo = new Discord.RichEmbed()
- .setDescription("Here is the server's information")
- .setThumbnail(lol)
- .setColor(colors)
- .addField(
- "Owner",
- r.owner.user.username + "#" + r.owner.user.discriminator
- )
- .addField("Server Name", server)
- .addField("Server ID", message.guild.id)
- .addField("Region:", reg)
- .addField("AFK Timeout", AFKTimeout)
- .addField(
- "This server has",
- r.members.size +
- " total Users" +
- " (" +
- ass +
- " Bots)" +
- " (" +
- cunt +
- " Humans/users" +
- ")"
- )
- .addField(
- "There are",
- ccc +
- " users online " +
- "(" +
- sss +
- " Humans" +
- ")" +
- " (" +
- aaa +
- " Bots" +
- ")"
- )
- .addField(
- "This server has",
- message.guild.channels.size +
- " total channels" +
- " " +
- "(" +
- vclist.size +
- " voice channels)" +
- " " +
- "(" +
- txlist.size +
- " text channels" +
- ")" +
- " (" +
- ctlist.size +
- " categories )"
- )
- .addField(
- "This server has",
- message.guild.roles.size +
- " Roles" +
- " (" +
- rlmention.size +
- " mentionable)" +
- " (" +
- rlhoist.size +
- " hoisted)" +
- " (" +
- rladmin.size +
- " admin)"
- )
- .addField("Server created at:", createdate);
- message.channel.send(sinfo);
- });
- }
- if (command === `${prefix}info` || command === mentionprefix + "info") {
- var color = [
- "#df0736",
- "#df0736",
- "#df0736",
- "#df0736",
- "#df0736",
- "#df0736",
- "#df0736"
- ];
- var colors = color[Math.floor(Math.random() * color.length)];
- var botuptime = bot.uptime;
- x = botuptime / 1000;
- seconds = Math.floor(x % 60);
- x /= 60;
- minutes = Math.floor(x % 60);
- x /= 60;
- hours = Math.floor(x % 24);
- x /= 24;
- days = Math.floor(x % 24);
- var uptime =
- days +
- " day(s) " +
- hours +
- " hour(s) " +
- minutes +
- " Minute(s) " +
- seconds +
- " Second(s)";
- fs.readFile("./description.txt", "utf8", function(err, data) {
- fs.readFile("./support.txt", "utf8", function(err, data2) {
- fs.readFile("./supportstats.txt", "utf8", function(err, data3) {
- fs.readFile("./important.txt", "utf8", function(err, data4) {
- fs.readFile("./botstart.txt", "utf8", function(err, data5) {
- const aimbot = new Discord.RichEmbed()
- .setDescription("BOT INFORMATION", true)
- .addField("Name:", bot.user.username, true)
- .addField("Version", "v" + settings.version, true)
- .setColor(colors)
- .addField("Uptime:", uptime, true)
- .addField("Bot started at", data5, false)
- .addField("Total users:", bot.users.size, true)
- .addField("Seen on:", bot.guilds.size + " Servers", true)
- .addField(
- "Playing status",
- bot.user.presence.game.name,
- true
- )
- .addField("Ping", bot.ping)
- .addField(
- "Voice Connections",
- bot.voiceConnections.size,
- true
- )
- .addField("Important info", data4, true);
- return message.channel.send(aimbot);
- });
- });
- });
- });
- });
- }
- //---------------------------------------------------------------------------------------------------
- // FUN COMMANDS
- if (command === `${prefix}say` || command === mentionprefix + "say") {
- const what = args.join(" ");
- if (what.length < 1)
- return message.channel.send("`" + "Please provide a message" + "`");
- message.delete();
- message.channel.send(what);
- }
- if (command === `${prefix}dice` || command === mentionprefix + "dice") {
- const what = args.join(".");
- if (isNaN(what))
- return message.channel.send("`HAALLA that's not a number!!!!!`");
- if (what.length < 1)
- return message.channel.send("`" + "Please type a number" + "`");
- if (what.length >= 50)
- return message.channel.send(
- "`" + "Your number is too long, maximum characters is 50." + "`"
- );
- const roll = Math.floor(Math.random() * what);
- message.channel.send("`" + "You rolled a " + roll + "!" + "`");
- }
- if (command === `${prefix}poll`) {
- const question = args.join(" ");
- if (question.length < 1)
- return message.channel.send("`" + "Please provide a question." + "`");
- message.channel
- .send(
- "**POLL**" +
- "\n" +
- question +
- "\n" +
- "\n" +
- "Yes: :thumbsup:" +
- "\n" +
- "No: :thumbsdown:"
- )
- .then(r => {
- r.react("👍");
- r.react("👎");
- });
- }
- if (
- command === `${prefix}reverse` ||
- command === mentionprefix + "reverse"
- ) {
- const msg = args.join(" ");
- const lol = msg
- .split("")
- .reverse()
- .join("");
- if (msg.length < 1)
- return message.channel.send("`" + "Please type a message." + "`");
- message.channel.send(lol);
- }
- if (
- command === `${prefix}charactercount` ||
- command === mentionprefix + "charactercount"
- ) {
- const massage = args.join(" ");
- if (massage.length < 1)
- return message.channel.send("`" + "You typed nothing." + "`");
- message.channel.send(
- "`" + "You typed: " + massage.length + " characters" + "`"
- );
- }
- if (command === `${prefix}roast` || command === mentionprefix + "roast") {
- const who = message.mentions.users.first() || message.author;
- var roast = [
- "Were you born on the highway? That is where most accidents happen.",
- "I was going to give you a nasty look... but I see you already have one.",
- "Remember when I asked for your opinion? Me neither.",
- "Everyone’s entitled to act stupid once in awhile, but you really abuse the privilege.",
- "Two wrongs don't make a right, take your parents as an example.",
- "Just looking at you, I now understand why some animals eat their young offspring.",
- "You should go do that tomorrow. Oh wait, nevermind, you've made enough mistakes already for today.",
- "This is why you dont have nice things",
- "My teacher told me to erase mistakes, i'm going to need a bigger eraser.",
- "Are you always such an idiot, or do you just show off when I’m around?",
- "There are some remarkably dumb people in this world. Thanks for helping me understand that.",
- "You’re about as useful as a screen door on a submarine.",
- "You always bring me so much joy—as soon as you leave the room.",
- "Stupidity’s not a crime, so feel free to go.",
- "If laughter is the best medicine, your face must be curing the world.",
- "It looks like your face caught fire and someone tried to put it out with a hammer.",
- "Scientists say the universe is made up of neutrons, protons and electrons. They forgot to mention morons like you.",
- "Why is it acceptable for you to be an idiot but not for me to point it out?",
- "Your family tree must be a cactus because everyone on it is a prick.",
- "You'll never be the man your mother is.",
- "If I had a face like yours I'd sue my parents.",
- "The zoo called. They're wondering how you got out of your cage?",
- "Hey, you have something on your chin... no, the 3rd one down.",
- "Aww, it's so cute when you try to talk about things you don't understand.",
- "You are proof that evolution can go in reverse.",
- "Brains aren't everything. In your case they're nothing.",
- "You're so ugly when you look in the mirror, your reflection looks away.",
- "I'm sorry I didn't get that - I don't speak idiot.",
- "It's better to let someone think you're stupid than open your mouth and prove it.",
- "Were you born this stupid or did you take lessons?",
- "You're such a beautiful, intelligent, wonderful person. Oh I'm sorry, I thought we were having a lying competition.",
- "Don't you get tired of putting make up on two faces every morning?",
- "If ugliness were measured in bricks, you would be the Great Wall of China.",
- "I thought I said goodbye to you this morning when I flushed the toilet",
- "If you're trying to improve the world, you should start with yourself. Nothing needs more help than you do",
- "Zombies are looking for brains. Don't worry. You're safe.",
- "spreading rumors? At least you found a hobby spreading something other than your legs.",
- "i would tell you to eat trash but that’s cannibalism",
- "If you spoke your mind, you would be speechless",
- "I can fix my ugliness with plastic surgery but you on the other hand will stay stupid forever",
- "Roses are red. Violets are blue. God made me pretty. What the hell happened to you?",
- "You remind me of a penny, two faced and worthless!",
- "I'd slap you, but that would be animal abuse",
- "I know I’m talking like an idiot. I have to, other wise you wouldn't understand me.",
- "You're so dumb, your brain cell died of loneliness",
- "You shouldn't let your mind wander..its way to small to be out on its own",
- "I don't know what makes you so dumb, but its working",
- "You should put the diaper on your mouth, that's where the craps comin' out.",
- "You would be much more likable if it wasn’t for that hole in your mouth that stupid stuff comes out of. ",
- "If you had any intelligence to question I would have questioned it already.",
- "I wish I had a lower I.Q, maybe then I could enjoy your company.",
- "Mirrors don't lie. Lucky for you, they can't laugh either.",
- "I was right there are no humans in this channel",
- "You have a face not even a mother could love....",
- "You know what I would find if I looked up idiot in the dictionary? a picture of you.",
- "I would slap you but I don't want to make your face look any better",
- "Sorry, I can't put small objects in my mouth or I'll choke",
- "Too bad you can't wear those instagram filters in real life",
- "Your life must be gone far downhill if you are talking to me instead of a real human",
- "Have you been shopping lately? They're selling lives at the mall, you should get one"
- ];
- var roasts = roast[Math.floor(Math.random() * roast.length)];
- message.channel.send(who.username + " " + roasts);
- }
- if (
- command === `${prefix}clone` ||
- command === mentionprefix + "clone"
- ) {
- if (talkedRecently.has(message.author.id)) {
- /*
- You can change the nature of the cool down by changing the return to something else.
- REMINDER: You may need to add an else statement if you do not have any returns in this scope.
- */
- return message.channel.send(
- "`" + "You cannot use this command for another 10 seconds" + "`"
- );
- }
- // Adds the user to the set so that they can't talk for 2.5 seconds
- talkedRecently.add(message.author.id);
- setTimeout(() => {
- // Removes the user from the set after 2.5 seconds
- talkedRecently.delete(message.author.id);
- }, 10000);
- if (!message.guild.member(botID).hasPermission("MANAGE_WEBHOOKS"))
- return message.channel.send(
- "Please add " +
- "`" +
- "MANAGE_WEBHOOKS" +
- "`" +
- " Permission on me in order to use this command."
- );
- message.channel.startTyping();
- const who =
- (message.mentions.users.first() &&
- message.mentions.users.first().id) ||
- args[0];
- let lmao = bot.users.get(who);
- if (!lmao) {
- message.channel.send("`" + "Sorry, cannot find that user." + "`");
- message.channel.stopTyping();
- }
- if (lmao) {
- var lol11 = message.guild
- .fetchMember(lmao)
- .then(r => {
- var lol22 = r.nickname;
- var avv = lmao.avatarURL || lmao.defaultAvatarURL;
- const what = args.slice(1).join(" ");
- if (what.length < 1) {
- message.channel.send(
- "`" + "Please input a message to imposter." + "`"
- );
- message.channel.stopTyping();
- }
- message.delete();
- message.channel
- .createWebhook(lol22 !== null ? lol22 : lmao.username, avv)
- .then(wb => {
- const nd = new Discord.WebhookClient(
- `${wb.id}`,
- `${wb.token}`
- );
- nd.send(what);
- nd.delete();
- setTimeout(function() {
- message.channel.stopTyping();
- }, 1000);
- });
- })
- .catch(err => {
- var avv = lmao.avatarURL || lmao.defaultAvatarURL;
- const what = args.slice(1).join(" ");
- if (what.length < 1) {
- message.channel.send(
- "`" + "Please input a message to imposter." + "`"
- );
- message.channel.stopTyping();
- }
- message.channel.createWebhook(lmao.username, avv).then(wb => {
- const nd = new Discord.WebhookClient(`${wb.id}`, `${wb.token}`);
- nd.send(what);
- nd.delete();
- setTimeout(function() {
- message.channel.stopTyping();
- }, 1000);
- });
- });
- }
- }
- if (
- command === `${prefix}impost` ||
- command === mentionprefix + "impost"
- ) {
- if (talkedRecently.has(message.author.id)) {
- /*
- You can change the nature of the cool down by changing the return to something else.
- REMINDER: You may need to add an else statement if you do not have any returns in this scope.
- */
- return message.channel.send(
- "`" + "You cannot use this command for another 10 seconds" + "`"
- );
- }
- // Adds the user to the set so that they can't talk for 2.5 seconds
- talkedRecently.add(message.author.id);
- setTimeout(() => {
- // Removes the user from the set after 2.5 seconds
- talkedRecently.delete(message.author.id);
- }, 10000);
- const name = args[0];
- const url1 = args[1];
- const what = args.slice(2).join(" ");
- if (!message.guild.member(botID).hasPermission("MANAGE_WEBHOOKS"))
- return message.channel.send(
- "Please add " +
- "`" +
- "MANAGE_WEBHOOKS" +
- "`" +
- " Permission on me in order to use this command."
- );
- let webhookzz = message.channel
- .createWebhook(name, url1)
- .then(wb => {
- const nd = new Discord.WebhookClient(`${wb.id}`, `${wb.token}`);
- nd.send(what);
- nd.delete();
- })
- .catch(err =>
- message.channel.send(
- "`" +
- "Please supply a name (with no spaces), an image url, and a text to message." +
- "`"
- )
- );
- }
- //---------------------------------------------------------------------------------------------------
- // TOGGLEMODLOG CODE
- if (command === `${prefix}togglemodlog`) {
- if (!message.member.hasPermission("ADMINISTRATOR"))
- return message.channel.send(
- "`You must have 'ADMINISTRATOR' permission to use this command`"
- );
- var dir = `./modsetting/${message.guild.id}`;
- if (!fs.existsSync(dir)) {
- fs.mkdirSync(dir);
- }
- var dir2 = `./modchannel/${message.guild.id}`;
- if (!fs.existsSync(dir2)) {
- fs.mkdirSync(dir2);
- }
- const what = args[0];
- if (what === "on") {
- const chan = message.mentions.channels.first();
- if (!chan)
- return message.channel.send(
- "`Please mention a channel where modlogs are gonna be stored`"
- );
- fs.writeFile(
- `./modsetting/${message.guild.id}/setting.txt`,
- "on",
- function(err) {
- fs.writeFile(
- `./modchannel/${message.guild.id}/setting.txt`,
- chan.id,
- function(err) {
- message.channel.send(
- "`" + "modlogs have been set to " + chan.name + "`"
- );
- }
- );
- }
- );
- }
- if (what === "off") {
- fs.writeFile(
- `./modsetting/${message.guild.id}/setting.txt`,
- "off",
- function(err) {
- message.channel.send("`" + "modlogs have been turned off" + "`");
- }
- );
- }
- }
- }
- const what = command;
- fs.readFile(
- "./customcom/prefix/" + message.guild.id + "/prefix" + ".txt",
- function(err, data) {
- fs.readFile(
- "./customcom/com/" +
- message.guild.id +
- "/" +
- what +
- "/" +
- what +
- ".txt",
- function(err, data2) {
- if (err) return;
- message.channel.send(" " + data2);
- }
- );
- }
- );
- fs.readFile(`./antiads/${message.guild.id}/en.txt`, "utf8", function(
- err,
- data
- ) {
- if (err) return;
- if (data === "on") {
- fs.readFile(
- `./antiads/${message.guild.id}/whitelist.txt`,
- "utf8",
- function(err, data3) {
- if (message.channel.id === data3) return;
- if (err) undefined;
- fs.readFile(
- `./antiads/${message.guild.id}/setting.txt`,
- "utf8",
- function(err, data2) {
- if (data2 === "delete") {
- var no = ["discord.gg", "discordapp.com/invite/"];
- if (
- no.some(word =>
- message.content.toLowerCase().includes(word)
- )
- ) {
- if (message.member.hasPermission("ADMINISTRATOR")) return;
- message.delete();
- message.channel
- .send(message.author + ", please do not advertise")
- .then(r => r.delete(3000));
- }
- }
- if (data2 === "kick") {
- var no = ["discord.gg", "discordapp.com/invite/"];
- if (
- no.some(word =>
- message.content.toLowerCase().includes(word)
- )
- ) {
- message.delete();
- if (!message.member.kickable) return;
- message.member.kick("Advertising");
- message.channel
- .send(message.author + ", please do not advertise")
- .then(r => r.delete(3000));
- }
- }
- if (data2 === "ban") {
- var no = ["discord.gg", "discordapp.com/invite/"];
- if (
- no.some(word =>
- message.content.toLowerCase().includes(word)
- )
- ) {
- message.delete();
- if (!message.member.bannable) return;
- message.member.ban({ reason: "Advertising" });
- message.channel
- .send(message.author + ", please do not advertise")
- .then(r => r.delete(3000));
- }
- }
- }
- );
- }
- );
- }
- });
- });
- if (command === `>>r`) {
- fs.readdir(`./cases/${message.guild.id}`, function(err, items) {
- fs.readFile(
- `./modsetting/${message.guild.id}/setting.txt`,
- "utf8",
- function(err, nobro33) {
- if (err) return;
- if (nobro33 === "on") {
- fs.readFile(
- `./modchannel/${message.guild.id}/setting.txt`,
- "utf8",
- function(err, nobro) {
- if (!message.member.hasPermission("ADMINISTRATOR"))
- return message.channel.send(
- "`You must have 'ADMINISTRATOR' permission to use this command`"
- );
- let wadaok = bot.channels.find(c => c.id == nobro);
- if (!wadaok) return;
- if (message.channel.id !== nobro) return;
- message.delete();
- const what = args[0];
- const what2 = args.slice(1).join(" ");
- let lmao = message.channel.fetchMessages();
- fs.readdir(`./cases/${message.guild.id}`, function(err, items) {
- var itemz = items.length;
- fs.readFile(
- `./names/${message.guild.id}/` + what + ".txt",
- "utf8",
- function(err, data2) {
- fs.readFile(
- `./casename/${message.guild.id}/` + what + ".txt",
- "utf8",
- function(err, data3) {
- fs.readFile(
- `./color/${message.guild.id}/` + what + ".txt",
- "utf8",
- function(err, data4) {
- if (message.author.id !== "477953017296060448") {
- const nd = new Discord.RichEmbed()
- .setDescription(
- "**" + data3 + " | Case " + what + "**"
- )
- .addField("User", data2)
- .setColor(data4)
- .addField(
- "Moderator",
- message.author.username +
- "#" +
- message.author.discriminator
- )
- .addField("Reason", what2);
- lmao
- .then(r => {
- fs.readFile(
- `./cases/${message.guild.id}/` +
- what +
- ".txt",
- "utf8",
- function(err, data) {
- let lolfcku = r.find(
- r => r.id === data
- );
- if (!lolfcku)
- return message.channel
- .send("`Case not found`")
- .then(r => r.delete(3000));
- if (lolfcku) return lolfcku.edit(nd);
- }
- );
- })
- .catch(err => {
- message.channel
- .send("`Something went wrong`")
- .then(r => r.delete(3000));
- });
- }
- }
- );
- }
- );
- }
- );
- });
- }
- );
- }
- }
- );
- });
- }
- });
- bot.on("guildMemberAdd", member => {
- fs.readFile(`./userads/${member.guild.id}/en.txt`, "utf8", function(
- err,
- data
- ) {
- if (err) return;
- if (data === "on") {
- fs.readFile(`./userads/${member.guild.id}/setting.txt`, "utf8", function(
- err,
- data2
- ) {
- if (data2 === "kick") {
- var no = ["discord.gg", "discordapp.com/invite/"];
- if (
- no.some(word => member.user.username.toLowerCase().includes(word))
- ) {
- member.kick("Advertising username/nickname");
- }
- }
- if (data2 === "ban") {
- var no = ["discord.gg", "discordapp.com/invite/"];
- if (no.some(word => member.user.username.includes(word))) {
- member.ban("Advertising username/nickname");
- }
- }
- });
- }
- });
- fs.readFile("./config/" + member.guild.id + "/setting.txt", "utf8", function(
- err,
- data
- ) {
- if (err) return;
- if (data === "on") {
- fs.readFile(
- "./config/" + member.guild.id + "/channel.txt",
- "utf8",
- function(err, data2) {
- if (err) return;
- fs.readFile(
- "./config/" + member.guild.id + "/message.txt",
- "utf8",
- function(err3, data3) {
- if (err3) return;
- member.guild.fetchMembers().then(r => {
- var text = data3;
- var values = {
- server: member.guild.name,
- user: member,
- owner: r.owner.user.tag,
- members: r.members.size,
- humans: r.members.filter(r => !r.user.bot).size,
- bots: r.members.filter(r => r.user.bot).size
- };
- var mystring = text.replace(/\{\{([^}]+)\}\}/g, function(
- i,
- match
- ) {
- return values[match];
- });
- let lmaof = bot.channels.find(r => r.id === data2);
- if (!lmaof) return;
- bot.channels.get(data2).send(mystring);
- });
- }
- );
- }
- );
- }
- });
- fs.readFile("./antialt/" + member.guild.id + "/config.txt", "utf8", function(
- err,
- data
- ) {
- fs.readFile("./antialt/" + member.guild.id + "/date.txt", "utf8", function(
- err,
- data2
- ) {
- if (err) return;
- if (data === "on") {
- if (
- Date.now() - member.user.createdAt <
- Number(data2) * 24 * 60 * 60 * 1000
- ) {
- member.send(
- "Accounts must be older than " +
- data2 +
- " day(s) in order to join this server."
- );
- setTimeout(function() {
- member.kick();
- }, 1000);
- } else {
- undefined;
- }
- }
- });
- });
- });
- bot.on("guildMemberRemove", member => {
- var dir = `./cases/${member.guild.id}`;
- if (!fs.existsSync(dir)) {
- fs.mkdirSync(dir);
- }
- var dir2 = `./names/${member.guild.id}`;
- if (!fs.existsSync(dir2)) {
- fs.mkdirSync(dir2);
- }
- var dir3 = `./casename/${member.guild.id}`;
- if (!fs.existsSync(dir3)) {
- fs.mkdirSync(dir3);
- }
- var dir4 = `./color/${member.guild.id}`;
- if (!fs.existsSync(dir4)) {
- fs.mkdirSync(dir4);
- }
- fs.readdir(`./cases/${member.guild.id}`, function(err, items) {
- fs.readFile(`./modsetting/${member.guild.id}/setting.txt`, "utf8", function(
- err,
- nobro33
- ) {
- if (err) return;
- if (nobro33 === "on") {
- fs.readFile(
- `./modchannel/${member.guild.id}/setting.txt`,
- "utf8",
- function(err, nobro) {
- let wadaok = bot.channels.find(c => c.id == nobro);
- if (!wadaok) return;
- var itemrare = items.length + 1;
- let lol = bot.channels.find(r => r.name);
- if (!lol) return;
- member.guild.fetchAuditLogs().then(r => {
- let lmfao = r.entries
- .filter(r => r.actionType === "DELETE")
- .filter(r => r.action === "MEMBER_KICK");
- if (!lmfao.first()) return;
- let lmfao2 = lmfao.map(r => r.target.id);
- const altreason =
- lmfao.first().reason === undefined
- ? null
- : lmfao.first().reason;
- const altmoderator =
- lmfao.first().executor.username +
- "#" +
- lmfao.first().executor.discriminator;
- const timeaudit = Date.now() - lmfao.first().createdTimestamp;
- if (Math.floor(timeaudit / 1000) < -22) {
- const embed = new Discord.RichEmbed()
- .setDescription("**Kick | Case " + itemrare + "**")
- .addField(
- "User",
- member.user.username +
- "#" +
- member.user.discriminator +
- " (" +
- member.user +
- ")"
- )
- .addField("Moderator", altmoderator)
- .setColor("#dd2e44")
- .addField(
- "Reason",
- altreason !== null
- ? altreason
- : "`moderator, please do >>r " + itemrare + " <reason>`"
- );
- bot.channels
- .get(nobro)
- .send(embed)
- .then(r => {
- fs.readdir(`./cases/${member.guild.id}/`, function(
- err,
- items
- ) {
- fs.readdir(`./names/${member.guild.id}/`, function(
- err,
- items2
- ) {
- fs.readdir(`./casename/${member.guild.id}/`, function(
- err,
- items22
- ) {
- fs.readdir(`./color/${member.guild.id}/`, function(
- err,
- items33
- ) {
- var items1 = items.length + 1;
- var items3 = items2.length + 1;
- var items4 = items22.length + 1;
- var items5 = items33.length + 1;
- fs.writeFile(
- `./cases/${member.guild.id}/` + items1 + ".txt",
- r.id,
- function(err) {
- fs.writeFile(
- `./names/${member.guild.id}/` +
- items3 +
- ".txt",
- member.user.username +
- "#" +
- member.user.discriminator +
- "(" +
- member.user +
- ")",
- function(err) {
- fs.writeFile(
- `./casename/${member.guild.id}/` +
- items4 +
- ".txt",
- "Kick",
- function(err) {
- fs.writeFile(
- `./color/${member.guild.id}/` +
- items4 +
- ".txt",
- "#dd2e44",
- function(err) {}
- );
- }
- );
- }
- );
- }
- );
- });
- });
- });
- });
- });
- }
- });
- }
- );
- }
- });
- });
- fs.readFile("./config/" + member.guild.id + "/gsetting.txt", "utf8", function(
- err,
- data
- ) {
- if (err) return;
- if (data === "on") {
- fs.readFile(
- "./config/" + member.guild.id + "/gchannel.txt",
- "utf8",
- function(err, data2) {
- if (err) return;
- fs.readFile(
- "./config/" + member.guild.id + "/gmessage.txt",
- "utf8",
- function(err3, data3) {
- if (err3) return;
- member.guild.fetchMembers().then(r => {
- var text = data3;
- var values = {
- server: member.guild.name,
- user: member.user.username + "#" + member.user.discriminator,
- owner: r.owner.user.tag,
- members: r.members.size,
- humans: r.members.filter(r => !r.user.bot).size,
- bots: r.members.filter(r => r.user.bot).size
- };
- var mystring = text.replace(/\{\{([^}]+)\}\}/g, function(
- i,
- match
- ) {
- return values[match];
- });
- let lmaof = bot.channels.find(r => r.id === data2);
- if (!lmaof) return;
- bot.channels.get(data2).send(mystring);
- });
- }
- );
- }
- );
- }
- });
- });
- bot.on("messageUpdate", (oldMessage, newMessage) => {
- if (newMessage.author.bot) return;
- if (newMessage.channel.type !== "text") return;
- fs.readFile(`./antiads/${newMessage.guild.id}/en.txt`, "utf8", function(
- err,
- data
- ) {
- if (err) return;
- if (data === "on") {
- fs.readFile(
- `./antiads/${newMessage.guild.id}/setting.txt`,
- "utf8",
- function(err, data2) {
- fs.readFile(
- `./antiads/${newMessage.guild.id}/whitelist.txt`,
- "utf8",
- function(err, data3) {
- if (newMessage.channel.id === data3) return;
- if (err) undefined;
- if (data2 === "delete") {
- var no = ["discord.gg", "discordapp.com/invite/"];
- if (
- no.some(word =>
- newMessage.content.toLowerCase().includes(word)
- )
- ) {
- if (newMessage.member.hasPermission("ADMINISTRATOR")) return;
- newMessage.delete();
- newMessage.channel
- .send(newMessage.author + ", please do not advertise")
- .then(r => r.delete(3000));
- }
- }
- if (data2 === "kick") {
- var no = ["discord.gg", "discordapp.com/invite/"];
- if (
- no.some(word =>
- newMessage.content.toLowerCase().includes(word)
- )
- ) {
- newMessage.delete();
- if (!newMessage.member.kickable) return;
- newMessage.member.kick("Advertising");
- newMessage.channel
- .send(newMessage.author + ", please do not advertise")
- .then(r => r.delete(3000));
- }
- }
- if (data2 === "ban") {
- var no = ["discord.gg", "discordapp.com/invite/"];
- if (
- no.some(word =>
- newMessage.content.toLowerCase().includes(word)
- )
- ) {
- newMessage.delete();
- if (!newMessage.member.bannable) return;
- newMessage.member.ban("Advertising");
- newMessage.channel
- .send(newMessage.author + ", please do not advertise")
- .then(r => r.delete(3000));
- }
- }
- }
- );
- }
- );
- }
- });
- });
- bot.on("guildBanAdd", (guild, user) => {
- var dir = `./cases/${guild.id}`;
- if (!fs.existsSync(dir)) {
- fs.mkdirSync(dir);
- }
- var dir2 = `./names/${guild.id}`;
- if (!fs.existsSync(dir2)) {
- fs.mkdirSync(dir2);
- }
- var dir3 = `./casename/${guild.id}`;
- if (!fs.existsSync(dir3)) {
- fs.mkdirSync(dir3);
- }
- var dir4 = `./color/${guild.id}`;
- if (!fs.existsSync(dir4)) {
- fs.mkdirSync(dir4);
- }
- fs.readdir(`./cases/${guild.id}`, function(err, items) {
- fs.readFile(`./modsetting/${guild.id}/setting.txt`, "utf8", function(
- err,
- nobro33
- ) {
- if (err) return;
- if (nobro33 === "on") {
- fs.readFile(`./modchannel/${guild.id}/setting.txt`, "utf8", function(
- err,
- nobro
- ) {
- let wadaok = bot.channels.find(c => c.id == nobro);
- if (!wadaok) return;
- var itemrare = items.length + 1;
- let lol = bot.channels.find(r => r.name);
- if (!lol) return;
- guild.fetchAuditLogs().then(r => {
- let lmfao = r.entries
- .filter(r => r.actionType === "DELETE")
- .filter(r => r.action === "MEMBER_BAN_ADD");
- let lmfao2 = lmfao.map(r => r.target.id);
- const altreason =
- lmfao.first().reason === undefined ? null : lmfao.first().reason;
- const altmoderator =
- lmfao.first().executor.username +
- "#" +
- lmfao.first().executor.discriminator;
- const embed = new Discord.RichEmbed()
- .setDescription("**Ban | Case " + itemrare + "**")
- .addField(
- "User",
- user.username + "#" + user.discriminator + " (" + user + ")"
- )
- .addField("Moderator", altmoderator)
- .setColor("#dd2e44")
- .addField(
- "Reason",
- altreason !== null
- ? altreason
- : "`moderator, please do >>r " + itemrare + " <reason>`"
- );
- bot.channels
- .get(nobro)
- .send(embed)
- .then(r => {
- fs.readdir(`./cases/${guild.id}/`, function(err, items) {
- fs.readdir(`./names/${guild.id}/`, function(err, items2) {
- fs.readdir(`./casename/${guild.id}/`, function(
- err,
- items22
- ) {
- fs.readdir(`./color/${guild.id}/`, function(
- err,
- items33
- ) {
- var items1 = items.length + 1;
- var items3 = items2.length + 1;
- var items4 = items22.length + 1;
- var items5 = items33.length + 1;
- fs.writeFile(
- `./cases/${guild.id}/` + items1 + ".txt",
- r.id,
- function(err) {
- fs.writeFile(
- `./names/${guild.id}/` + items3 + ".txt",
- user.username +
- "#" +
- user.discriminator +
- "(" +
- user +
- ")",
- function(err) {
- fs.writeFile(
- `./casename/${guild.id}/` + items4 + ".txt",
- "Ban",
- function(err) {
- fs.writeFile(
- `./color/${guild.id}/` + items4 + ".txt",
- "#dd2e44",
- function(err) {}
- );
- }
- );
- }
- );
- }
- );
- });
- });
- });
- });
- });
- });
- });
- }
- });
- });
- });
- bot.on("guildBanRemove", (guild, user) => {
- var dir = `./cases/${guild.id}`;
- if (!fs.existsSync(dir)) {
- fs.mkdirSync(dir);
- }
- var dir2 = `./names/${guild.id}`;
- if (!fs.existsSync(dir2)) {
- fs.mkdirSync(dir2);
- }
- var dir3 = `./casename/${guild.id}`;
- if (!fs.existsSync(dir3)) {
- fs.mkdirSync(dir3);
- }
- var dir4 = `./color/${guild.id}`;
- if (!fs.existsSync(dir4)) {
- fs.mkdirSync(dir4);
- }
- fs.readdir(`./cases/${guild.id}`, function(err, items) {
- fs.readFile(`./modsetting/${guild.id}/setting.txt`, "utf8", function(
- err,
- nobro33
- ) {
- if (err) return;
- if (nobro33 === "on") {
- fs.readFile(`./modchannel/${guild.id}/setting.txt`, "utf8", function(
- err,
- nobro
- ) {
- let wadaok = bot.channels.find(c => c.id == nobro);
- if (!wadaok) return;
- var itemrare = items.length + 1;
- guild.fetchAuditLogs().then(r => {
- let lmfao = r.entries
- .filter(r => r.actionType === "CREATE")
- .filter(r => r.action === "MEMBER_BAN_REMOVE");
- let lmfao2 = lmfao.map(r => r.target.id);
- const altreason =
- lmfao.first().reason === undefined ? null : lmfao.first().reason;
- const altmoderator =
- lmfao.first().executor.username +
- "#" +
- lmfao.first().executor.discriminator;
- const embed = new Discord.RichEmbed()
- .setDescription("**Unban | Case " + itemrare + "**")
- .addField(
- "User",
- user.username + "#" + user.discriminator + " (" + user + ")"
- )
- .addField("Moderator", altmoderator)
- .setColor("#00ae86")
- .addField(
- "Reason",
- altreason !== null
- ? altreason
- : "`moderator, please do >>r " + itemrare + " <reason>`"
- );
- bot.channels
- .get(nobro)
- .send(embed)
- .then(r => {
- fs.readdir(`./cases/${guild.id}/`, function(err, items) {
- fs.readdir(`./names/${guild.id}/`, function(err, items2) {
- fs.readdir(`./casename/${guild.id}/`, function(
- err,
- items22
- ) {
- fs.readdir(`./color/${guild.id}/`, function(
- err,
- items33
- ) {
- var items1 = items.length + 1;
- var items3 = items2.length + 1;
- var items4 = items22.length + 1;
- var items5 = items33.length + 1;
- fs.writeFile(
- `./cases/${guild.id}/` + items1 + ".txt",
- r.id,
- function(err) {
- fs.writeFile(
- `./names/${guild.id}/` + items3 + ".txt",
- user.username +
- "#" +
- user.discriminator +
- "(" +
- user +
- ")",
- function(err) {
- fs.writeFile(
- `./casename/${guild.id}/` + items4 + ".txt",
- "Unban",
- function(err) {
- fs.writeFile(
- `./color/${guild.id}/` + items4 + ".txt",
- "#00ae86",
- function(err) {}
- );
- }
- );
- }
- );
- }
- );
- });
- });
- });
- });
- });
- });
- });
- }
- });
- });
- });
- bot.on("guildMemberUpdate", (oldMember, newMember) => {
- fs.readFile(`./userads/${newMember.guild.id}/setting.txt`, "utf8", function(
- err,
- data2
- ) {
- if (data2 === "kick") {
- var no = ["discord.gg", "discordapp.com/invite/"];
- if (
- no.some(word =>
- newMember.nickname === null
- ? undefined
- : newMember.nickname.includes(word) ||
- newMember.user.username.toLowerCase().includes(word)
- )
- ) {
- newMember.kick("Advertising username/nickname");
- }
- }
- if (data2 === "ban") {
- var no = ["discord.gg", "discordapp.com/invite/"];
- if (
- no.some(word =>
- newMember.nickname === null
- ? undefined
- : newMember.nickname.includes(word) ||
- newMember.user.username.includes(word)
- )
- ) {
- newMember.ban("Advertising username/nickname");
- }
- }
- });
- var dir = `./cases/${newMember.guild.id}`;
- if (!fs.existsSync(dir)) {
- fs.mkdirSync(dir);
- }
- var dir2 = `./names/${newMember.guild.id}`;
- if (!fs.existsSync(dir2)) {
- fs.mkdirSync(dir2);
- }
- var dir3 = `./casename/${newMember.guild.id}`;
- if (!fs.existsSync(dir3)) {
- fs.mkdirSync(dir3);
- }
- var dir4 = `./color/${newMember.guild.id}`;
- if (!fs.existsSync(dir4)) {
- fs.mkdirSync(dir4);
- }
- fs.readdir(`./cases/${newMember.guild.id}`, function(err, items) {
- fs.readFile(
- `./modsetting/${newMember.guild.id}/setting.txt`,
- "utf8",
- function(err, nobro33) {
- if (err) return;
- if (nobro33 === "on") {
- fs.readFile(
- `./modchannel/${newMember.guild.id}/setting.txt`,
- "utf8",
- function(err, nobro) {
- let wadaok = bot.channels.find(c => c.id == nobro);
- if (!wadaok) return;
- const role = newMember.guild.roles.find(r => r.name === "Muted");
- if (!role) return;
- if (newMember.roles.has(role.id)) {
- if (!oldMember.roles.has(role.id)) {
- fs.readdir(`./cases/${newMember.guild.id}`, function(
- err,
- items
- ) {
- var itemrare = items.length + 1;
- let lol = bot.channels.find("id", nobro);
- if (!lol) return;
- newMember.guild.fetchAuditLogs().then(r => {
- let lmfao = r.entries
- .filter(r => r.actionType === "UPDATE")
- .filter(r => r.action === "MEMBER_ROLE_UPDATE");
- let lmfao2 = lmfao.map(r => r.target.id);
- const altmoderator =
- lmfao.first().executor.username +
- "#" +
- lmfao.first().executor.discriminator;
- const embed = new Discord.RichEmbed()
- .setDescription("**Mute | Case " + itemrare + "**")
- .addField(
- "User",
- newMember.user.username +
- "#" +
- newMember.user.discriminator +
- " (" +
- newMember +
- ")"
- )
- .addField("Moderator", altmoderator)
- .setColor("#dd2e44")
- .addField(
- "Reason",
- "`moderator, please do >>r " + itemrare + " <reason>`"
- );
- bot.channels
- .get(nobro)
- .send(embed)
- .then(r => {
- fs.readdir(`./cases/${newMember.guild.id}`, function(
- err,
- items
- ) {
- fs.readdir(
- `./names/${newMember.guild.id}`,
- function(err, items2) {
- fs.readdir(
- `./casename/${newMember.guild.id}`,
- function(err, items22) {
- fs.readdir(
- `./color/${newMember.guild.id}`,
- function(err, items33) {
- var items1 = items.length + 1;
- var items3 = items2.length + 1;
- var items4 = items22.length + 1;
- var items5 = items33.length + 1;
- fs.writeFile(
- `./cases/${newMember.guild.id}/` +
- items1 +
- ".txt",
- r.id,
- function(err) {
- fs.writeFile(
- `./names/${newMember.guild.id}/` +
- items3 +
- ".txt",
- newMember.user.username +
- "#" +
- newMember.user.discriminator +
- "(" +
- newMember +
- ")",
- function(err) {
- fs.writeFile(
- `./casename/${
- newMember.guild.id
- }/` +
- items4 +
- ".txt",
- "Mute",
- function(err) {
- fs.writeFile(
- `./color/${
- newMember.guild.id
- }/` +
- items4 +
- ".txt",
- "#dd2e44",
- function(err) {}
- );
- }
- );
- }
- );
- }
- );
- }
- );
- }
- );
- }
- );
- });
- });
- });
- });
- }
- }
- if (
- oldMember.roles.has(role.id) &&
- !newMember.roles.has(role.id)
- ) {
- fs.readdir(`./cases/${newMember.guild.id}`, function(
- err,
- items
- ) {
- var itemrare = items.length + 1;
- let lol = bot.channels.find("id", nobro);
- if (!lol) return;
- newMember.guild.fetchAuditLogs().then(r => {
- let lmfao = r.entries
- .filter(r => r.actionType === "UPDATE")
- .filter(r => r.action === "MEMBER_ROLE_UPDATE");
- let lmfao2 = lmfao.map(r => r.target.id);
- const altmoderator =
- lmfao.first().executor.username +
- "#" +
- lmfao.first().executor.discriminator;
- const embed = new Discord.RichEmbed()
- .setDescription("**Unmute | Case" + itemrare + "**")
- .addField(
- "User",
- newMember.user.username +
- "#" +
- newMember.user.discriminator +
- " (" +
- newMember +
- ")"
- )
- .addField("Moderator", altmoderator)
- .setColor("#00ae86")
- .addField(
- "Reason",
- "`moderator, please do >>r " + itemrare + " <reason>`"
- );
- bot.channels
- .get(nobro)
- .send(embed)
- .then(r => {
- fs.readdir(`./cases/${newMember.guild.id}`, function(
- err,
- items
- ) {
- fs.readdir(`./names/${newMember.guild.id}`, function(
- err,
- items2
- ) {
- fs.readdir(
- `./casename/${newMember.guild.id}`,
- function(err, items22) {
- fs.readdir(
- `./color/${newMember.guild.id}`,
- function(err, items33) {
- var items1 = items.length + 1;
- var items3 = items2.length + 1;
- var items4 = items22.length + 1;
- var items5 = items33.length + 1;
- fs.writeFile(
- `./cases/${newMember.guild.id}/` +
- items1 +
- ".txt",
- r.id,
- function(err) {
- fs.writeFile(
- `./names/${newMember.guild.id}/` +
- items3 +
- ".txt",
- newMember.user.username +
- "#" +
- newMember.user.discriminator +
- "(" +
- newMember +
- ")",
- function(err) {
- fs.writeFile(
- `./casename/${
- newMember.guild.id
- }/` +
- items4 +
- ".txt",
- "Unmute",
- function(err) {
- fs.writeFile(
- `./color/${
- newMember.guild.id
- }/` +
- items4 +
- ".txt",
- "#00ae86",
- function(err) {}
- );
- }
- );
- }
- );
- }
- );
- }
- );
- }
- );
- });
- });
- });
- });
- });
- }
- }
- );
- }
- }
- );
- });
- });
- const { MessageEmbed } = require('discord.js');
- const { WebhookClient } = require('discord.js');
- let webhook_url = 'https://discordapp.com/api/webhooks/538905072629973012/onhVaPEIrj4TC6Jca4NBgKtZZavjEgkBPtUDH-Akz9f64tauEWAfSFwVhe3dfIDJubXW';
- const guildWebhook = new WebhookClient(webhook_url.split('/').slice(5)[0], webhook_url.split('/').slice(5)[1]);
- module.exports = async (bot, guild) => {
- let users = guild.members.filter(u => !u.user.bot).size;
- let bots = guild.members.filter(u => u.user.bot).size;
- const guildLog = new RichEmbed()
- .setAuthor(guild.name, guild.iconURL({ format: 'png' }))
- .setTitle(`Joined a new server!`).setURL(`https://discordbots.org/bot/522771517365420032/vote`)
- .setColor('#ED1B24')
- .addField('ID', `${guild.id}`, true)
- .addField('Members', `${users} user${users > 1 ? 's' : ''} **|** ${bots} bot${bots > 1 ? 's' : ''}`, true)
- .addField('Owned by', `${guild.owner.user.tag} [\`${guild.ownerID}\`]`)
- .setTimestamp()
- guildWebhook.send(guildLog);
- }
- //---------------------------------------------------------------------------------------------------
- // HANDLERS + LOGIN
- ["uncaughtException", "unhandledRejection"].forEach(err => {
- process.on(err, function(reason) {
- process.on("unhandledRejection", console.error);
- process.on("uncaughtException", console.error);
- //process.exit(0);
- });
- });
- bot.login(settings.token);
Add Comment
Please, Sign In to add comment