Guest User

Untitled

a guest
Jan 26th, 2019
367
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 153.05 KB | None | 0 0
  1. const Discord = require("discord.js");
  2. const bot = new Discord.Client({ disableEveryone: true });
  3. const settings = require("./settings.json");
  4. const gamename = settings.game;
  5. const ownerID = settings.owner;
  6. const botstatus = settings.status;
  7. const botID = settings.botID;
  8. const fs = require("fs");
  9. const prefix = settings.prefix;
  10. const password = settings.password;
  11. const ytSearch = require("yt-search");
  12. const urban = require("relevant-urban");
  13. const DBL = require("dblapi.js");
  14. const dbr = require("dbrlib");
  15. let talkedRecently = new Set();
  16. let ratedrec = new Set();
  17.  
  18. // send the stats every hour to DBL
  19. const dbl = new DBL(
  20. "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpZCI6IjUyMjc3MTUxNzM2NTQyMDAzMiIsImJvdCI6dHJ1ZSwiaWF0IjoxNTQ4MTY4NTU2fQ.ZxKgX15Wvt9MfxM00cFkgHvbqQZA7DLSq9T-4HZXTgQ",
  21. { statsInterval: 3600000 },
  22. bot
  23. );
  24. dbl.on("error", e => {
  25. console.log(`DBL Error! ${e}`);
  26. });
  27. // Optional events
  28. dbl.on("posted", () => {
  29. console.log("Server count posted!");
  30. });
  31. bot.on("ready", () => {
  32. const dbrbot = new dbr.dbrbot()
  33. dbrbot.post("522771517365420032", ".dOpFSa4oy9VkCvT37Zk3CaiJUy8ivyXKqZJKStj6gsREX9mO8Ub.h4dkhPAc7XfUkctPMrt-uAO9GOa", bot.guilds.size)
  34. });
  35.  
  36.  
  37.  
  38. //---------------------------------------------------------------------------------------------------
  39. bot.on("ready", async () => {
  40. var text = gamename;
  41. var values = {
  42. servers: bot.guilds.size,
  43. users: bot.users.size
  44. };
  45. var games = text.replace(/\{\{([^}]+)\}\}/g, function(i, match) {
  46. return values[match];
  47. });
  48. var datetoday = new Date();
  49. var days = datetoday.getDate();
  50. var month = datetoday.getMonth() + 1;
  51. var year = datetoday.getFullYear();
  52. var time1 = datetoday.getSeconds();
  53. var time2 = datetoday.getHours();
  54. var time3 = datetoday.getMinutes();
  55. fs.writeFile(
  56. "./botstart.txt",
  57. days + "." + month + "." + year + " \n" + time2 + ":" + time3 + ":" + time1,
  58. function(err) {
  59. console.log(
  60. "Logged in as " +
  61. bot.user.username +
  62. "#" +
  63. bot.user.discriminator +
  64. "\n" +
  65. "\n"
  66. );
  67. console.log("Server Count: " + bot.guilds.size + "\n" + "\n");
  68. console.log("Prefix: " + settings.prefix + "\n" + "\n");
  69. console.log(
  70. "<<<<<<<<<<|| Moddest will now log commands below this line ||>>>>>>>>>>"
  71. );
  72. bot.user.setPresence({
  73. game: { name: ">>help || moddest.xyz", type: "WATCHING" }
  74. });
  75. const snek = require("snekfetch");
  76. muscii(bot);
  77. }
  78. );
  79. });
  80.  
  81. //---------------------------------------------------------------------------------------------------
  82.  
  83. bot.on("guildCreate", guild => {
  84. const channelToSend =
  85. guild.systemChannel ||
  86. guild.channels
  87. .filter(guildChannel => guildChannel.type === "text")
  88. .filter(guildChannel =>
  89. guildChannel.permissionsFor(bot.user).has("SEND_MESSAGES")
  90. )
  91. .first();
  92. const serveradd = new Discord.RichEmbed()
  93. .setColor("00ae86")
  94. .setDescription(
  95. "<:yes:534711053511163914> Thank you for adding me to " +
  96. guild.name +
  97. "! \n Use `>>help` to see what I can do!"
  98. );
  99. channelToSend.send(serveradd).catch(err => {
  100. console.log(err);
  101. });
  102. log(`I have been added to: ` + guild.name + "(" + guild.id + ")");
  103. });
  104.  
  105. bot.on("message", async message => {
  106. if (message.author.bot) return;
  107. if (message.channel.type === "dm") return;
  108. let messageArray = message.content.split(" ");
  109. let command = messageArray[0];
  110. let args = messageArray.slice(1);
  111. const mentionprefix = message.guild.member(botID).toString();
  112. fs.readFile(`./blacklisted/${message.author.id}/black.txt`, function(
  113. err,
  114. data
  115. ) {
  116. if (data === "true") return;
  117. if (err) {
  118. if (message.content.startsWith(prefix)) {
  119. var dir = `./usagelogs/${message.guild.id}`;
  120.  
  121. if (!fs.existsSync(dir)) {
  122. fs.mkdirSync(dir);
  123. }
  124. const nd = new Date();
  125. const nowdate = nd.getDate();
  126. const nowdate2 = nd.getMonth() + 1;
  127. const nowdate3 = nd.getFullYear();
  128. const minute1 = nd.getHours();
  129. const minute2 = nd.getMinutes();
  130. const minute3 = nd.getSeconds();
  131. fs.appendFile(
  132. `./usagelogs/${message.guild.id}/logs.txt`,
  133. "\n" +
  134. nowdate +
  135. "." +
  136. nowdate2 +
  137. "." +
  138. nowdate3 +
  139. " " +
  140. minute1 +
  141. ":" +
  142. minute2 +
  143. ":" +
  144. minute3 +
  145. " " +
  146. message.author.id +
  147. " " +
  148. message.author.username +
  149. "#" +
  150. message.author.discriminator +
  151. ":: " +
  152. message.content,
  153. function(err) {}
  154. );
  155. }
  156. // console.log('');
  157. global.log = require("./util/logger");
  158. if (message.content.startsWith(prefix)) {
  159. log(
  160. message.author.tag +
  161. " (" +
  162. message.author.id +
  163. ")" +
  164. " used command " +
  165. message.content +
  166. " in " +
  167. message.guild.name +
  168. " (" +
  169. message.guild.id +
  170. ")"
  171. );
  172. }
  173. // dbl
  174. // .hasVoted(message.author.id)
  175. // .then(voted => {
  176. // if (voted) {
  177. // fs.writeFile('./votelock/' + author.id + ".txt", "DATA TO WRITE", function(err) {
  178. // if(err) return message.channel.send(" ")
  179. // });
  180. // }
  181. // });
  182.  
  183. //---------------------------------------------------------------------------------------------------
  184.  
  185. if (
  186. command === `${prefix}blacklist` ||
  187. command === `${mentionprefix}blacklist`
  188. ) {
  189. const blacklister = new Discord.RichEmbed()
  190. .setColor("FF3131")
  191. .setDescription(
  192. "<:no:534824114767265823> Only the bot owner can use this command!"
  193. );
  194. if (message.author.id !== ownerID)
  195. return message.channel.send(blacklister);
  196. const who = args[0];
  197. const who2 = args.slice(1).join(" ");
  198. var dir = `./blacklisted/${who}`;
  199.  
  200. if (!fs.existsSync(dir)) {
  201. fs.mkdirSync(dir);
  202. }
  203. fs.writeFile(`./blacklisted/${who}/black.txt`, "true", function(err) {
  204. fs.writeFile(`./blacklisted/${who}/reason.txt`, who2, function(err) {
  205. let se = bot.users
  206. .get(who)
  207. .send(
  208. "`" +
  209. "Hello, You have been added to " +
  210. bot.user.username +
  211. "'s blacklist for the following reason: " +
  212. who2 +
  213. " / 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." +
  214. "`"
  215. );
  216. if (!se) return;
  217. message.channel.send(
  218. "`" +
  219. "User was blacklisted and was sent a message saying they were blacklisted for: " +
  220. who2 +
  221. "`"
  222. );
  223. setTimeout(function() {
  224. let lol = bot.guilds.filter(r => r.owner.id === who);
  225. lol.forEach(async (guild, id) => {
  226. guild.leave();
  227. });
  228. }, 1000);
  229. });
  230. });
  231. }
  232.  
  233. if (
  234. command === `${mentionprefix}unblacklist` ||
  235. command === `${prefix}unblacklist`
  236. ) {
  237. const unblacklister = new Discord.RichEmbed()
  238. .setColor("FF3131")
  239. .setDescription(
  240. "<:no:534824114767265823> Only the bot owner can use this command!"
  241. );
  242. if (message.author.id !== ownerID)
  243. return message.channel.send(unblacklister);
  244. var dir = `./blacklisted/${message.author.id}`;
  245.  
  246. if (!fs.existsSync(dir)) {
  247. fs.mkdirSync(dir);
  248. }
  249. const who = args[0];
  250. const who2 = args.slice(1).join(" ");
  251. fs.unlink(`./blacklisted/${who}/black.txt`, function(err) {
  252. fs.unlink(`./blacklisted/${who}/reason.txt`, function(err) {
  253. let se = bot.users
  254. .get(who)
  255. .send(
  256. "`" +
  257. "You have been removed from " +
  258. bot.user.username +
  259. "'s blacklist, you can now use the bot again!" +
  260. "`"
  261. );
  262. if (!se) return;
  263. message.channel.send(
  264. "`" + "User was successfully unblacklisted." + "`"
  265. );
  266. });
  267. });
  268. }
  269. if (
  270. command === `${mentionprefix}setgame` ||
  271. command === `${prefix}setgame`
  272. ) {
  273. const setgamer = new Discord.RichEmbed()
  274. .setColor("FF3131")
  275. .setDescription(
  276. "<:no:534824114767265823> Only the bot owner can use this command!"
  277. );
  278. if (message.author.id !== ownerID)
  279. return message.channel.send(setgamer);
  280. const what = args.join(" ");
  281. var text = gamename;
  282. var values = {
  283. servers: bot.guilds.size
  284. };
  285. var games = text.replace(/\{\{([^}]+)\}\}/g, function(i, match) {
  286. return values[match];
  287. });
  288. bot.user.setPresence({ game: { name: what, type: 0 } });
  289. message.channel.send("`" + "Game set!" + "`");
  290. }
  291. if (command === `${prefix}eval` || command === `${mentionprefix}eval`) {
  292. const evaler = new Discord.RichEmbed()
  293. .setColor("FF3131")
  294. .setDescription(
  295. "<:no:534824114767265823> Only the bot owner can use this command!"
  296. );
  297. if (message.author.id !== ownerID) return message.channel.send(evaler);
  298.  
  299. const that = message.content.split(" ").slice(1);
  300. try {
  301. const code = args.join(" ");
  302. let evaled = eval(code);
  303. if (typeof evaled !== "string")
  304. evaled = require("util").inspect(evaled);
  305. const ss = new Discord.RichEmbed()
  306. .setDescription("**EVAL**")
  307. .setColor("GREEN")
  308. .addField("INPUT", "```" + code + "```")
  309. .addField("OUTPUT", "```" + evaled + "```");
  310. return message.channel.send(ss);
  311. } catch (e) {
  312. console.log(e.stack);
  313. const err = new Discord.RichEmbed()
  314. .setDescription("**ERROR**")
  315. .setColor("RED")
  316. .addField("Error:", e);
  317. return message.channel.send(err);
  318. }
  319. }
  320. if (command === `${prefix}ls` || command === mentionprefix + "ls") {
  321. const lister = new Discord.RichEmbed()
  322. .setColor("FF3131")
  323. .setDescription(
  324. "<:no:534824114767265823> Only the bot owner can use this command!"
  325. );
  326. if (message.author.id !== ownerID) return message.channel.send(lister);
  327. var index = 1;
  328. var guilds = bot.guilds.map(g => g.name);
  329. var guilds1 = bot.guilds.map(
  330. g => `\`${index++}\` ` + `**${g.name}**` + ` == ${g.members.size}`
  331. );
  332. try {
  333. let perChunk = 25;
  334. let arrays = guilds1.reduce((resultArray, item, x) => {
  335. const chunkIndex = Math.floor(x / perChunk);
  336.  
  337. if (!resultArray[chunkIndex]) {
  338. resultArray[chunkIndex] = []; // start a new chunk
  339. }
  340.  
  341. resultArray[chunkIndex].push(item);
  342.  
  343. return resultArray;
  344. }, []);
  345. for (var i = 0; i < arrays.length; i++) {
  346. message.channel.send(arrays[i].join("\n"));
  347. }
  348. } catch (err) {}
  349. const reply = new Discord.RichEmbed()
  350. .setColor("7f7f7f")
  351. .setDescription(
  352. "<:arrow:536727698932891672> Reply with a name/number to output an invite link."
  353. );
  354. message.channel.send(reply);
  355. try {
  356. var response = message.channel
  357. .awaitMessages(
  358. message2 => message2.author.id === message.author.id,
  359. {
  360. maxMatches: 1,
  361. time: 60000,
  362. errors: ["time"]
  363. }
  364. )
  365. .then(collected => {
  366. var msg1 = collected.first().content;
  367. var msg = parseInt(msg1) - 1 || msg1;
  368. var idx = guilds.indexOf(msg);
  369. if (idx == -1) {
  370. idx = msg;
  371. }
  372. var guild = bot.guilds.find(g => g.name == guilds[idx]);
  373. var channels = guild.channels.map(c => c.id);
  374. var channel = bot.channels.get(channels[1]);
  375. channel
  376. .createInvite()
  377. .then(invite => message.channel.send(`${invite.url}`))
  378. .catch(err => message.channel.send(`${err}`));
  379. })
  380. .catch(err => {
  381. console.log(err);
  382. const timeout = new Discord.RichEmbed()
  383. .setColor("FF3131")
  384. .setDescription("<:no:534824114767265823> Response timed out.");
  385. message.channel.send(timeout);
  386. });
  387. } catch (err) {}
  388. }
  389. if (
  390. command === `${prefix}restart` ||
  391. command === mentionprefix + "restart"
  392. ) {
  393. const restarter = new Discord.RichEmbed()
  394. .setColor("FF3131")
  395. .setDescription(
  396. "<:no:534824114767265823> Only the bot owner can use this command!"
  397. );
  398. if (message.author.id !== ownerID)
  399. return message.channel.send(restarter);
  400. const pass = args.join(" ");
  401. const blacklister = new Discord.RichEmbed()
  402. .setColor("FF3131")
  403. .setDescription(
  404. "<:no:534824114767265823> Enter the password in order to restart Moddest."
  405. );
  406. if (pass.length < 1) return message.channel.send(blacklister);
  407. if (pass === settings.password) {
  408. const success = new Discord.RichEmbed()
  409. .setColor("00ae86")
  410. .setDescription(
  411. "<:yes:534711053511163914> Successful... Give me 10 seconds..."
  412. );
  413. message.channel.send(success);
  414. setTimeout(function() {
  415. process.exit();
  416. }, 1000);
  417. } else return message.channel.send(wrong);
  418. }
  419.  
  420. //---------------------------------------------------------------------------------------------------
  421. // HELP COMMANDS
  422.  
  423. if (command === prefix + "help" || command === mentionprefix + "help") {
  424. var color = [
  425. "#000001",
  426. "#000001",
  427. "#000001",
  428. "#000001",
  429. "#000001",
  430. "#000001",
  431. "#000001"
  432. ];
  433. var colors = color[Math.floor(Math.random() * color.length)];
  434.  
  435. let killoff = args[0];
  436. if (killoff == null) {
  437. const help = new Discord.RichEmbed()
  438. .setDescription(
  439. "Hello, " +
  440. message.author.username +
  441. `! I am ${bot.user.username} and here are my commands:`
  442. )
  443. .setColor(colors)
  444. .setThumbnail("https://downloadmoredownloads.download/i/huoq.gif")
  445. .addField(
  446. "<:red_ballons:534809072952803338> fun",
  447. `**[>>help fun](https://moddest.xyz/commands/fun)**`
  448. )
  449. .addField(
  450. "<:brown_scroll:534809207934025728> basic",
  451. "**[>>help basic](https://moddest.xyz/commands/basic)**"
  452. )
  453. .addField(
  454. "<:grey_gear:534809164963250176> config",
  455. "**[>>help config](https://moddest.xyz/commands/configural)**"
  456. )
  457. .addField(
  458. "<:mod_hammer:534809245560995850> mod",
  459. "**[>>help mod](https://moddest.xyz/commands/moderation)**"
  460. )
  461. .addField(
  462. "<:sync:534809138086281227> sync",
  463. "**[>>help sync](https://moddest.xyz/commands/sync)**"
  464. )
  465. .addField(
  466. "<:hidden_image:534810635528306698>",
  467. "[Support Server](https://discord.gg/z2PdSqH) / [Website](https://moddest.xyz/) / [Vote](https://discordbots.org/bot/522771517365420032/vote)"
  468. )
  469. .setFooter(
  470. "You can also click on the blue commands to go to the bot's online documentation."
  471. );
  472. message.channel.send(help);
  473. }
  474. if (killoff === "basic") {
  475. const basic = new Discord.RichEmbed()
  476. .setColor(colors)
  477. .setDescription("<:brown_scroll:534809207934025728> - basic")
  478. .addField(
  479. `${prefix}invite`,
  480. "sends an invite link for you to add this bot to your server"
  481. )
  482. .addField(
  483. `${prefix}support`,
  484. "retrieves the support server's invite link for you."
  485. )
  486. .addField(
  487. `${prefix}youtube <SEARCHSTRING>`,
  488. "Searches youtube for a video."
  489. )
  490. .addField(
  491. `${prefix}urban <searchstring>`,
  492. "Searches a word using urban dictionary"
  493. )
  494. .addField(`${prefix}info`, "shows the bot information")
  495. .addField(
  496. `${prefix}serverinfo`,
  497. "view some information about the server"
  498. )
  499. .addField(
  500. `${prefix}addrole <ROLE ID>`,
  501. "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)."
  502. )
  503. .addField(
  504. `${prefix}avatar <USERMENTION OR NOTHING>`,
  505. "gets avatar of you or someone else"
  506. )
  507. .addField(
  508. `${prefix}goodbye`,
  509. "bot leaves the server, server owner can only use this command."
  510. )
  511. .addField(
  512. `${prefix}find <USER_ID>`,
  513. "finds the user ID and displays their name & some information (they don't have to be in the server)"
  514. )
  515. .addField(
  516. `${prefix}setregion <regionname>`,
  517. "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')"
  518. );
  519. message.channel.send(basic);
  520. }
  521. if (killoff === "fun") {
  522. const fun = new Discord.RichEmbed()
  523. .setColor(colors)
  524. .setDescription("<:red_ballons:534809072952803338> - fun")
  525. .addField(
  526. `${prefix}roast <USERMENTION OR NOTHING>`,
  527. "roast someone like a boss"
  528. )
  529. .addField(
  530. `${prefix}clone <USERID> <MESSAGE>`,
  531. "clone someone"
  532. )
  533. .addField(
  534. `${prefix}impost <NAME> <IMAGE URL> <MESSAGE>`,
  535. "create a custom impost message."
  536. )
  537. .addField(`${prefix}dice <0-whatever>`, "rolls a dice")
  538. .addField(
  539. `${prefix}poll <QUESTION>`,
  540. "generates a yes/no poll (reactions)"
  541. )
  542. .addField(
  543. `${prefix}charactercount <MESSAGE>`,
  544. "counts how many characters you have in a message."
  545. )
  546. .addField(`${prefix}reverse <MESSAGE>`, "reverses your message")
  547. .addField(`${prefix}say <QUOTE>`, "gets the bot to say something");
  548. message.channel.send(fun);
  549. }
  550. if (killoff === "mod") {
  551. const moderator = new Discord.RichEmbed()
  552. .setColor(colors)
  553. .setDescription("<:mod_hammer:534809245560995850> - mod")
  554. .addField(
  555. `${prefix}kick <USERMENTION>`,
  556. "kick someone from the server (Sends them a reason if provided)"
  557. )
  558. .addField(
  559. `${prefix}ban <USERMENTION>`,
  560. "ban someone from the server (Sends them a reason if provided)"
  561. )
  562. .addField(
  563. `${prefix}rolekick <ROLEMENTION OR NAME>`,
  564. "kicks every member in that role"
  565. )
  566. .addField(
  567. `${prefix}roleban <ROLEMENTION OR NAME>`,
  568. "bans every member in that role"
  569. )
  570. .addField(
  571. `${prefix}idban <ID>`,
  572. "bans someone by ID, they can even not be in the server"
  573. )
  574. .addField(
  575. `${prefix}unban <username/id>`,
  576. "unbans the user, works both with username & ID, if it cannot find the user by ID it will search through the banned users"
  577. )
  578. .addField(
  579. `${prefix}purge <NUMBER OR NOTHING>`,
  580. "deletes specified amount of messages in the channel."
  581. )
  582. .addField(`${prefix}mute <USERMENTION>`, "mute someone")
  583. .addField(`${prefix}unmute <USERMENTION>`, "unmute someone");
  584. message.channel.send(moderator);
  585. }
  586. if (killoff === "sync") {
  587. const http = new Discord.RichEmbed()
  588. .setColor(colors)
  589. .setDescription("<:sync:534809138086281227> - sync")
  590. .addField(
  591. `${prefix}bansync <USER ID>`,
  592. "or >>sban <USER_ID>, bans a member from all servers you have administrator permissions in."
  593. )
  594. .addField(
  595. `${prefix}kicksync <USER ID>`,
  596. "or >>skick <USER_ID>, kicks a member from all servers you have administrator permissions in."
  597. )
  598. .addField(
  599. `${prefix}synced`,
  600. "lists all the servers the synced commands will work in with your current permissions."
  601. )
  602. .addField(
  603. `${prefix}unbansync <USER ID>`,
  604. "unbans a member from all servers you have administrator permissions in."
  605. );
  606.  
  607. message.channel.send(http);
  608. }
  609. if (killoff === "config") {
  610. const confi = new Discord.RichEmbed()
  611. .setColor(colors)
  612. .setDescription("<:grey_gear:534809164963250176> - config")
  613. .addField(`${prefix}cinfo`, "shows server configuration info.")
  614. .addField(`${prefix}nick <NICKNAME>`, "changes the bot's nickname")
  615. .addField(`${prefix}resetnick`, "resets the bot's nickname")
  616. .addField(
  617. `${prefix}toggleantialt <on/off> <1-Whatever>`,
  618. "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."
  619. )
  620. .addField(
  621. `${prefix}toggleantiads <on/off> <delete/kick/ban>`,
  622. "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."
  623. )
  624. .addField(
  625. `${prefix}antiadswhitelist <CHANNELMENTION>`,
  626. "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)"
  627. )
  628. .addField(`${prefix}removewhitelist`, "remove whitelisted channel")
  629. .addField(
  630. `${prefix}userads <on/off> <kick/ban>`,
  631. "kicks or bans user if their username contains discord.gg ads (Only works when user joins)"
  632. )
  633. .addField(
  634. `${prefix}togglemodlog <on/off> <channel>`,
  635. "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"
  636. );
  637. message.channel.send(confi);
  638. }
  639. if (killoff === "owner") {
  640. const hidden = new Discord.RichEmbed()
  641. .setColor(colors)
  642. .addField(`${prefix}eval`, "Evaluates code")
  643. .addField(
  644. `${prefix}ls`,
  645. "Lists all the servers with the current members"
  646. )
  647. .addField(
  648. `${prefix}blacklist <USER ID> <REASON>`,
  649. "blacklists someone from using the bot"
  650. )
  651. .addField(`${prefix}unblacklist <USERID>`, "unblacklists the user")
  652. .addField(
  653. `${prefix}setgame <GAMENAME>`,
  654. "sets the playing status for the bot"
  655. )
  656. .addField(`${prefix}restart <PASSWORD>`, "restarts the bot");
  657. message.channel.send(hidden);
  658. }
  659. }
  660.  
  661. //---------------------------------------------------------------------------------------------------
  662. // SYNC COMMANDS
  663.  
  664. if (
  665. command === `${prefix}synced` ||
  666. command === mentionprefix + "synced"
  667. ) {
  668. const syncer = new Discord.RichEmbed()
  669. .setColor("FF3131")
  670. .setDescription(
  671. "<:no:534824114767265823> You must have 'ADMINISTRATOR' permission to use this command."
  672. );
  673. if (
  674. !message.member.hasPermission("ADMINISTRATOR") &&
  675. message.author.id !== ownerID
  676. )
  677. return message.channel.send(syncer);
  678. let lol = bot.guilds.filter(
  679. r =>
  680. r.members.has(message.member.id) &&
  681. r.members.get(message.member.id).hasPermission("ADMINISTRATOR")
  682. );
  683. lol.forEach(async (guild, id) => {});
  684. const syncer2 = new Discord.RichEmbed()
  685. .setColor("00ae86")
  686. .setDescription(
  687. "<:yes:534711053511163914> Sync commands will work on " +
  688. lol.size +
  689. " servers: \n (" +
  690. lol.map(r => r.name) +
  691. ") \n But you must [vote](https://discordbots.org/bot/522771517365420032/vote) to use them!"
  692. );
  693. message.channel.send(syncer2);
  694. }
  695.  
  696. if (
  697. command === `${prefix}bansync` ||
  698. command === `${mentionprefix}bansync`
  699. ) {
  700. dbl
  701. .hasVoted(message.author.id)
  702. .then(voted => {
  703. if (voted) {
  704. const bansyncer1 = new Discord.RichEmbed()
  705. .setColor("FF3131")
  706. .setDescription(
  707. "<:no:534824114767265823> You must have 'ADMINISTRATOR' permission to use this command."
  708. );
  709. if (
  710. !message.member.hasPermission("ADMINISTRATOR") &&
  711. message.author.id !== ownerID
  712. )
  713. return message.channel.send(bansyncer1);
  714. const who = args.join(" ");
  715. const bansyncer2 = new Discord.RichEmbed()
  716. .setColor("FF3131")
  717. .setDescription(
  718. "<:no:534824114767265823> Please provide a valid user ID to use bansync."
  719. );
  720. if (who.length < 1) return message.channel.send(bansyncer2);
  721. let lol = bot.guilds.filter(
  722. r =>
  723. r.members.has(message.member.id) &&
  724. r.members
  725. .get(message.member.id)
  726. .hasPermission("ADMINISTRATOR")
  727. );
  728. bot
  729. .fetchUser(who)
  730. .then(r => {
  731. lol.forEach(async (guild, id) => {
  732. guild.ban(who);
  733. });
  734. const bansyncer3 = new Discord.RichEmbed()
  735. .setColor("00ae86")
  736. .setDescription(
  737. "<:yes:534711053511163914> ID: " +
  738. r.id +
  739. " (" +
  740. r.tag +
  741. ")" +
  742. " has been bansynced from: \n (" +
  743. lol.map(r => r.name) +
  744. ")"
  745. );
  746. message.channel.send(bansyncer3);
  747. })
  748. .catch(err =>
  749. message.channel.send(
  750. "<:no:534824114767265823> `User could not be found.`"
  751. )
  752. );
  753. } else {
  754. const nonvoter = new Discord.RichEmbed()
  755. .setColor("FF3131")
  756. .setDescription(
  757. "<: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. "
  758. );
  759. message.channel.send(nonvoter);
  760. }
  761. })
  762. .catch(e => {
  763. console.log(e);
  764. });
  765. }
  766.  
  767. if (
  768. command === `${prefix}kicksync` ||
  769. command === `${mentionprefix}kicksync`
  770. ) {
  771. dbl
  772. .hasVoted(message.author.id)
  773. .then(voted => {
  774. if (voted) {
  775. const kicksyncer1 = new Discord.RichEmbed()
  776. .setColor("FF3131")
  777. .setDescription(
  778. "<:no:534824114767265823> You must have 'ADMINISTRATOR' permission to use this command."
  779. );
  780. if (
  781. !message.member.hasPermission("ADMINISTRATOR") &&
  782. message.author.id !== ownerID
  783. )
  784. return message.channel.send(kicksyncer1);
  785. const who = args.join(" ");
  786. const kicksyncer2 = new Discord.RichEmbed()
  787. .setColor("FF3131")
  788. .setDescription(
  789. "<:no:534824114767265823> Please provide a valid user ID to use kicksync."
  790. );
  791. if (who.length < 1) return message.channel.send(kicksyncer2);
  792. let lol = bot.guilds.filter(
  793. r =>
  794. r.members.has(message.member.id) &&
  795. r.members
  796. .get(message.member.id)
  797. .hasPermission("ADMINISTRATOR")
  798. );
  799. bot
  800. .fetchUser(who)
  801. .then(r => {
  802. lol.forEach(async (guild, id) => {
  803. guild.kick(who);
  804. });
  805. const kicksyncer3 = new Discord.RichEmbed()
  806. .setColor("00ae86")
  807. .setDescription(
  808. "<:yes:534711053511163914> ID: " +
  809. r.id +
  810. " (" +
  811. r.tag +
  812. ")" +
  813. " has been kicksynced from: \n (" +
  814. lol.map(r => r.name) +
  815. ")"
  816. );
  817. message.channel.send(kicksyncer3);
  818. })
  819. .catch(err =>
  820. message.channel.send(
  821. "<:no:534824114767265823> `User could not be found.`"
  822. )
  823. );
  824. } else {
  825. const nonvoter = new Discord.RichEmbed()
  826. .setColor("FF3131")
  827. .setDescription(
  828. "<: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. "
  829. );
  830. message.channel.send(nonvoter);
  831. }
  832. })
  833. .catch(e => {
  834. console.log(e);
  835. });
  836. }
  837.  
  838. if (
  839. command === `${prefix}unbansync` ||
  840. command === `${mentionprefix}unbansync`
  841. ) {
  842. dbl
  843. .hasVoted(message.author.id)
  844. .then(voted => {
  845. if (voted) {
  846. const unbansyncer1 = new Discord.RichEmbed()
  847. .setColor("FF3131")
  848. .setDescription(
  849. "<:no:534824114767265823> You must have 'ADMINISTRATOR' permission to use this command."
  850. );
  851. if (
  852. !message.member.hasPermission("ADMINISTRATOR") &&
  853. message.author.id !== ownerID
  854. )
  855. return message.channel.send(unbansyncer1);
  856. const who = args.join(" ");
  857. const unbansyncer2 = new Discord.RichEmbed()
  858. .setColor("FF3131")
  859. .setDescription(
  860. "<:no:534824114767265823> Please provide a valid user ID to use unbansync."
  861. );
  862. if (who.length < 1) return message.channel.send(unbansyncer2);
  863. let lol = bot.guilds.filter(
  864. r =>
  865. r.members.has(message.member.id) &&
  866. r.members
  867. .get(message.member.id)
  868. .hasPermission("ADMINISTRATOR")
  869. );
  870. bot
  871. .fetchUser(who)
  872. .then(r => {
  873. lol.forEach(async (guild, id) => {
  874. guild.unban(who);
  875. });
  876. const unbansyncer3 = new Discord.RichEmbed()
  877. .setColor("00ae86")
  878. .setDescription(
  879. "<:yes:534711053511163914> ID: " +
  880. r.id +
  881. " (" +
  882. r.tag +
  883. ")" +
  884. " has been unbansynced from: \n (" +
  885. lol.map(r => r.name) +
  886. ")"
  887. );
  888. message.channel.send(unbansyncer3);
  889. })
  890. .catch(err =>
  891. message.channel.send(
  892. "<:no:534824114767265823> `User could not be found.`"
  893. )
  894. );
  895. } else {
  896. const nonvoter = new Discord.RichEmbed()
  897. .setColor("FF3131")
  898. .setDescription(
  899. "<: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. "
  900. );
  901. message.channel.send(nonvoter);
  902. }
  903. })
  904. .catch(e => {
  905. console.log(e);
  906. });
  907. }
  908.  
  909. //---------------------------------------------------------------------------------------------------
  910. // MOD COMMANDS
  911. if (command === `${prefix}mute`) {
  912. const muter1 = new Discord.RichEmbed()
  913. .setColor("FF3131")
  914. .setDescription(
  915. "<:no:534824114767265823> You must have 'MANAGE_MESSAGES' permission to use this command"
  916. );
  917. if (
  918. !message.member.hasPermission("MANAGE_MESSAGES") &&
  919. message.author.id !== ownerID
  920. )
  921. return message.channel.send(muter1);
  922. let role = message.guild.roles.find(r => r.name === "Muted");
  923. let toMute = message.guild.member(
  924. message.mentions.users.first() || bot.users.get(args[0])
  925. );
  926.  
  927. const muter2 = new Discord.RichEmbed()
  928. .setColor("FF3131")
  929. .setDescription(
  930. "<:no:534824114767265823> Please add 'MANAGE_MESSAGES' permission to me."
  931. );
  932. if (!message.guild.member(botID).hasPermission("MANAGE_MESSAGES"))
  933. return message.channel.sendMessage(muter2);
  934. const muter3 = new Discord.RichEmbed()
  935. .setColor("FF3131")
  936. .setDescription(
  937. "<:no:534824114767265823> Please enter a valid ID or mention a user to mute them."
  938. );
  939. if (!toMute) return message.channel.sendMessage(muter3);
  940.  
  941. const muter4 = new Discord.RichEmbed()
  942. .setColor("FF3131")
  943. .setDescription("<:no:534824114767265823> You cannot mute yourself.");
  944. if (toMute.id === message.author.id)
  945. return message.channel.sendMessage(muter4);
  946. const muter5 = new Discord.RichEmbed()
  947. .setColor("FF3131")
  948. .setDescription(
  949. "<:no:534824114767265823> You cannot mute someone higher role than you."
  950. );
  951. if (toMute.highestRole.position >= message.member.highestRole.position)
  952. return message.channel.sendMessage(muter5);
  953.  
  954. if (!role) {
  955. try {
  956. role = message.guild.createRole({
  957. name: "Muted",
  958. color: "#000001",
  959. permissions: []
  960. });
  961.  
  962. message.guild.channels.forEach(async (channel, id) => {
  963. channel.overwritePermissions(role.id, {
  964. SEND_MESSAGES: false,
  965. ADD_REACTIONS: false
  966. });
  967. });
  968. } catch (e) {
  969. console.log(e.stack);
  970. }
  971. }
  972. if (role) {
  973. try {
  974. message.guild.channels.forEach(async (channel, id) => {
  975. channel.overwritePermissions(role.id, {
  976. SEND_MESSAGES: false,
  977. ADD_REACTIONS: false
  978. });
  979. });
  980. } catch (e) {
  981. console.log(e.stack);
  982. }
  983. const muter6 = new Discord.RichEmbed()
  984. .setColor("FF3131")
  985. .setDescription(
  986. "<:no:534824114767265823> " +
  987. toMute.user.username +
  988. " (" +
  989. toMute.user.id +
  990. ") is already muted."
  991. );
  992. if (toMute.roles.has(role.id))
  993. return message.channel.sendMessage(muter6);
  994.  
  995. toMute.addRole(role);
  996. const muter7 = new Discord.RichEmbed()
  997. .setColor("00ae86")
  998. .setDescription(
  999. "<:yes:534711053511163914> " +
  1000. toMute.user.username +
  1001. " (" +
  1002. toMute.user.id +
  1003. ") has been muted. \n Execute `>>unmute " +
  1004. toMute.user.id +
  1005. "` to undo."
  1006. );
  1007. message.channel.sendMessage(muter7);
  1008. return;
  1009. }
  1010. }
  1011. if (command === `${prefix}unmute`) {
  1012. const unmuter1 = new Discord.RichEmbed()
  1013. .setColor("FF3131")
  1014. .setDescription(
  1015. "<:no:534824114767265823> You must have 'MANAGE_MESSAGES' permission to use this command."
  1016. );
  1017. if (
  1018. !message.member.hasPermission("MANAGE_MESSAGES") &&
  1019. message.author.id !== ownerID
  1020. )
  1021. return message.channel.send(unmuter1);
  1022. const who = message.mentions.users.first() || bot.users.get(args[0]);
  1023. const unmuter2 = new Discord.RichEmbed()
  1024. .setColor("FF3131")
  1025. .setDescription(
  1026. "<:no:534824114767265823> Please enter a valid ID or mention a user to unmute them."
  1027. );
  1028. if (!who) return message.channel.send(unmuter2);
  1029. const role = message.guild.roles.find(r => r.name === "Muted");
  1030. if (role) {
  1031. message.guild.members.get(who.id).removeRole(role.id);
  1032.  
  1033. const unmuter3 = new Discord.RichEmbed()
  1034. .setColor("FF3131")
  1035. .setDescription(
  1036. "<:no:534824114767265823> Please add 'MANAGE_MESSAGES' permission to me."
  1037. );
  1038. if (!message.guild.member(botID).hasPermission("MANAGE_MESSAGES"))
  1039. return message.channel.sendMessage(unmuter3);
  1040.  
  1041. const unmuter4 = new Discord.RichEmbed()
  1042. .setColor("FF3131")
  1043. .setDescription(
  1044. "<:no:534824114767265823> You cannot unmute yourself."
  1045. );
  1046. if (who.id === message.author.id)
  1047. return message.channel.sendMessage(unmuter4);
  1048. const unmuter5 = new Discord.RichEmbed()
  1049. .setColor("00ae86")
  1050. .setDescription(
  1051. "<:yes:534711053511163914> " +
  1052. who.username +
  1053. " (" +
  1054. who.id +
  1055. ") has been unmuted."
  1056. );
  1057. message.channel.send(unmuter5);
  1058. }
  1059. }
  1060.  
  1061. if (
  1062. command === `${prefix}rolekick` ||
  1063. command === `${mentionprefix}rolekick`
  1064. ) {
  1065. dbl
  1066. .hasVoted(message.author.id)
  1067. .then(voted => {
  1068. if (voted) {
  1069. const rkicker1 = new Discord.RichEmbed()
  1070. .setColor("FF3131")
  1071. .setDescription(
  1072. "<:no:534824114767265823> You must have 'KICK_MEMBERS' permission to use this command."
  1073. );
  1074. if (
  1075. !message.member.hasPermission("KICK_MEMBERS") &&
  1076. message.author.id !== ownerID
  1077. )
  1078. return message.channel.send(rkicker1);
  1079. const rkicker2 = new Discord.RichEmbed()
  1080. .setColor("FF3131")
  1081. .setDescription(
  1082. "<:no:534824114767265823> Please add 'KICK_MEMBERS' permission to me."
  1083. );
  1084. if (!message.guild.member(botID).hasPermission("KICK_MEMBERS"))
  1085. return message.channel.send(rkicker2);
  1086. const which =
  1087. message.mentions.roles.first() ||
  1088. message.guild.roles.find(r => r.name === args.join(" "));
  1089. const rkicker3 = new Discord.RichEmbed()
  1090. .setColor("FF3131")
  1091. .setDescription("<:no:534824114767265823> Role not found.");
  1092. if (!which) return message.channel.send(rkicker3);
  1093. let lmao = message.guild.fetchMembers().then(them => {
  1094. let rofl = message.guild.members.filter(r =>
  1095. r.roles.has(which.id)
  1096. );
  1097. rofl.forEach(async (member, id) => {
  1098. member.kick();
  1099. });
  1100. const rkicker4 = new Discord.RichEmbed()
  1101. .setColor("00ae86")
  1102. .setDescription(
  1103. "<:yes:534711053511163914> Kicked " +
  1104. rofl.size +
  1105. " member(s)."
  1106. );
  1107. message.channel.send(rkicker4);
  1108. });
  1109. } else {
  1110. const nonvoter = new Discord.RichEmbed()
  1111. .setColor("FF3131")
  1112. .setDescription(
  1113. "<: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. "
  1114. );
  1115. message.channel.send(nonvoter);
  1116. }
  1117. })
  1118. .catch(e => {
  1119. console.log(e);
  1120. });
  1121. }
  1122. if (
  1123. command === `${prefix}roleban` ||
  1124. command === `${mentionprefix}roleban`
  1125. ) {
  1126. dbl
  1127. .hasVoted(message.author.id)
  1128. .then(voted => {
  1129. if (voted) {
  1130. const rbanner1 = new Discord.RichEmbed()
  1131. .setColor("FF3131")
  1132. .setDescription(
  1133. "<:no:534824114767265823> You must have 'BAN_MEMBERS' permission to use this command."
  1134. );
  1135. if (
  1136. !message.member.hasPermission("BAN_MEMBERS") &&
  1137. message.author.id !== ownerID
  1138. )
  1139. return message.channel.send(rbanner1);
  1140. const rbanner2 = new Discord.RichEmbed()
  1141. .setColor("FF3131")
  1142. .setDescription(
  1143. "<:no:534824114767265823> Please add 'BAN_MEMBERS' permission to me."
  1144. );
  1145. if (!message.guild.member(botID).hasPermission("BAN_MEMBERS"))
  1146. return message.channel.send(rbanner2);
  1147. const which =
  1148. message.mentions.roles.first() ||
  1149. message.guild.roles.find(r => r.name === args.join(" "));
  1150. const rbanner3 = new Discord.RichEmbed()
  1151. .setColor("FF3131")
  1152. .setDescription("<:no:534824114767265823> Role not found.");
  1153. if (!which) return message.channel.send(rbanner3);
  1154. let lmao = message.guild.fetchMembers().then(them => {
  1155. let rofl = message.guild.members.filter(r =>
  1156. r.roles.has(which.id)
  1157. );
  1158. rofl.forEach(async (member, id) => {
  1159. member.ban();
  1160. });
  1161. const rbanner4 = new Discord.RichEmbed()
  1162. .setColor("00ae86")
  1163. .setDescription(
  1164. "<:yes:534711053511163914> Banned " +
  1165. rofl.size +
  1166. " member(s)."
  1167. );
  1168. message.channel.send(rbanner4);
  1169. });
  1170. } else {
  1171. const nonvoter = new Discord.RichEmbed()
  1172. .setColor("FF3131")
  1173. .setDescription(
  1174. "<: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. "
  1175. );
  1176. message.channel.send(nonvoter);
  1177. }
  1178. })
  1179. .catch(e => {
  1180. console.log(e);
  1181. });
  1182. }
  1183. if (command === `${prefix}purge` || command === mentionprefix + "purge") {
  1184. message.delete();
  1185. if (
  1186. !message.member.hasPermission("MANAGE_MESSAGES") &&
  1187. message.author.id !== ownerID
  1188. )
  1189. return message.channel.send(
  1190. "`You must have 'MANAGE_MESSAGES' permission to use this command`"
  1191. );
  1192. const messagecount = args[0];
  1193. console.log(messagecount);
  1194. const purger1 = new Discord.RichEmbed()
  1195. .setColor("FF3131")
  1196. .setDescription(
  1197. "<:no:534824114767265823> Please add 'MANAGE_MESSAGES' Permission to me. "
  1198. );
  1199. if (!message.guild.member(botID).hasPermission("MANAGE_MESSAGES"))
  1200. return message.channel.send(purger1);
  1201. message.channel
  1202. .fetchMessages({
  1203. limit: messagecount,
  1204. before: message.id
  1205. })
  1206. .then(messages => message.channel.bulkDelete(messages))
  1207. .then(messages =>
  1208. message.channel.send(
  1209. "<:yes:534711053511163914> Deleting..."
  1210. )
  1211. )
  1212. .then(r => r.delete("1000"));
  1213. }
  1214.  
  1215. if (command === `${prefix}kick` || command === mentionprefix + "kick") {
  1216. const kicker1 = new Discord.RichEmbed()
  1217. .setColor("FF3131")
  1218. .setDescription(
  1219. "<:no:534824114767265823> You must have 'KICK_MEMBERS' permission to use this command."
  1220. );
  1221. if (
  1222. !message.member.hasPermission("KICK_MEMBERS") &&
  1223. message.author.id !== ownerID
  1224. )
  1225. return message.channel.send(kicker1);
  1226. const who = message.mentions.users.first() || bot.users.get(args[0]);
  1227. const kicker2 = new Discord.RichEmbed()
  1228. .setColor("FF3131")
  1229. .setDescription(
  1230. "<:no:534824114767265823> Please enter a valid ID or mention a user to kick them."
  1231. );
  1232. if (!who) return message.channel.send(kicker2);
  1233. const reason = args.slice(1).join(" ");
  1234. const reason2 =
  1235. reason !== args.slice(1).join(" ").length > 1
  1236. ? reason
  1237. : "Admin has not given a reason.";
  1238. const kicker3 = new Discord.RichEmbed()
  1239. .setColor("FF3131")
  1240. .setDescription(
  1241. "<:no:534824114767265823> Please add 'KICK_MEMBERS' permission to me."
  1242. );
  1243. if (!message.guild.member(botID).hasPermission("KICK_MEMBERS"))
  1244. return message.channel.send(kicker3);
  1245. const kicker4 = new Discord.RichEmbed()
  1246. .setColor("FF3131")
  1247. .setDescription("<:no:534824114767265823> You cannot kick yourself.");
  1248. if (who.id === message.author.id) return message.channel.send(kicker4);
  1249. const kicker5 = new Discord.RichEmbed()
  1250. .setColor("FF3131")
  1251. .setDescription(
  1252. "<:no:534824114767265823> " + who.username + " cannot be kicked."
  1253. );
  1254. if (!message.guild.member(who.id).kickable)
  1255. return message.channel.send(kicker5);
  1256. const kicker6 = new Discord.RichEmbed()
  1257. .setColor("FF3131")
  1258. .setDescription(
  1259. "<:no:534824114767265823> You have been kicked from " +
  1260. message.guild.name +
  1261. ". You can rejoin at anytime."
  1262. );
  1263. let lmao = who.send(kicker6);
  1264. setTimeout(function() {
  1265. message.guild.member(who).kick();
  1266. }, 1000);
  1267. const kicker7 = new Discord.RichEmbed()
  1268. .setColor("00ae86")
  1269. .setDescription(
  1270. "<:yes:534711053511163914> " +
  1271. who.username +
  1272. " (" +
  1273. who.id +
  1274. ") has been kicked, but can rejoin at anytime."
  1275. );
  1276. message.channel.send(kicker7);
  1277. }
  1278. if (command === `${prefix}ban` || command === mentionprefix + "ban") {
  1279. const banner1 = new Discord.RichEmbed()
  1280. .setColor("FF3131")
  1281. .setDescription(
  1282. "<:no:534824114767265823> You must have 'BAN_MEMBERS' permission to use this command."
  1283. );
  1284. if (
  1285. !message.member.hasPermission("BAN_MEMBERS") &&
  1286. message.author.id !== ownerID
  1287. )
  1288. return message.channel.send(banner1);
  1289. const who = message.mentions.users.first() || bot.users.get(args[0]);
  1290. const banner2 = new Discord.RichEmbed()
  1291. .setColor("FF3131")
  1292. .setDescription(
  1293. "<:no:534824114767265823> Please enter a valid ID or mention a user to ban them."
  1294. );
  1295. if (!who) return message.channel.send(banner2);
  1296. const reason = args.slice(1).join(" ");
  1297. const reason2 =
  1298. reason !== args.slice(1).join(" ").length > 1
  1299. ? reason
  1300. : "Admin has not given a reason.";
  1301. const banner3 = new Discord.RichEmbed()
  1302. .setColor("FF3131")
  1303. .setDescription(
  1304. "<:no:534824114767265823> Please add 'BAN_MEMBERS' permission to me."
  1305. );
  1306. if (!message.guild.member(botID).hasPermission("BAN_MEMBERS"))
  1307. return message.channel.send(banner3);
  1308. const banner4 = new Discord.RichEmbed()
  1309. .setColor("FF3131")
  1310. .setDescription("<:no:534824114767265823> You cannot ban yourself.");
  1311. if (who.id === message.author.id) return message.channel.send(banner4);
  1312. const banner5 = new Discord.RichEmbed()
  1313. .setColor("FF3131")
  1314. .setDescription(
  1315. "<:no:534824114767265823> " + who.username + " cannot be banned."
  1316. );
  1317. if (!message.guild.member(who.id).bannable)
  1318. return message.channel.send(banner5);
  1319. const banner6 = new Discord.RichEmbed()
  1320. .setColor("FF3131")
  1321. .setDescription(
  1322. "<:no:534824114767265823> You have been banned from " +
  1323. message.guild.name +
  1324. " \n Reason: `" +
  1325. reason2 +
  1326. "`"
  1327. );
  1328. let lmao = who.send(banner6);
  1329. setTimeout(function() {
  1330. message.guild
  1331. .member(who)
  1332. .ban({ reason: reason2 + " || Banned by: " + message.author.tag });
  1333. }, 1000);
  1334. const banner7 = new Discord.RichEmbed()
  1335. .setColor("00ae86")
  1336. .setDescription(
  1337. "<:yes:534711053511163914> " +
  1338. who.username +
  1339. " (" +
  1340. who.id +
  1341. ") has been banned. \n Reason: `" +
  1342. reason2 +
  1343. "`"
  1344. );
  1345. message.channel.send(banner7);
  1346. }
  1347.  
  1348.  
  1349. // if(command === `${prefix}ban` || command === mentionprefix + "ban") {
  1350. // const banner1 = new Discord.RichEmbed()
  1351. // .setColor("FF3131")
  1352. // .setDescription("<:no:534824114767265823> You must have 'BAN_MEMBERS' permission to use this command.")
  1353. // if(!message.member.hasPermission("BAN_MEMBERS") && message.author.id !== ownerID) return message.channel.send(banner1)
  1354. // const who = message.mentions.users.first() || bot.users.get(args[0])
  1355. // const banner2 = new Discord.RichEmbed()
  1356. // .setColor("FF3131")
  1357. // .setDescription("<:no:534824114767265823> Please enter a valid ID or mention a user to ban them.")
  1358. // if(!who) return message.channel.send(banner2)
  1359. // const reason = args.slice(1).join(' ')
  1360. // const reason2 = reason !== args.slice(1).join(' ').length > 1 ? reason : "Admin has not given a reason."
  1361. // const banner3 = new Discord.RichEmbed()
  1362. // .setColor("FF3131")
  1363. // .setDescription("<:no:534824114767265823> Please add 'BAN_MEMBERS' permission to me.")
  1364. // if(!message.guild.member(botID).hasPermission("BAN_MEMBERS")) return message.channel.send(banner3)
  1365. // const banner4 = new Discord.RichEmbed()
  1366. // .setColor("FF3131")
  1367. // .setDescription("<:no:534824114767265823> You cannot ban yourself.")
  1368. // if(who.id === message.author.id) return message.channel.send(banner4)
  1369. // const banner5 = new Discord.RichEmbed()
  1370. // .setColor("FF3131")
  1371. // .setDescription("<:no:534824114767265823> " + who.username + " cannot be banned.")
  1372. // if(!message.guild.member(who.id).bannable) return message.channel.send(banner5)
  1373. // const banner6 = new Discord.RichEmbed()
  1374. // .setColor("FF3131")
  1375. // .setDescription("<:no:534824114767265823> You have been banned from " + message.guild.name + ". \n Reason: " + reason2 + " ")
  1376.  
  1377. // const banner7 = new Discord.RichEmbed()
  1378. // .setColor("FF3131")
  1379. // .setDescription("<:no:534824114767265823> Failed to send message to " + who.username + "most likely they have disabled direct messages, or the bot was too slow.")
  1380. // let lmao = who.send(banner6).catch(err=> message.channel.send(banner7))
  1381. // setTimeout(function() {
  1382. // message.guild.member(who).ban({reason: reason2 + " || Banned by: " + message.author.tag})
  1383. // }, 1000)
  1384. // const banner8 = new Discord.RichEmbed()
  1385. // .setColor("00ae86")
  1386. // .setDescription("<:yes:534711053511163914> " + who.username + " Has been banned. \n Reason: " + reason)
  1387. // message.channel.send(banner8)
  1388. // }
  1389.  
  1390. if (command === `${prefix}unban` || command === mentionprefix + "unban") {
  1391. if (
  1392. !message.member.hasPermission("BAN_MEMBERS") &&
  1393. message.author.id !== ownerID
  1394. )
  1395. return message.channel.send(
  1396. "`You must have 'BAN_MEMBERS' permission to use this command`"
  1397. );
  1398. if (!message.guild.member(bot.user.id).hasPermission("BAN_MEMBERS"))
  1399. return message.channel.send(
  1400. "`I need 'BAN_MEMBERS' permission to unban users`"
  1401. );
  1402. const who = args.join(" ");
  1403. message.guild
  1404. .fetchBans()
  1405. .then(r => {
  1406. const what = r.filter(
  1407. r => r.username.startsWith(who) || r.id === who
  1408. );
  1409. message.guild.unban(what.first().id);
  1410. message.channel.send("`Unbanned '" + what.map(r => r.tag) + "'`");
  1411. })
  1412. .catch(err => message.channel.send("`Could not find the user`"));
  1413. }
  1414. if (command === `${prefix}idban` || command === mentionprefix + "idban") {
  1415. if (
  1416. !message.member.hasPermission("BAN_MEMBERS") &&
  1417. message.author.id !== ownerID
  1418. )
  1419. return message.channel.send(
  1420. "`You must have 'BAN_MEMBERS' permission to use this command`"
  1421. );
  1422. if (!message.guild.member(bot.user.id).hasPermission("BAN_MEMBERS"))
  1423. return message.channel.send(
  1424. "`I need 'BAN_MEMBERS' permission to ban users`"
  1425. );
  1426. const who = args.join(" ");
  1427. if (who.length < 1)
  1428. return message.channel.send(
  1429. "`" + "Please provide an ID to ban" + "`"
  1430. );
  1431. bot
  1432. .fetchUser(who)
  1433. .then(r => {
  1434. message.guild.ban(who, { reason: "ID Banned" });
  1435. message.channel.send("`" + "Banned ID: " + who + "`");
  1436. })
  1437. .catch(err => message.channel.send("`Could not find the user ID`"));
  1438. }
  1439.  
  1440. //---------------------------------------------------------------------------------------------------
  1441. // CONGIFURAL COMMANDS
  1442. if (command === `${prefix}cinfo` || command === mentionprefix + "info") {
  1443. if (!message.member.hasPermission("MANAGE_GUILD"))
  1444. return message.channel.send(
  1445. "`You must have 'MANAGE_GUILD' permission to use this command`"
  1446. );
  1447. var color = [
  1448. "#df0736",
  1449. "#df0736",
  1450. "#df0736",
  1451. "#df0736",
  1452. "#df0736",
  1453. "#df0736",
  1454. "#df0736"
  1455. ];
  1456. var colors = color[Math.floor(Math.random() * color.length)];
  1457. fs.readFile(
  1458. "./config/" + message.guild.id + "/setting.txt",
  1459. "utf8",
  1460. function(err, data) {
  1461. fs.readFile(
  1462. "./config/" + message.guild.id + "/message.txt",
  1463. "utf8",
  1464. function(err2, data2) {
  1465. fs.readFile(
  1466. "./config/" + message.guild.id + "/channel.txt",
  1467. "utf8",
  1468. function(err3, data3) {
  1469. fs.readFile(
  1470. "./config/" + message.guild.id + "/gsetting.txt",
  1471. "utf8",
  1472. function(err4, data4) {
  1473. fs.readFile(
  1474. "./config/" + message.guild.id + "/gchannel.txt",
  1475. "utf8",
  1476. function(err5, data5) {
  1477. fs.readFile(
  1478. "./config/" + message.guild.id + "/gmessage.txt",
  1479. "utf8",
  1480. function(err6, data6) {
  1481. fs.readFile(
  1482. "./antialt/" +
  1483. message.guild.id +
  1484. "/config.txt",
  1485. "utf8",
  1486. function(err7, data7) {
  1487. fs.readFile(
  1488. "./antialt/" +
  1489. message.guild.id +
  1490. "/date.txt",
  1491. "utf8",
  1492. function(err7, data8) {
  1493. fs.readFile(
  1494. "./antiads/" +
  1495. message.guild.id +
  1496. "/en.txt",
  1497. "utf8",
  1498. function(err7, data9) {
  1499. fs.readFile(
  1500. "./antiads/" +
  1501. message.guild.id +
  1502. "/setting.txt",
  1503. "utf8",
  1504. function(err7, data10) {
  1505. fs.readFile(
  1506. `./antiads/${
  1507. message.guild.id
  1508. }/whitelist.txt`,
  1509. "utf8",
  1510. function(err, data11) {
  1511. fs.readFile(
  1512. `./modsetting/${
  1513. message.guild.id
  1514. }/setting.txt`,
  1515. "utf8",
  1516. function(err, data12) {
  1517. fs.readFile(
  1518. `./modchannel/${
  1519. message.guild.id
  1520. }/setting.txt`,
  1521. "utf8",
  1522. function(
  1523. err,
  1524. data13
  1525. ) {
  1526. fs.readFile(
  1527. `./userads/${
  1528. message.guild.id
  1529. }/en.txt`,
  1530. "utf8",
  1531. function(
  1532. err,
  1533. data14
  1534. ) {
  1535. fs.readFile(
  1536. `./userads/${
  1537. message
  1538. .guild.id
  1539. }/setting.txt`,
  1540. "utf8",
  1541. function(
  1542. err,
  1543. data15
  1544. ) {
  1545. fs.readFile(
  1546. `./customcom/prefix/${
  1547. message
  1548. .guild
  1549. .id
  1550. }/prefix.txt`,
  1551. "utf8",
  1552. function(
  1553. err,
  1554. data16
  1555. ) {
  1556. const info = new Discord.RichEmbed()
  1557. .setDescription(
  1558. message
  1559. .guild
  1560. .name +
  1561. " Configuration Settings"
  1562. )
  1563. .setColor(
  1564. colors
  1565. )
  1566. .addField(
  1567. "Anti-alt",
  1568. data7 ===
  1569. undefined
  1570. ? "None"
  1571. : data7
  1572. )
  1573. .addField(
  1574. "Anti-alt days",
  1575. data8 +
  1576. " day(s)"
  1577. )
  1578. .addField(
  1579. "Anti-ads",
  1580. data9 ===
  1581. undefined
  1582. ? "None"
  1583. : data9
  1584. )
  1585. .addField(
  1586. "Anti-ads setting",
  1587. data10 ===
  1588. undefined
  1589. ? "None"
  1590. : data10
  1591. )
  1592. .addField(
  1593. "Whitelisted channel",
  1594. data11 ===
  1595. undefined
  1596. ? "None"
  1597. : "<#" +
  1598. data11 +
  1599. ">"
  1600. )
  1601. .addField(
  1602. "Modlogs",
  1603. data12 ===
  1604. undefined
  1605. ? "None"
  1606. : data12
  1607. )
  1608. .addField(
  1609. "Modlog channel",
  1610. data13 ===
  1611. undefined
  1612. ? "None"
  1613. : "<#" +
  1614. data13 +
  1615. ">"
  1616. )
  1617. .addField(
  1618. "Anti-user ads",
  1619. data14 ===
  1620. undefined
  1621. ? "None"
  1622. : data14
  1623. )
  1624. .addField(
  1625. "Anti-user ads configuration",
  1626. data15 ===
  1627. undefined
  1628. ? "None"
  1629. : data15
  1630. );
  1631. message.channel.send(
  1632. info
  1633. );
  1634. }
  1635. );
  1636. }
  1637. );
  1638. }
  1639. );
  1640. }
  1641. );
  1642. }
  1643. );
  1644. }
  1645. );
  1646. }
  1647. );
  1648. }
  1649. );
  1650. }
  1651. );
  1652. }
  1653. );
  1654. }
  1655. );
  1656. }
  1657. );
  1658. }
  1659. );
  1660. }
  1661. );
  1662. }
  1663. );
  1664. }
  1665. );
  1666. }
  1667. if (command === `${prefix}nick` || command === `${mentionprefix}nick`) {
  1668. if (!message.member.hasPermission("MANAGE_NICKNAMES"))
  1669. return message.channel.send(
  1670. "<:no:534824114767265823> You must have 'MANAGE_NICKNAMES' permission to use this command."
  1671. );
  1672. const what = args.join(" ");
  1673. if (!what)
  1674. return message.channel.send("<:no:534824114767265823> You must provide a nickname.");
  1675. message.guild.member(botID).setNickname(what);
  1676. message.channel.send("<:yes:534711053511163914> Nickname set to: `" + what + "`");
  1677. }
  1678.  
  1679. if (
  1680. command === `${prefix}resetnick` ||
  1681. command === `${mentionprefix}resetnick`
  1682. ) {
  1683. if (!message.member.hasPermission("MANAGE_NICKNAMES"))
  1684. return message.channel.send(
  1685. "<:no:534824114767265823> You must have 'MANAGE_NICKNAMES' permission to use this command."
  1686. );
  1687. message.guild.member(botID).setNickname(" ");
  1688. message.channel.send("<:yes:534711053511163914> Nickname has been reset.");
  1689. }
  1690. if (
  1691. command === `${prefix}toggleantiads` ||
  1692. command === `${mentionprefix}toggleantiads`
  1693. ) {
  1694. if (!message.member.hasPermission("ADMINISTRATOR"))
  1695. return message.channel.send(
  1696. "<:no:534824114767265823>You must have 'ADMINISTRATOR' permission to use this command."
  1697. );
  1698. var dir = `./antiads/${message.guild.id}`;
  1699.  
  1700. if (!fs.existsSync(dir)) {
  1701. fs.mkdirSync(dir);
  1702. }
  1703. const what = args[0];
  1704. if (what === "on") {
  1705. const what2 = args.slice(1).join(" ");
  1706. if (what2 === "delete") {
  1707. fs.writeFile(`./antiads/${message.guild.id}/en.txt`, "on", function(
  1708. err
  1709. ) {
  1710. fs.writeFile(
  1711. `./antiads/${message.guild.id}/setting.txt`,
  1712. "delete",
  1713. function(err) {
  1714. message.channel.send(
  1715. "<:yes:534711053511163914> Advertisements will now be deleted immediately."
  1716. );
  1717. }
  1718. );
  1719. });
  1720. }
  1721. if (what2 === "kick") {
  1722. fs.writeFile(`./antiads/${message.guild.id}/en.txt`, "on", function(
  1723. err
  1724. ) {
  1725. fs.writeFile(
  1726. `./antiads/${message.guild.id}/setting.txt`,
  1727. "kick",
  1728. function(err) {
  1729. message.channel.send(
  1730. "<:yes:534711053511163914> Advertisement posters will now be kicked immediately."
  1731. );
  1732. }
  1733. );
  1734. });
  1735. }
  1736. if (what2 === "ban") {
  1737. fs.writeFile(`./antiads/${message.guild.id}/en.txt`, "on", function(
  1738. err
  1739. ) {
  1740. fs.writeFile(
  1741. `./antiads/${message.guild.id}/setting.txt`,
  1742. "ban",
  1743. function(err) {
  1744. message.channel.send(
  1745. "<:yes:534711053511163914> Advertisement posters will now be banned immediately."
  1746. );
  1747. }
  1748. );
  1749. });
  1750. }
  1751. }
  1752. if (what === "off") {
  1753. fs.writeFile(`./antiads/${message.guild.id}/en.txt`, "off", function(
  1754. err
  1755. ) {
  1756. message.channel.send("`" + "Disabled anti ads" + "`");
  1757. });
  1758. }
  1759. }
  1760. if (
  1761. command === `${prefix}antiadswhitelist` ||
  1762. command === `${mentionprefix}antiadswhitelist`
  1763. ) {
  1764. if (!message.member.hasPermission("ADMINISTRATOR"))
  1765. return message.channel.send(
  1766. "<:no:534824114767265823> You must have 'ADMINISTRATOR' permission to use this command."
  1767. );
  1768. const chann = message.mentions.channels.first();
  1769. if (!chann)
  1770. return message.channel.send("<:no:534824114767265823> You must mention a channel.");
  1771. fs.writeFile(
  1772. `./antiads/${message.guild.id}/whitelist.txt`,
  1773. chann.id,
  1774. function(err) {
  1775. message.channel.send(
  1776. "<:yes:534711053511163914> `" +
  1777. chann.name +
  1778. " has been marked as a 'whitelisted channel' for advertisements." +
  1779. "`"
  1780. );
  1781. }
  1782. );
  1783. }
  1784.  
  1785. if (
  1786. command === `${prefix}removewhitelist` ||
  1787. command === `${mentionprefix}removewhitelist`
  1788. ) {
  1789. if (!message.member.hasPermission("ADMINISTRATOR"))
  1790. return message.channel.send(
  1791. "<:no:534824114767265823> You must have 'ADMINISTRATOR' permission to use this command."
  1792. );
  1793. fs.writeFile(
  1794. `./antiads/${message.guild.id}/whitelist.txt`,
  1795. "None",
  1796. function(err) {
  1797. message.channel.send(
  1798. "<:yes:534711053511163914> Removed whitelisted channel for anti-ads."
  1799. );
  1800. }
  1801. );
  1802. }
  1803. if (
  1804. command === `${prefix}toggleantialt` ||
  1805. command === `${mentionprefix}toggleantialt`
  1806. ) {
  1807. if (!message.member.hasPermission("ADMINISTRATOR"))
  1808. return message.channel.send(
  1809. "<:no:534824114767265823> You must have 'ADMINISTRATOR' permission to use this command."
  1810. );
  1811. var dir = `./antialt/${message.guild.id}`;
  1812.  
  1813. if (!fs.existsSync(dir)) {
  1814. fs.mkdirSync(dir);
  1815. }
  1816. const what = args[0];
  1817. const what2 = args.slice(1).join(" ");
  1818. if (what === "on") {
  1819. if (what2.length < 1)
  1820. return message.channel.send(
  1821. "<:no:534824114767265823> Please provide a number of days from 1/3/7/14."
  1822. );
  1823. fs.writeFile(
  1824. `./antialt/${message.guild.id}/config.txt`,
  1825. "on",
  1826. function(err) {
  1827. fs.writeFile(
  1828. `./antialt/${message.guild.id}/date.txt`,
  1829. what2,
  1830. function(err) {
  1831. if (isNaN(what2))
  1832. return message.channel.send("<:no:534824114767265823> You must provide a number. \n Example: >>toggleanitalt on 1");
  1833. if (what2 === "0")
  1834. return message.channel.send("<:no:534824114767265823> Anti-alt's minimum is 1 Day.");
  1835. message.channel.send(
  1836. "<:yes:534711053511163914> Accounts must now be older than `" +
  1837. what2 +
  1838. "` day(s) in order to join this server."
  1839. );
  1840. }
  1841. );
  1842. }
  1843. );
  1844. }
  1845. if (what === "off") {
  1846. fs.writeFile(
  1847. `./antialt/${message.guild.id}/config.txt`,
  1848. "off",
  1849. function(err) {
  1850. message.channel.send("<:yes:534711053511163914> Disabled Anti-alt.");
  1851. }
  1852. );
  1853. }
  1854. }
  1855. if (
  1856. command === `${prefix}userads` ||
  1857. command === mentionprefix + "userads"
  1858. ) {
  1859. if (!message.member.hasPermission("ADMINISTRATOR"))
  1860. return message.channel.send(
  1861. "<:no:534824114767265823> You must have 'ADMINISTRATOR' permission to use this command."
  1862. );
  1863. var dir = `./userads/${message.guild.id}/`;
  1864.  
  1865. if (!fs.existsSync(dir)) {
  1866. fs.mkdirSync(dir);
  1867. }
  1868. const what = args[0];
  1869. const what2 = args.slice(1).join(" ");
  1870.  
  1871. if (what === "on") {
  1872. if (what2 === "kick") {
  1873. fs.writeFile(`./userads/${message.guild.id}/en.txt`, "on", function(
  1874. err
  1875. ) {
  1876. fs.writeFile(
  1877. `./userads/${message.guild.id}/setting.txt`,
  1878. "kick",
  1879. function(err) {
  1880. message.channel.send("<:yes:534711053511163914> Anyone who joins the server with an advertisement in their name will now be kicked.");
  1881. }
  1882. );
  1883. });
  1884. }
  1885. if (what2 === "ban") {
  1886. fs.writeFile(`./userads/${message.guild.id}/en.txt`, "on", function(
  1887. err
  1888. ) {
  1889. fs.writeFile(
  1890. `./userads/${message.guild.id}/setting.txt`,
  1891. "ban",
  1892. function(err) {
  1893. message.channel.send("<:yes:534711053511163914> Anyone who joins the server with an advertisement in their name will now be banned.");
  1894. }
  1895. );
  1896. });
  1897. }
  1898. }
  1899. if (what === "off") {
  1900. fs.writeFile(`./userads/${message.guild.id}/en.txt`, "off", function(
  1901. err
  1902. ) {
  1903. message.channel.send("<:yes:534711053511163914> User-ads is now disabled.");
  1904. });
  1905. }
  1906. }
  1907.  
  1908. // TOGGLEMODLOG is at the end of the code.
  1909.  
  1910. //---------------------------------------------------------------------------------------------------
  1911. // BASIC COMMANDS
  1912. if (
  1913. command === `${prefix}addrole` ||
  1914. command === mentionprefix + "addrole"
  1915. ) {
  1916. if (
  1917. !message.member.hasPermission("MANAGE_ROLES") &&
  1918. message.author.id !== ownerID
  1919. )
  1920. return message.channel.send(
  1921. "`You must have 'MANAGE_ROLES' permission to use this command`"
  1922. );
  1923. const whichrole = message.content.split(" ").slice(1)[0];
  1924. if (!message.guild.roles.has(whichrole))
  1925. return message.channel.send("`" + "Please provide a valid ID." + "`");
  1926. message.member.addRole(whichrole);
  1927. message.channel.send("`The role has been added successfully.`");
  1928. }
  1929.  
  1930. if (
  1931. command === `${prefix}setregion` ||
  1932. command === `${prefix}setregion`
  1933. ) {
  1934. if (!message.member.hasPermission("MANAGE_GUILD"))
  1935. return message.channel.send(
  1936. "`You don't have 'MANAGE_GUILD' permission`"
  1937. );
  1938. if (!message.guild.member(bot.user.id).hasPermission("MANAGE_GUILD"))
  1939. return message.channel.send(
  1940. "`I need 'MANAGE_GUILD' permission to execute this command`"
  1941. );
  1942. const what = args.join(" ");
  1943. if (what.length < 1) return message.channel.send("`Provide a region`");
  1944. message.guild.setRegion(what).catch(err => {
  1945. if (err)
  1946. return message.channel.send(
  1947. "`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'`"
  1948. );
  1949. });
  1950. message.channel.send("`Region has been set to " + what + "`");
  1951. }
  1952. if (message.guild.me.hasPermission("BAN_MEMBERS")) {
  1953. message.guild
  1954. .fetchBans()
  1955. .then(r => {
  1956. // use `r`
  1957. })
  1958. .catch(console.error);
  1959. }
  1960. if (
  1961. command === `${prefix}invite` ||
  1962. command === mentionprefix + "invite"
  1963. ) {
  1964. const invite = new Discord.RichEmbed()
  1965. .setColor("00ae86")
  1966. .setDescription(
  1967. "<: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) "
  1968. );
  1969. message.channel.send(invite);
  1970. }
  1971.  
  1972. if (
  1973. command === `${prefix}support` ||
  1974. command === mentionprefix + "support"
  1975. ) {
  1976. const support = new Discord.RichEmbed()
  1977. .setColor("00ae86")
  1978. .setDescription(
  1979. "<:yes:534711053511163914> https://discord.gg/7r5P5ug "
  1980. );
  1981. message.channel.send(support);
  1982. }
  1983.  
  1984. if (
  1985. command === `${prefix}goodbye` ||
  1986. command === mentionprefix + "goodbye"
  1987. ) {
  1988. const goodbyer = new Discord.RichEmbed()
  1989. .setColor("FF3131")
  1990. .setDescription(
  1991. "<:no:534824114767265823> Only the server owner can use this command!"
  1992. );
  1993. if (
  1994. message.author.id !== message.guild.owner.id &&
  1995. message.author.id !== ownerID
  1996. )
  1997. return message.channel.send(goodbyer);
  1998. const support = new Discord.RichEmbed()
  1999. .setColor("00ae86")
  2000. .setDescription(
  2001. "<: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! "
  2002. );
  2003. message.channel.send(support);
  2004. bot.users
  2005. .get(ownerID)
  2006. .send(
  2007. "`" +
  2008. message.author.username +
  2009. "#" +
  2010. message.author.discriminator +
  2011. " // used command leave on " +
  2012. message.guild.name +
  2013. "`"
  2014. );
  2015. setTimeout(function() {
  2016. message.guild.leave();
  2017. }, 1000);
  2018. }
  2019.  
  2020. if (
  2021. command === `${prefix}avatar` ||
  2022. command === mentionprefix + "avatar"
  2023. ) {
  2024. const who =
  2025. message.mentions.users.first() ||
  2026. bot.users
  2027. .filter(r => r.username.startsWith(args[0]) || r.id === args[0])
  2028. .first() ||
  2029. message.author;
  2030. var dir = `./finished/${message.guild.id}`;
  2031.  
  2032. if (!fs.existsSync(dir)) {
  2033. fs.mkdirSync(dir);
  2034. }
  2035. message.channel.send(who.avatarURL || who.defaultAvatarURL);
  2036. }
  2037. if (command === `${prefix}find` || command === mentionprefix + "find") {
  2038. const who = args.join(" ");
  2039. if (who.length < 1)
  2040. return message.channel.send("`Provide an ID to find.`");
  2041. bot
  2042. .fetchUser(who)
  2043. .then(r => {
  2044. const lol = r.presence.game;
  2045. const what = new Discord.RichEmbed()
  2046. .setDescription("INFORMATION")
  2047. .addField("Username", r.username + "#" + r.discriminator)
  2048. .addField("Status", r.presence.status)
  2049. .addField("Bot", r.bot)
  2050. .addField(
  2051. "Playing status",
  2052. lol == null ? lol : r.presence.game.name
  2053. )
  2054. .addField("Account created at", r.createdAt)
  2055. .setThumbnail(r.avatarURL || r.defaultAvatarURL);
  2056. return message.channel.send(what);
  2057. })
  2058. .catch(err => message.channel.send("`Couldn't find the user.`"));
  2059. }
  2060.  
  2061. if (
  2062. command === `${prefix}youtube` ||
  2063. command === mentionprefix + "youtube"
  2064. ) {
  2065. var searchstring = args.join(" ");
  2066. message.channel.send("`" + "Searching..." + "`").then(r => {
  2067. const searchstring = args.join(" ");
  2068. ytSearch(searchstring, function(err, results) {
  2069. const videos = results.videos;
  2070. const firstResult = videos[0];
  2071. if (err || videos[0] === undefined) return r.edit("`No results`");
  2072. r.edit("https://www.youtube.com" + firstResult.url);
  2073. });
  2074. });
  2075. }
  2076. if (command === `${prefix}urban` || command === mentionprefix + "urban") {
  2077. if (!message.channel.nsfw)
  2078. return message.channel.send(
  2079. "`This command can only be used in an NSFW channel.`"
  2080. );
  2081. const what = args.join(" ");
  2082. urban(what)
  2083. .catch(err => message.channel.send("`" + "No definition found" + "`"))
  2084. .then(r => {
  2085. message.channel.send(
  2086. "```" +
  2087. r.word +
  2088. "```" +
  2089. "\n" +
  2090. "**Definiton**" +
  2091. "\n" +
  2092. "`" +
  2093. r.definition +
  2094. "\n" +
  2095. "`" +
  2096. "\n" +
  2097. "**" +
  2098. "Example**" +
  2099. "\n" +
  2100. "``" +
  2101. r.example +
  2102. "``" +
  2103. "\n" +
  2104. "\n" +
  2105. "**Defined by: " +
  2106. r.author +
  2107. "**"
  2108. );
  2109. });
  2110. }
  2111.  
  2112. if (
  2113. command === `${prefix}userinfo` ||
  2114. command === mentionprefix + "userinfo"
  2115. ) {
  2116. var color = [
  2117. "#df0736",
  2118. "#df0736",
  2119. "#df0736",
  2120. "#df0736",
  2121. "#df0736",
  2122. "#df0736",
  2123. "#df0736"
  2124. ];
  2125. var colors = color[Math.floor(Math.random() * color.length)];
  2126. let userz =
  2127. (message.mentions.users.first() &&
  2128. message.mentions.users.first().id) ||
  2129. message.guild.members
  2130. .filter(
  2131. r =>
  2132. r.user.username.startsWith(args[0]) ||
  2133. r.user.discriminator.startsWith(args[0]) ||
  2134. r.id === args[0]
  2135. )
  2136. .first() ||
  2137. message.author;
  2138. if (!userz)
  2139. return message.channel.send(
  2140. "`" + "Please mention someone to view their information." + "`"
  2141. );
  2142. if (userz.id === botID)
  2143. return message.channel.send(
  2144. "`" + "Sorry, I cannot show you my info silly!" + "`"
  2145. );
  2146. message.guild
  2147. .fetchMember(userz)
  2148. .then(r => {
  2149. let join = message.guild.member(userz).joinedAt;
  2150. let status = userz.presence.status;
  2151. let avatar = userz.displayAvatarURL;
  2152. let lol = userz.presence.game;
  2153. let permss = message.guild.member(userz).highestRole.name;
  2154. let admin = message.guild
  2155. .member(userz)
  2156. .hasPermission("ADMINISTRATOR", true);
  2157. let nickname = message.guild.members.get(userz.id).nickname;
  2158. let extra1 = message.guild.member(userz).roles.size;
  2159. let extra2 = message.guild
  2160. .member(userz)
  2161. .roles.map(r => r)
  2162. .join(",");
  2163. const usernfo = new Discord.RichEmbed()
  2164. .setDescription(`${userz}'s info`)
  2165. .setImage(
  2166. userz.user.displayAvatarURL || userz.user.defaultAvatarURL
  2167. )
  2168. .setColor(colors)
  2169. .addField(
  2170. "Full name:",
  2171. `${userz.user.username}#${userz.user.discriminator}`
  2172. )
  2173. .addField("ID:", `${userz.id}`)
  2174. .addField(
  2175. "Last message:",
  2176. userz.lastMessage !== null
  2177. ? userz.lastMessage
  2178. : "No last messages"
  2179. )
  2180. .addField(
  2181. "Nickname:",
  2182. nickname !== null ? nickname : "No nickname"
  2183. )
  2184. .addField("Status:", status)
  2185. .addField(
  2186. "Playing:",
  2187. lol == null ? lol : userz.presence.game.name
  2188. )
  2189. .addField("Bot:", userz.user.bot)
  2190. .addField("Admin:", admin)
  2191. .addField("Highest Role:", permss)
  2192. .addField("Number of roles", extra1)
  2193. .addField("Discord join date:", userz.user.createdAt)
  2194. .addField("Guild join date:", join);
  2195. return message.channel.send(usernfo);
  2196. })
  2197. .catch(err => message.channel.send(`Couldn't find the user`));
  2198. }
  2199. if (command === `${prefix}serverinfo` || command === mentionprefix + "serverinfo") {
  2200. var color = [
  2201. "#df0736",
  2202. "#df0736",
  2203. "#df0736",
  2204. "#df0736",
  2205. "#df0736",
  2206. "#df0736",
  2207. "#df0736"
  2208. ];
  2209. var colors = color[Math.floor(Math.random() * color.length)];
  2210. let server = message.guild.name;
  2211. let owner = message.guild.owner;
  2212. let lol = message.guild.iconURL;
  2213. let reg = message.guild.region;
  2214. let nobroz = message.guild.members
  2215. .filter(r => r.user.bot)
  2216. .filter(r => r.user.presence.status !== "offline")
  2217. .map(r => r.user.username);
  2218. let AFKTimeout = message.guild.afkTimeout;
  2219. let Userc = message.guild.memberCount;
  2220. let vclist = message.guild.channels.filter(r => r.type === "voice");
  2221. let txlist = message.guild.channels.filter(r => r.type === "text");
  2222. let ctlist = message.guild.channels.filter(r => r.type === "category");
  2223. let rlmention = message.guild.roles.filter(r => r.mentionable);
  2224. let rlhoist = message.guild.roles.filter(r => r.hoist);
  2225. let rladmin = message.guild.roles.filter(r =>
  2226. r.hasPermission("ADMINISTRATOR")
  2227. );
  2228. let createdate = message.guild.createdAt;
  2229. message.guild.fetchMembers().then(r => {
  2230. let ass = r.members
  2231. .map(r => r.user.bot)
  2232. .reduce(function(a, b) {
  2233. return b ? a + 1 : a;
  2234. }, 0);
  2235. let cunt = r.members
  2236. .map(r => !r.user.bot)
  2237. .reduce(function(a, b) {
  2238. return b ? a + 1 : a;
  2239. }, 0);
  2240. let ccc = r.members
  2241. .map(r => r.user.presence.status !== "offline")
  2242. .reduce(function(a, b) {
  2243. return b ? a + 1 : a;
  2244. }, 0);
  2245. let sss = r.members
  2246. .filter(r => r.user.presence.status !== "offline")
  2247. .map(r => !r.user.bot)
  2248. .reduce(function(a, b) {
  2249. return b ? a + 1 : a;
  2250. }, 0);
  2251. let aaa = r.members
  2252. .filter(r => r.user.presence.status !== "offline")
  2253. .map(r => r.user.bot)
  2254. .reduce(function(a, b) {
  2255. return b ? a + 1 : a;
  2256. }, 0);
  2257. let sinfo = new Discord.RichEmbed()
  2258. .setDescription("Here is the server's information")
  2259. .setThumbnail(lol)
  2260. .setColor(colors)
  2261. .addField(
  2262. "Owner",
  2263. r.owner.user.username + "#" + r.owner.user.discriminator
  2264. )
  2265. .addField("Server Name", server)
  2266. .addField("Server ID", message.guild.id)
  2267. .addField("Region:", reg)
  2268. .addField("AFK Timeout", AFKTimeout)
  2269. .addField(
  2270. "This server has",
  2271. r.members.size +
  2272. " total Users" +
  2273. " (" +
  2274. ass +
  2275. " Bots)" +
  2276. " (" +
  2277. cunt +
  2278. " Humans/users" +
  2279. ")"
  2280. )
  2281. .addField(
  2282. "There are",
  2283. ccc +
  2284. " users online " +
  2285. "(" +
  2286. sss +
  2287. " Humans" +
  2288. ")" +
  2289. " (" +
  2290. aaa +
  2291. " Bots" +
  2292. ")"
  2293. )
  2294. .addField(
  2295. "This server has",
  2296. message.guild.channels.size +
  2297. " total channels" +
  2298. " " +
  2299. "(" +
  2300. vclist.size +
  2301. " voice channels)" +
  2302. " " +
  2303. "(" +
  2304. txlist.size +
  2305. " text channels" +
  2306. ")" +
  2307. " (" +
  2308. ctlist.size +
  2309. " categories )"
  2310. )
  2311. .addField(
  2312. "This server has",
  2313. message.guild.roles.size +
  2314. " Roles" +
  2315. " (" +
  2316. rlmention.size +
  2317. " mentionable)" +
  2318. " (" +
  2319. rlhoist.size +
  2320. " hoisted)" +
  2321. " (" +
  2322. rladmin.size +
  2323. " admin)"
  2324. )
  2325. .addField("Server created at:", createdate);
  2326. message.channel.send(sinfo);
  2327. });
  2328. }
  2329.  
  2330. if (command === `${prefix}info` || command === mentionprefix + "info") {
  2331. var color = [
  2332. "#df0736",
  2333. "#df0736",
  2334. "#df0736",
  2335. "#df0736",
  2336. "#df0736",
  2337. "#df0736",
  2338. "#df0736"
  2339. ];
  2340. var colors = color[Math.floor(Math.random() * color.length)];
  2341. var botuptime = bot.uptime;
  2342. x = botuptime / 1000;
  2343. seconds = Math.floor(x % 60);
  2344. x /= 60;
  2345. minutes = Math.floor(x % 60);
  2346. x /= 60;
  2347. hours = Math.floor(x % 24);
  2348. x /= 24;
  2349. days = Math.floor(x % 24);
  2350. var uptime =
  2351. days +
  2352. " day(s) " +
  2353. hours +
  2354. " hour(s) " +
  2355. minutes +
  2356. " Minute(s) " +
  2357. seconds +
  2358. " Second(s)";
  2359. fs.readFile("./description.txt", "utf8", function(err, data) {
  2360. fs.readFile("./support.txt", "utf8", function(err, data2) {
  2361. fs.readFile("./supportstats.txt", "utf8", function(err, data3) {
  2362. fs.readFile("./important.txt", "utf8", function(err, data4) {
  2363. fs.readFile("./botstart.txt", "utf8", function(err, data5) {
  2364. const aimbot = new Discord.RichEmbed()
  2365. .setDescription("BOT INFORMATION", true)
  2366. .addField("Name:", bot.user.username, true)
  2367. .addField("Version", "v" + settings.version, true)
  2368. .setColor(colors)
  2369. .addField("Uptime:", uptime, true)
  2370. .addField("Bot started at", data5, false)
  2371. .addField("Total users:", bot.users.size, true)
  2372. .addField("Seen on:", bot.guilds.size + " Servers", true)
  2373. .addField(
  2374. "Playing status",
  2375. bot.user.presence.game.name,
  2376. true
  2377. )
  2378. .addField("Ping", bot.ping)
  2379. .addField(
  2380. "Voice Connections",
  2381. bot.voiceConnections.size,
  2382. true
  2383. )
  2384. .addField("Important info", data4, true);
  2385. return message.channel.send(aimbot);
  2386. });
  2387. });
  2388. });
  2389. });
  2390. });
  2391. }
  2392.  
  2393. //---------------------------------------------------------------------------------------------------
  2394. // FUN COMMANDS
  2395.  
  2396. if (command === `${prefix}say` || command === mentionprefix + "say") {
  2397. const what = args.join(" ");
  2398. if (what.length < 1)
  2399. return message.channel.send("`" + "Please provide a message" + "`");
  2400. message.delete();
  2401. message.channel.send(what);
  2402. }
  2403. if (command === `${prefix}dice` || command === mentionprefix + "dice") {
  2404. const what = args.join(".");
  2405. if (isNaN(what))
  2406. return message.channel.send("`HAALLA that's not a number!!!!!`");
  2407. if (what.length < 1)
  2408. return message.channel.send("`" + "Please type a number" + "`");
  2409. if (what.length >= 50)
  2410. return message.channel.send(
  2411. "`" + "Your number is too long, maximum characters is 50." + "`"
  2412. );
  2413. const roll = Math.floor(Math.random() * what);
  2414. message.channel.send("`" + "You rolled a " + roll + "!" + "`");
  2415. }
  2416. if (command === `${prefix}poll`) {
  2417. const question = args.join(" ");
  2418. if (question.length < 1)
  2419. return message.channel.send("`" + "Please provide a question." + "`");
  2420. message.channel
  2421. .send(
  2422. "**POLL**" +
  2423. "\n" +
  2424. question +
  2425. "\n" +
  2426. "\n" +
  2427. "Yes: :thumbsup:" +
  2428. "\n" +
  2429. "No: :thumbsdown:"
  2430. )
  2431. .then(r => {
  2432. r.react("👍");
  2433. r.react("👎");
  2434. });
  2435. }
  2436. if (
  2437. command === `${prefix}reverse` ||
  2438. command === mentionprefix + "reverse"
  2439. ) {
  2440. const msg = args.join(" ");
  2441. const lol = msg
  2442. .split("")
  2443. .reverse()
  2444. .join("");
  2445. if (msg.length < 1)
  2446. return message.channel.send("`" + "Please type a message." + "`");
  2447. message.channel.send(lol);
  2448. }
  2449. if (
  2450. command === `${prefix}charactercount` ||
  2451. command === mentionprefix + "charactercount"
  2452. ) {
  2453. const massage = args.join(" ");
  2454. if (massage.length < 1)
  2455. return message.channel.send("`" + "You typed nothing." + "`");
  2456. message.channel.send(
  2457. "`" + "You typed: " + massage.length + " characters" + "`"
  2458. );
  2459. }
  2460. if (command === `${prefix}roast` || command === mentionprefix + "roast") {
  2461. const who = message.mentions.users.first() || message.author;
  2462. var roast = [
  2463. "Were you born on the highway? That is where most accidents happen.",
  2464. "I was going to give you a nasty look... but I see you already have one.",
  2465. "Remember when I asked for your opinion? Me neither.",
  2466. "Everyone’s entitled to act stupid once in awhile, but you really abuse the privilege.",
  2467. "Two wrongs don't make a right, take your parents as an example.",
  2468. "Just looking at you, I now understand why some animals eat their young offspring.",
  2469. "You should go do that tomorrow. Oh wait, nevermind, you've made enough mistakes already for today.",
  2470. "This is why you dont have nice things",
  2471. "My teacher told me to erase mistakes, i'm going to need a bigger eraser.",
  2472. "Are you always such an idiot, or do you just show off when I’m around?",
  2473. "There are some remarkably dumb people in this world. Thanks for helping me understand that.",
  2474. "You’re about as useful as a screen door on a submarine.",
  2475. "You always bring me so much joy—as soon as you leave the room.",
  2476. "Stupidity’s not a crime, so feel free to go.",
  2477. "If laughter is the best medicine, your face must be curing the world.",
  2478. "It looks like your face caught fire and someone tried to put it out with a hammer.",
  2479. "Scientists say the universe is made up of neutrons, protons and electrons. They forgot to mention morons like you.",
  2480. "Why is it acceptable for you to be an idiot but not for me to point it out?",
  2481. "Your family tree must be a cactus because everyone on it is a prick.",
  2482. "You'll never be the man your mother is.",
  2483. "If I had a face like yours I'd sue my parents.",
  2484. "The zoo called. They're wondering how you got out of your cage?",
  2485. "Hey, you have something on your chin... no, the 3rd one down.",
  2486. "Aww, it's so cute when you try to talk about things you don't understand.",
  2487. "You are proof that evolution can go in reverse.",
  2488. "Brains aren't everything. In your case they're nothing.",
  2489. "You're so ugly when you look in the mirror, your reflection looks away.",
  2490. "I'm sorry I didn't get that - I don't speak idiot.",
  2491. "It's better to let someone think you're stupid than open your mouth and prove it.",
  2492. "Were you born this stupid or did you take lessons?",
  2493. "You're such a beautiful, intelligent, wonderful person. Oh I'm sorry, I thought we were having a lying competition.",
  2494. "Don't you get tired of putting make up on two faces every morning?",
  2495. "If ugliness were measured in bricks, you would be the Great Wall of China.",
  2496. "I thought I said goodbye to you this morning when I flushed the toilet",
  2497. "If you're trying to improve the world, you should start with yourself. Nothing needs more help than you do",
  2498. "Zombies are looking for brains. Don't worry. You're safe.",
  2499. "spreading rumors? At least you found a hobby spreading something other than your legs.",
  2500. "i would tell you to eat trash but that’s cannibalism",
  2501. "If you spoke your mind, you would be speechless",
  2502. "I can fix my ugliness with plastic surgery but you on the other hand will stay stupid forever",
  2503. "Roses are red. Violets are blue. God made me pretty. What the hell happened to you?",
  2504. "You remind me of a penny, two faced and worthless!",
  2505. "I'd slap you, but that would be animal abuse",
  2506. "I know I’m talking like an idiot. I have to, other wise you wouldn't understand me.",
  2507. "You're so dumb, your brain cell died of loneliness",
  2508. "You shouldn't let your mind wander..its way to small to be out on its own",
  2509. "I don't know what makes you so dumb, but its working",
  2510. "You should put the diaper on your mouth, that's where the craps comin' out.",
  2511. "You would be much more likable if it wasn’t for that hole in your mouth that stupid stuff comes out of. ",
  2512. "If you had any intelligence to question I would have questioned it already.",
  2513. "I wish I had a lower I.Q, maybe then I could enjoy your company.",
  2514. "Mirrors don't lie. Lucky for you, they can't laugh either.",
  2515. "I was right there are no humans in this channel",
  2516. "You have a face not even a mother could love....",
  2517. "You know what I would find if I looked up idiot in the dictionary? a picture of you.",
  2518. "I would slap you but I don't want to make your face look any better",
  2519. "Sorry, I can't put small objects in my mouth or I'll choke",
  2520. "Too bad you can't wear those instagram filters in real life",
  2521. "Your life must be gone far downhill if you are talking to me instead of a real human",
  2522. "Have you been shopping lately? They're selling lives at the mall, you should get one"
  2523. ];
  2524. var roasts = roast[Math.floor(Math.random() * roast.length)];
  2525. message.channel.send(who.username + " " + roasts);
  2526. }
  2527. if (
  2528. command === `${prefix}clone` ||
  2529. command === mentionprefix + "clone"
  2530. ) {
  2531. if (talkedRecently.has(message.author.id)) {
  2532. /*
  2533. You can change the nature of the cool down by changing the return to something else.
  2534. REMINDER: You may need to add an else statement if you do not have any returns in this scope.
  2535. */
  2536. return message.channel.send(
  2537. "`" + "You cannot use this command for another 10 seconds" + "`"
  2538. );
  2539. }
  2540. // Adds the user to the set so that they can't talk for 2.5 seconds
  2541. talkedRecently.add(message.author.id);
  2542. setTimeout(() => {
  2543. // Removes the user from the set after 2.5 seconds
  2544. talkedRecently.delete(message.author.id);
  2545. }, 10000);
  2546. if (!message.guild.member(botID).hasPermission("MANAGE_WEBHOOKS"))
  2547. return message.channel.send(
  2548. "Please add " +
  2549. "`" +
  2550. "MANAGE_WEBHOOKS" +
  2551. "`" +
  2552. " Permission on me in order to use this command."
  2553. );
  2554. message.channel.startTyping();
  2555. const who =
  2556. (message.mentions.users.first() &&
  2557. message.mentions.users.first().id) ||
  2558. args[0];
  2559. let lmao = bot.users.get(who);
  2560. if (!lmao) {
  2561. message.channel.send("`" + "Sorry, cannot find that user." + "`");
  2562. message.channel.stopTyping();
  2563. }
  2564. if (lmao) {
  2565. var lol11 = message.guild
  2566. .fetchMember(lmao)
  2567. .then(r => {
  2568. var lol22 = r.nickname;
  2569. var avv = lmao.avatarURL || lmao.defaultAvatarURL;
  2570. const what = args.slice(1).join(" ");
  2571. if (what.length < 1) {
  2572. message.channel.send(
  2573. "`" + "Please input a message to imposter." + "`"
  2574. );
  2575. message.channel.stopTyping();
  2576. }
  2577. message.delete();
  2578. message.channel
  2579. .createWebhook(lol22 !== null ? lol22 : lmao.username, avv)
  2580. .then(wb => {
  2581. const nd = new Discord.WebhookClient(
  2582. `${wb.id}`,
  2583. `${wb.token}`
  2584. );
  2585. nd.send(what);
  2586. nd.delete();
  2587. setTimeout(function() {
  2588. message.channel.stopTyping();
  2589. }, 1000);
  2590. });
  2591. })
  2592. .catch(err => {
  2593. var avv = lmao.avatarURL || lmao.defaultAvatarURL;
  2594. const what = args.slice(1).join(" ");
  2595. if (what.length < 1) {
  2596. message.channel.send(
  2597. "`" + "Please input a message to imposter." + "`"
  2598. );
  2599. message.channel.stopTyping();
  2600. }
  2601. message.channel.createWebhook(lmao.username, avv).then(wb => {
  2602. const nd = new Discord.WebhookClient(`${wb.id}`, `${wb.token}`);
  2603. nd.send(what);
  2604. nd.delete();
  2605. setTimeout(function() {
  2606. message.channel.stopTyping();
  2607. }, 1000);
  2608. });
  2609. });
  2610. }
  2611. }
  2612.  
  2613. if (
  2614. command === `${prefix}impost` ||
  2615. command === mentionprefix + "impost"
  2616. ) {
  2617. if (talkedRecently.has(message.author.id)) {
  2618. /*
  2619. You can change the nature of the cool down by changing the return to something else.
  2620. REMINDER: You may need to add an else statement if you do not have any returns in this scope.
  2621. */
  2622. return message.channel.send(
  2623. "`" + "You cannot use this command for another 10 seconds" + "`"
  2624. );
  2625. }
  2626. // Adds the user to the set so that they can't talk for 2.5 seconds
  2627. talkedRecently.add(message.author.id);
  2628. setTimeout(() => {
  2629. // Removes the user from the set after 2.5 seconds
  2630. talkedRecently.delete(message.author.id);
  2631. }, 10000);
  2632. const name = args[0];
  2633. const url1 = args[1];
  2634. const what = args.slice(2).join(" ");
  2635. if (!message.guild.member(botID).hasPermission("MANAGE_WEBHOOKS"))
  2636. return message.channel.send(
  2637. "Please add " +
  2638. "`" +
  2639. "MANAGE_WEBHOOKS" +
  2640. "`" +
  2641. " Permission on me in order to use this command."
  2642. );
  2643. let webhookzz = message.channel
  2644. .createWebhook(name, url1)
  2645. .then(wb => {
  2646. const nd = new Discord.WebhookClient(`${wb.id}`, `${wb.token}`);
  2647. nd.send(what);
  2648. nd.delete();
  2649. })
  2650. .catch(err =>
  2651. message.channel.send(
  2652. "`" +
  2653. "Please supply a name (with no spaces), an image url, and a text to message." +
  2654. "`"
  2655. )
  2656. );
  2657. }
  2658.  
  2659. //---------------------------------------------------------------------------------------------------
  2660. // TOGGLEMODLOG CODE
  2661.  
  2662. if (command === `${prefix}togglemodlog`) {
  2663. if (!message.member.hasPermission("ADMINISTRATOR"))
  2664. return message.channel.send(
  2665. "`You must have 'ADMINISTRATOR' permission to use this command`"
  2666. );
  2667. var dir = `./modsetting/${message.guild.id}`;
  2668.  
  2669. if (!fs.existsSync(dir)) {
  2670. fs.mkdirSync(dir);
  2671. }
  2672. var dir2 = `./modchannel/${message.guild.id}`;
  2673.  
  2674. if (!fs.existsSync(dir2)) {
  2675. fs.mkdirSync(dir2);
  2676. }
  2677. const what = args[0];
  2678. if (what === "on") {
  2679. const chan = message.mentions.channels.first();
  2680. if (!chan)
  2681. return message.channel.send(
  2682. "`Please mention a channel where modlogs are gonna be stored`"
  2683. );
  2684. fs.writeFile(
  2685. `./modsetting/${message.guild.id}/setting.txt`,
  2686. "on",
  2687. function(err) {
  2688. fs.writeFile(
  2689. `./modchannel/${message.guild.id}/setting.txt`,
  2690. chan.id,
  2691. function(err) {
  2692. message.channel.send(
  2693. "`" + "modlogs have been set to " + chan.name + "`"
  2694. );
  2695. }
  2696. );
  2697. }
  2698. );
  2699. }
  2700. if (what === "off") {
  2701. fs.writeFile(
  2702. `./modsetting/${message.guild.id}/setting.txt`,
  2703. "off",
  2704. function(err) {
  2705. message.channel.send("`" + "modlogs have been turned off" + "`");
  2706. }
  2707. );
  2708. }
  2709. }
  2710. }
  2711. const what = command;
  2712. fs.readFile(
  2713. "./customcom/prefix/" + message.guild.id + "/prefix" + ".txt",
  2714. function(err, data) {
  2715. fs.readFile(
  2716. "./customcom/com/" +
  2717. message.guild.id +
  2718. "/" +
  2719. what +
  2720. "/" +
  2721. what +
  2722. ".txt",
  2723. function(err, data2) {
  2724. if (err) return;
  2725. message.channel.send(" " + data2);
  2726. }
  2727. );
  2728. }
  2729. );
  2730. fs.readFile(`./antiads/${message.guild.id}/en.txt`, "utf8", function(
  2731. err,
  2732. data
  2733. ) {
  2734. if (err) return;
  2735. if (data === "on") {
  2736. fs.readFile(
  2737. `./antiads/${message.guild.id}/whitelist.txt`,
  2738. "utf8",
  2739. function(err, data3) {
  2740. if (message.channel.id === data3) return;
  2741. if (err) undefined;
  2742. fs.readFile(
  2743. `./antiads/${message.guild.id}/setting.txt`,
  2744. "utf8",
  2745. function(err, data2) {
  2746. if (data2 === "delete") {
  2747. var no = ["discord.gg", "discordapp.com/invite/"];
  2748. if (
  2749. no.some(word =>
  2750. message.content.toLowerCase().includes(word)
  2751. )
  2752. ) {
  2753. if (message.member.hasPermission("ADMINISTRATOR")) return;
  2754. message.delete();
  2755. message.channel
  2756. .send(message.author + ", please do not advertise")
  2757. .then(r => r.delete(3000));
  2758. }
  2759. }
  2760. if (data2 === "kick") {
  2761. var no = ["discord.gg", "discordapp.com/invite/"];
  2762. if (
  2763. no.some(word =>
  2764. message.content.toLowerCase().includes(word)
  2765. )
  2766. ) {
  2767. message.delete();
  2768. if (!message.member.kickable) return;
  2769. message.member.kick("Advertising");
  2770. message.channel
  2771. .send(message.author + ", please do not advertise")
  2772. .then(r => r.delete(3000));
  2773. }
  2774. }
  2775. if (data2 === "ban") {
  2776. var no = ["discord.gg", "discordapp.com/invite/"];
  2777. if (
  2778. no.some(word =>
  2779. message.content.toLowerCase().includes(word)
  2780. )
  2781. ) {
  2782. message.delete();
  2783. if (!message.member.bannable) return;
  2784. message.member.ban({ reason: "Advertising" });
  2785. message.channel
  2786. .send(message.author + ", please do not advertise")
  2787. .then(r => r.delete(3000));
  2788. }
  2789. }
  2790. }
  2791. );
  2792. }
  2793. );
  2794. }
  2795. });
  2796. });
  2797. if (command === `>>r`) {
  2798. fs.readdir(`./cases/${message.guild.id}`, function(err, items) {
  2799. fs.readFile(
  2800. `./modsetting/${message.guild.id}/setting.txt`,
  2801. "utf8",
  2802. function(err, nobro33) {
  2803. if (err) return;
  2804. if (nobro33 === "on") {
  2805. fs.readFile(
  2806. `./modchannel/${message.guild.id}/setting.txt`,
  2807. "utf8",
  2808. function(err, nobro) {
  2809. if (!message.member.hasPermission("ADMINISTRATOR"))
  2810. return message.channel.send(
  2811. "`You must have 'ADMINISTRATOR' permission to use this command`"
  2812. );
  2813. let wadaok = bot.channels.find(c => c.id == nobro);
  2814. if (!wadaok) return;
  2815. if (message.channel.id !== nobro) return;
  2816. message.delete();
  2817. const what = args[0];
  2818. const what2 = args.slice(1).join(" ");
  2819.  
  2820. let lmao = message.channel.fetchMessages();
  2821. fs.readdir(`./cases/${message.guild.id}`, function(err, items) {
  2822. var itemz = items.length;
  2823. fs.readFile(
  2824. `./names/${message.guild.id}/` + what + ".txt",
  2825. "utf8",
  2826. function(err, data2) {
  2827. fs.readFile(
  2828. `./casename/${message.guild.id}/` + what + ".txt",
  2829. "utf8",
  2830. function(err, data3) {
  2831. fs.readFile(
  2832. `./color/${message.guild.id}/` + what + ".txt",
  2833. "utf8",
  2834. function(err, data4) {
  2835. if (message.author.id !== "477953017296060448") {
  2836. const nd = new Discord.RichEmbed()
  2837. .setDescription(
  2838. "**" + data3 + " | Case " + what + "**"
  2839. )
  2840. .addField("User", data2)
  2841. .setColor(data4)
  2842. .addField(
  2843. "Moderator",
  2844. message.author.username +
  2845. "#" +
  2846. message.author.discriminator
  2847. )
  2848. .addField("Reason", what2);
  2849. lmao
  2850. .then(r => {
  2851. fs.readFile(
  2852. `./cases/${message.guild.id}/` +
  2853. what +
  2854. ".txt",
  2855. "utf8",
  2856. function(err, data) {
  2857. let lolfcku = r.find(
  2858. r => r.id === data
  2859. );
  2860. if (!lolfcku)
  2861. return message.channel
  2862. .send("`Case not found`")
  2863. .then(r => r.delete(3000));
  2864. if (lolfcku) return lolfcku.edit(nd);
  2865. }
  2866. );
  2867. })
  2868. .catch(err => {
  2869. message.channel
  2870. .send("`Something went wrong`")
  2871. .then(r => r.delete(3000));
  2872. });
  2873. }
  2874. }
  2875. );
  2876. }
  2877. );
  2878. }
  2879. );
  2880. });
  2881. }
  2882. );
  2883. }
  2884. }
  2885. );
  2886. });
  2887. }
  2888. });
  2889.  
  2890. bot.on("guildMemberAdd", member => {
  2891. fs.readFile(`./userads/${member.guild.id}/en.txt`, "utf8", function(
  2892. err,
  2893. data
  2894. ) {
  2895. if (err) return;
  2896. if (data === "on") {
  2897. fs.readFile(`./userads/${member.guild.id}/setting.txt`, "utf8", function(
  2898. err,
  2899. data2
  2900. ) {
  2901. if (data2 === "kick") {
  2902. var no = ["discord.gg", "discordapp.com/invite/"];
  2903.  
  2904. if (
  2905. no.some(word => member.user.username.toLowerCase().includes(word))
  2906. ) {
  2907. member.kick("Advertising username/nickname");
  2908. }
  2909. }
  2910. if (data2 === "ban") {
  2911. var no = ["discord.gg", "discordapp.com/invite/"];
  2912.  
  2913. if (no.some(word => member.user.username.includes(word))) {
  2914. member.ban("Advertising username/nickname");
  2915. }
  2916. }
  2917. });
  2918. }
  2919. });
  2920. fs.readFile("./config/" + member.guild.id + "/setting.txt", "utf8", function(
  2921. err,
  2922. data
  2923. ) {
  2924. if (err) return;
  2925. if (data === "on") {
  2926. fs.readFile(
  2927. "./config/" + member.guild.id + "/channel.txt",
  2928. "utf8",
  2929. function(err, data2) {
  2930. if (err) return;
  2931. fs.readFile(
  2932. "./config/" + member.guild.id + "/message.txt",
  2933. "utf8",
  2934. function(err3, data3) {
  2935. if (err3) return;
  2936. member.guild.fetchMembers().then(r => {
  2937. var text = data3;
  2938. var values = {
  2939. server: member.guild.name,
  2940. user: member,
  2941. owner: r.owner.user.tag,
  2942. members: r.members.size,
  2943. humans: r.members.filter(r => !r.user.bot).size,
  2944. bots: r.members.filter(r => r.user.bot).size
  2945. };
  2946. var mystring = text.replace(/\{\{([^}]+)\}\}/g, function(
  2947. i,
  2948. match
  2949. ) {
  2950. return values[match];
  2951. });
  2952. let lmaof = bot.channels.find(r => r.id === data2);
  2953. if (!lmaof) return;
  2954. bot.channels.get(data2).send(mystring);
  2955. });
  2956. }
  2957. );
  2958. }
  2959. );
  2960. }
  2961. });
  2962. fs.readFile("./antialt/" + member.guild.id + "/config.txt", "utf8", function(
  2963. err,
  2964. data
  2965. ) {
  2966. fs.readFile("./antialt/" + member.guild.id + "/date.txt", "utf8", function(
  2967. err,
  2968. data2
  2969. ) {
  2970. if (err) return;
  2971. if (data === "on") {
  2972. if (
  2973. Date.now() - member.user.createdAt <
  2974. Number(data2) * 24 * 60 * 60 * 1000
  2975. ) {
  2976. member.send(
  2977. "Accounts must be older than " +
  2978. data2 +
  2979. " day(s) in order to join this server."
  2980. );
  2981. setTimeout(function() {
  2982. member.kick();
  2983. }, 1000);
  2984. } else {
  2985. undefined;
  2986. }
  2987. }
  2988. });
  2989. });
  2990. });
  2991. bot.on("guildMemberRemove", member => {
  2992. var dir = `./cases/${member.guild.id}`;
  2993.  
  2994. if (!fs.existsSync(dir)) {
  2995. fs.mkdirSync(dir);
  2996. }
  2997. var dir2 = `./names/${member.guild.id}`;
  2998.  
  2999. if (!fs.existsSync(dir2)) {
  3000. fs.mkdirSync(dir2);
  3001. }
  3002. var dir3 = `./casename/${member.guild.id}`;
  3003.  
  3004. if (!fs.existsSync(dir3)) {
  3005. fs.mkdirSync(dir3);
  3006. }
  3007. var dir4 = `./color/${member.guild.id}`;
  3008.  
  3009. if (!fs.existsSync(dir4)) {
  3010. fs.mkdirSync(dir4);
  3011. }
  3012. fs.readdir(`./cases/${member.guild.id}`, function(err, items) {
  3013. fs.readFile(`./modsetting/${member.guild.id}/setting.txt`, "utf8", function(
  3014. err,
  3015. nobro33
  3016. ) {
  3017. if (err) return;
  3018. if (nobro33 === "on") {
  3019. fs.readFile(
  3020. `./modchannel/${member.guild.id}/setting.txt`,
  3021. "utf8",
  3022. function(err, nobro) {
  3023. let wadaok = bot.channels.find(c => c.id == nobro);
  3024. if (!wadaok) return;
  3025. var itemrare = items.length + 1;
  3026. let lol = bot.channels.find(r => r.name);
  3027. if (!lol) return;
  3028. member.guild.fetchAuditLogs().then(r => {
  3029. let lmfao = r.entries
  3030. .filter(r => r.actionType === "DELETE")
  3031. .filter(r => r.action === "MEMBER_KICK");
  3032. if (!lmfao.first()) return;
  3033. let lmfao2 = lmfao.map(r => r.target.id);
  3034.  
  3035. const altreason =
  3036. lmfao.first().reason === undefined
  3037. ? null
  3038. : lmfao.first().reason;
  3039. const altmoderator =
  3040. lmfao.first().executor.username +
  3041. "#" +
  3042. lmfao.first().executor.discriminator;
  3043. const timeaudit = Date.now() - lmfao.first().createdTimestamp;
  3044. if (Math.floor(timeaudit / 1000) < -22) {
  3045. const embed = new Discord.RichEmbed()
  3046. .setDescription("**Kick | Case " + itemrare + "**")
  3047. .addField(
  3048. "User",
  3049. member.user.username +
  3050. "#" +
  3051. member.user.discriminator +
  3052. " (" +
  3053. member.user +
  3054. ")"
  3055. )
  3056. .addField("Moderator", altmoderator)
  3057. .setColor("#dd2e44")
  3058. .addField(
  3059. "Reason",
  3060. altreason !== null
  3061. ? altreason
  3062. : "`moderator, please do >>r " + itemrare + " <reason>`"
  3063. );
  3064. bot.channels
  3065. .get(nobro)
  3066. .send(embed)
  3067. .then(r => {
  3068. fs.readdir(`./cases/${member.guild.id}/`, function(
  3069. err,
  3070. items
  3071. ) {
  3072. fs.readdir(`./names/${member.guild.id}/`, function(
  3073. err,
  3074. items2
  3075. ) {
  3076. fs.readdir(`./casename/${member.guild.id}/`, function(
  3077. err,
  3078. items22
  3079. ) {
  3080. fs.readdir(`./color/${member.guild.id}/`, function(
  3081. err,
  3082. items33
  3083. ) {
  3084. var items1 = items.length + 1;
  3085. var items3 = items2.length + 1;
  3086. var items4 = items22.length + 1;
  3087. var items5 = items33.length + 1;
  3088. fs.writeFile(
  3089. `./cases/${member.guild.id}/` + items1 + ".txt",
  3090. r.id,
  3091. function(err) {
  3092. fs.writeFile(
  3093. `./names/${member.guild.id}/` +
  3094. items3 +
  3095. ".txt",
  3096. member.user.username +
  3097. "#" +
  3098. member.user.discriminator +
  3099. "(" +
  3100. member.user +
  3101. ")",
  3102. function(err) {
  3103. fs.writeFile(
  3104. `./casename/${member.guild.id}/` +
  3105. items4 +
  3106. ".txt",
  3107. "Kick",
  3108. function(err) {
  3109. fs.writeFile(
  3110. `./color/${member.guild.id}/` +
  3111. items4 +
  3112. ".txt",
  3113. "#dd2e44",
  3114. function(err) {}
  3115. );
  3116. }
  3117. );
  3118. }
  3119. );
  3120. }
  3121. );
  3122. });
  3123. });
  3124. });
  3125. });
  3126. });
  3127. }
  3128. });
  3129. }
  3130. );
  3131. }
  3132. });
  3133. });
  3134. fs.readFile("./config/" + member.guild.id + "/gsetting.txt", "utf8", function(
  3135. err,
  3136. data
  3137. ) {
  3138. if (err) return;
  3139. if (data === "on") {
  3140. fs.readFile(
  3141. "./config/" + member.guild.id + "/gchannel.txt",
  3142. "utf8",
  3143. function(err, data2) {
  3144. if (err) return;
  3145. fs.readFile(
  3146. "./config/" + member.guild.id + "/gmessage.txt",
  3147. "utf8",
  3148. function(err3, data3) {
  3149. if (err3) return;
  3150. member.guild.fetchMembers().then(r => {
  3151. var text = data3;
  3152. var values = {
  3153. server: member.guild.name,
  3154. user: member.user.username + "#" + member.user.discriminator,
  3155. owner: r.owner.user.tag,
  3156. members: r.members.size,
  3157. humans: r.members.filter(r => !r.user.bot).size,
  3158. bots: r.members.filter(r => r.user.bot).size
  3159. };
  3160. var mystring = text.replace(/\{\{([^}]+)\}\}/g, function(
  3161. i,
  3162. match
  3163. ) {
  3164. return values[match];
  3165. });
  3166. let lmaof = bot.channels.find(r => r.id === data2);
  3167. if (!lmaof) return;
  3168. bot.channels.get(data2).send(mystring);
  3169. });
  3170. }
  3171. );
  3172. }
  3173. );
  3174. }
  3175. });
  3176. });
  3177.  
  3178. bot.on("messageUpdate", (oldMessage, newMessage) => {
  3179. if (newMessage.author.bot) return;
  3180. if (newMessage.channel.type !== "text") return;
  3181. fs.readFile(`./antiads/${newMessage.guild.id}/en.txt`, "utf8", function(
  3182. err,
  3183. data
  3184. ) {
  3185. if (err) return;
  3186. if (data === "on") {
  3187. fs.readFile(
  3188. `./antiads/${newMessage.guild.id}/setting.txt`,
  3189. "utf8",
  3190. function(err, data2) {
  3191. fs.readFile(
  3192. `./antiads/${newMessage.guild.id}/whitelist.txt`,
  3193. "utf8",
  3194. function(err, data3) {
  3195. if (newMessage.channel.id === data3) return;
  3196. if (err) undefined;
  3197. if (data2 === "delete") {
  3198. var no = ["discord.gg", "discordapp.com/invite/"];
  3199. if (
  3200. no.some(word =>
  3201. newMessage.content.toLowerCase().includes(word)
  3202. )
  3203. ) {
  3204. if (newMessage.member.hasPermission("ADMINISTRATOR")) return;
  3205. newMessage.delete();
  3206. newMessage.channel
  3207. .send(newMessage.author + ", please do not advertise")
  3208. .then(r => r.delete(3000));
  3209. }
  3210. }
  3211. if (data2 === "kick") {
  3212. var no = ["discord.gg", "discordapp.com/invite/"];
  3213. if (
  3214. no.some(word =>
  3215. newMessage.content.toLowerCase().includes(word)
  3216. )
  3217. ) {
  3218. newMessage.delete();
  3219. if (!newMessage.member.kickable) return;
  3220. newMessage.member.kick("Advertising");
  3221. newMessage.channel
  3222. .send(newMessage.author + ", please do not advertise")
  3223. .then(r => r.delete(3000));
  3224. }
  3225. }
  3226. if (data2 === "ban") {
  3227. var no = ["discord.gg", "discordapp.com/invite/"];
  3228. if (
  3229. no.some(word =>
  3230. newMessage.content.toLowerCase().includes(word)
  3231. )
  3232. ) {
  3233. newMessage.delete();
  3234. if (!newMessage.member.bannable) return;
  3235. newMessage.member.ban("Advertising");
  3236. newMessage.channel
  3237. .send(newMessage.author + ", please do not advertise")
  3238. .then(r => r.delete(3000));
  3239. }
  3240. }
  3241. }
  3242. );
  3243. }
  3244. );
  3245. }
  3246. });
  3247. });
  3248. bot.on("guildBanAdd", (guild, user) => {
  3249. var dir = `./cases/${guild.id}`;
  3250.  
  3251. if (!fs.existsSync(dir)) {
  3252. fs.mkdirSync(dir);
  3253. }
  3254. var dir2 = `./names/${guild.id}`;
  3255.  
  3256. if (!fs.existsSync(dir2)) {
  3257. fs.mkdirSync(dir2);
  3258. }
  3259. var dir3 = `./casename/${guild.id}`;
  3260.  
  3261. if (!fs.existsSync(dir3)) {
  3262. fs.mkdirSync(dir3);
  3263. }
  3264. var dir4 = `./color/${guild.id}`;
  3265.  
  3266. if (!fs.existsSync(dir4)) {
  3267. fs.mkdirSync(dir4);
  3268. }
  3269. fs.readdir(`./cases/${guild.id}`, function(err, items) {
  3270. fs.readFile(`./modsetting/${guild.id}/setting.txt`, "utf8", function(
  3271. err,
  3272. nobro33
  3273. ) {
  3274. if (err) return;
  3275. if (nobro33 === "on") {
  3276. fs.readFile(`./modchannel/${guild.id}/setting.txt`, "utf8", function(
  3277. err,
  3278. nobro
  3279. ) {
  3280. let wadaok = bot.channels.find(c => c.id == nobro);
  3281. if (!wadaok) return;
  3282. var itemrare = items.length + 1;
  3283. let lol = bot.channels.find(r => r.name);
  3284. if (!lol) return;
  3285. guild.fetchAuditLogs().then(r => {
  3286. let lmfao = r.entries
  3287. .filter(r => r.actionType === "DELETE")
  3288. .filter(r => r.action === "MEMBER_BAN_ADD");
  3289. let lmfao2 = lmfao.map(r => r.target.id);
  3290.  
  3291. const altreason =
  3292. lmfao.first().reason === undefined ? null : lmfao.first().reason;
  3293. const altmoderator =
  3294. lmfao.first().executor.username +
  3295. "#" +
  3296. lmfao.first().executor.discriminator;
  3297. const embed = new Discord.RichEmbed()
  3298. .setDescription("**Ban | Case " + itemrare + "**")
  3299. .addField(
  3300. "User",
  3301. user.username + "#" + user.discriminator + " (" + user + ")"
  3302. )
  3303. .addField("Moderator", altmoderator)
  3304. .setColor("#dd2e44")
  3305. .addField(
  3306. "Reason",
  3307. altreason !== null
  3308. ? altreason
  3309. : "`moderator, please do >>r " + itemrare + " <reason>`"
  3310. );
  3311. bot.channels
  3312. .get(nobro)
  3313. .send(embed)
  3314. .then(r => {
  3315. fs.readdir(`./cases/${guild.id}/`, function(err, items) {
  3316. fs.readdir(`./names/${guild.id}/`, function(err, items2) {
  3317. fs.readdir(`./casename/${guild.id}/`, function(
  3318. err,
  3319. items22
  3320. ) {
  3321. fs.readdir(`./color/${guild.id}/`, function(
  3322. err,
  3323. items33
  3324. ) {
  3325. var items1 = items.length + 1;
  3326. var items3 = items2.length + 1;
  3327. var items4 = items22.length + 1;
  3328. var items5 = items33.length + 1;
  3329. fs.writeFile(
  3330. `./cases/${guild.id}/` + items1 + ".txt",
  3331. r.id,
  3332. function(err) {
  3333. fs.writeFile(
  3334. `./names/${guild.id}/` + items3 + ".txt",
  3335. user.username +
  3336. "#" +
  3337. user.discriminator +
  3338. "(" +
  3339. user +
  3340. ")",
  3341. function(err) {
  3342. fs.writeFile(
  3343. `./casename/${guild.id}/` + items4 + ".txt",
  3344. "Ban",
  3345. function(err) {
  3346. fs.writeFile(
  3347. `./color/${guild.id}/` + items4 + ".txt",
  3348. "#dd2e44",
  3349. function(err) {}
  3350. );
  3351. }
  3352. );
  3353. }
  3354. );
  3355. }
  3356. );
  3357. });
  3358. });
  3359. });
  3360. });
  3361. });
  3362. });
  3363. });
  3364. }
  3365. });
  3366. });
  3367. });
  3368. bot.on("guildBanRemove", (guild, user) => {
  3369. var dir = `./cases/${guild.id}`;
  3370.  
  3371. if (!fs.existsSync(dir)) {
  3372. fs.mkdirSync(dir);
  3373. }
  3374. var dir2 = `./names/${guild.id}`;
  3375.  
  3376. if (!fs.existsSync(dir2)) {
  3377. fs.mkdirSync(dir2);
  3378. }
  3379. var dir3 = `./casename/${guild.id}`;
  3380.  
  3381. if (!fs.existsSync(dir3)) {
  3382. fs.mkdirSync(dir3);
  3383. }
  3384. var dir4 = `./color/${guild.id}`;
  3385.  
  3386. if (!fs.existsSync(dir4)) {
  3387. fs.mkdirSync(dir4);
  3388. }
  3389. fs.readdir(`./cases/${guild.id}`, function(err, items) {
  3390. fs.readFile(`./modsetting/${guild.id}/setting.txt`, "utf8", function(
  3391. err,
  3392. nobro33
  3393. ) {
  3394. if (err) return;
  3395. if (nobro33 === "on") {
  3396. fs.readFile(`./modchannel/${guild.id}/setting.txt`, "utf8", function(
  3397. err,
  3398. nobro
  3399. ) {
  3400. let wadaok = bot.channels.find(c => c.id == nobro);
  3401. if (!wadaok) return;
  3402. var itemrare = items.length + 1;
  3403. guild.fetchAuditLogs().then(r => {
  3404. let lmfao = r.entries
  3405. .filter(r => r.actionType === "CREATE")
  3406. .filter(r => r.action === "MEMBER_BAN_REMOVE");
  3407. let lmfao2 = lmfao.map(r => r.target.id);
  3408.  
  3409. const altreason =
  3410. lmfao.first().reason === undefined ? null : lmfao.first().reason;
  3411. const altmoderator =
  3412. lmfao.first().executor.username +
  3413. "#" +
  3414. lmfao.first().executor.discriminator;
  3415. const embed = new Discord.RichEmbed()
  3416. .setDescription("**Unban | Case " + itemrare + "**")
  3417. .addField(
  3418. "User",
  3419. user.username + "#" + user.discriminator + " (" + user + ")"
  3420. )
  3421. .addField("Moderator", altmoderator)
  3422. .setColor("#00ae86")
  3423. .addField(
  3424. "Reason",
  3425. altreason !== null
  3426. ? altreason
  3427. : "`moderator, please do >>r " + itemrare + " <reason>`"
  3428. );
  3429. bot.channels
  3430. .get(nobro)
  3431. .send(embed)
  3432. .then(r => {
  3433. fs.readdir(`./cases/${guild.id}/`, function(err, items) {
  3434. fs.readdir(`./names/${guild.id}/`, function(err, items2) {
  3435. fs.readdir(`./casename/${guild.id}/`, function(
  3436. err,
  3437. items22
  3438. ) {
  3439. fs.readdir(`./color/${guild.id}/`, function(
  3440. err,
  3441. items33
  3442. ) {
  3443. var items1 = items.length + 1;
  3444. var items3 = items2.length + 1;
  3445. var items4 = items22.length + 1;
  3446. var items5 = items33.length + 1;
  3447. fs.writeFile(
  3448. `./cases/${guild.id}/` + items1 + ".txt",
  3449. r.id,
  3450. function(err) {
  3451. fs.writeFile(
  3452. `./names/${guild.id}/` + items3 + ".txt",
  3453. user.username +
  3454. "#" +
  3455. user.discriminator +
  3456. "(" +
  3457. user +
  3458. ")",
  3459. function(err) {
  3460. fs.writeFile(
  3461. `./casename/${guild.id}/` + items4 + ".txt",
  3462. "Unban",
  3463. function(err) {
  3464. fs.writeFile(
  3465. `./color/${guild.id}/` + items4 + ".txt",
  3466. "#00ae86",
  3467. function(err) {}
  3468. );
  3469. }
  3470. );
  3471. }
  3472. );
  3473. }
  3474. );
  3475. });
  3476. });
  3477. });
  3478. });
  3479. });
  3480. });
  3481. });
  3482. }
  3483. });
  3484. });
  3485. });
  3486. bot.on("guildMemberUpdate", (oldMember, newMember) => {
  3487. fs.readFile(`./userads/${newMember.guild.id}/setting.txt`, "utf8", function(
  3488. err,
  3489. data2
  3490. ) {
  3491. if (data2 === "kick") {
  3492. var no = ["discord.gg", "discordapp.com/invite/"];
  3493.  
  3494. if (
  3495. no.some(word =>
  3496. newMember.nickname === null
  3497. ? undefined
  3498. : newMember.nickname.includes(word) ||
  3499. newMember.user.username.toLowerCase().includes(word)
  3500. )
  3501. ) {
  3502. newMember.kick("Advertising username/nickname");
  3503. }
  3504. }
  3505. if (data2 === "ban") {
  3506. var no = ["discord.gg", "discordapp.com/invite/"];
  3507.  
  3508. if (
  3509. no.some(word =>
  3510. newMember.nickname === null
  3511. ? undefined
  3512. : newMember.nickname.includes(word) ||
  3513. newMember.user.username.includes(word)
  3514. )
  3515. ) {
  3516. newMember.ban("Advertising username/nickname");
  3517. }
  3518. }
  3519. });
  3520. var dir = `./cases/${newMember.guild.id}`;
  3521.  
  3522. if (!fs.existsSync(dir)) {
  3523. fs.mkdirSync(dir);
  3524. }
  3525. var dir2 = `./names/${newMember.guild.id}`;
  3526.  
  3527. if (!fs.existsSync(dir2)) {
  3528. fs.mkdirSync(dir2);
  3529. }
  3530. var dir3 = `./casename/${newMember.guild.id}`;
  3531.  
  3532. if (!fs.existsSync(dir3)) {
  3533. fs.mkdirSync(dir3);
  3534. }
  3535. var dir4 = `./color/${newMember.guild.id}`;
  3536.  
  3537. if (!fs.existsSync(dir4)) {
  3538. fs.mkdirSync(dir4);
  3539. }
  3540. fs.readdir(`./cases/${newMember.guild.id}`, function(err, items) {
  3541. fs.readFile(
  3542. `./modsetting/${newMember.guild.id}/setting.txt`,
  3543. "utf8",
  3544. function(err, nobro33) {
  3545. if (err) return;
  3546. if (nobro33 === "on") {
  3547. fs.readFile(
  3548. `./modchannel/${newMember.guild.id}/setting.txt`,
  3549. "utf8",
  3550. function(err, nobro) {
  3551. let wadaok = bot.channels.find(c => c.id == nobro);
  3552. if (!wadaok) return;
  3553. const role = newMember.guild.roles.find(r => r.name === "Muted");
  3554. if (!role) return;
  3555. if (newMember.roles.has(role.id)) {
  3556. if (!oldMember.roles.has(role.id)) {
  3557. fs.readdir(`./cases/${newMember.guild.id}`, function(
  3558. err,
  3559. items
  3560. ) {
  3561. var itemrare = items.length + 1;
  3562. let lol = bot.channels.find("id", nobro);
  3563. if (!lol) return;
  3564. newMember.guild.fetchAuditLogs().then(r => {
  3565. let lmfao = r.entries
  3566. .filter(r => r.actionType === "UPDATE")
  3567. .filter(r => r.action === "MEMBER_ROLE_UPDATE");
  3568. let lmfao2 = lmfao.map(r => r.target.id);
  3569.  
  3570. const altmoderator =
  3571. lmfao.first().executor.username +
  3572. "#" +
  3573. lmfao.first().executor.discriminator;
  3574. const embed = new Discord.RichEmbed()
  3575. .setDescription("**Mute | Case " + itemrare + "**")
  3576. .addField(
  3577. "User",
  3578. newMember.user.username +
  3579. "#" +
  3580. newMember.user.discriminator +
  3581. " (" +
  3582. newMember +
  3583. ")"
  3584. )
  3585. .addField("Moderator", altmoderator)
  3586. .setColor("#dd2e44")
  3587. .addField(
  3588. "Reason",
  3589. "`moderator, please do >>r " + itemrare + " <reason>`"
  3590. );
  3591. bot.channels
  3592. .get(nobro)
  3593. .send(embed)
  3594. .then(r => {
  3595. fs.readdir(`./cases/${newMember.guild.id}`, function(
  3596. err,
  3597. items
  3598. ) {
  3599. fs.readdir(
  3600. `./names/${newMember.guild.id}`,
  3601. function(err, items2) {
  3602. fs.readdir(
  3603. `./casename/${newMember.guild.id}`,
  3604. function(err, items22) {
  3605. fs.readdir(
  3606. `./color/${newMember.guild.id}`,
  3607. function(err, items33) {
  3608. var items1 = items.length + 1;
  3609. var items3 = items2.length + 1;
  3610. var items4 = items22.length + 1;
  3611. var items5 = items33.length + 1;
  3612. fs.writeFile(
  3613. `./cases/${newMember.guild.id}/` +
  3614. items1 +
  3615. ".txt",
  3616. r.id,
  3617. function(err) {
  3618. fs.writeFile(
  3619. `./names/${newMember.guild.id}/` +
  3620. items3 +
  3621. ".txt",
  3622. newMember.user.username +
  3623. "#" +
  3624. newMember.user.discriminator +
  3625. "(" +
  3626. newMember +
  3627. ")",
  3628. function(err) {
  3629. fs.writeFile(
  3630. `./casename/${
  3631. newMember.guild.id
  3632. }/` +
  3633. items4 +
  3634. ".txt",
  3635. "Mute",
  3636. function(err) {
  3637. fs.writeFile(
  3638. `./color/${
  3639. newMember.guild.id
  3640. }/` +
  3641. items4 +
  3642. ".txt",
  3643. "#dd2e44",
  3644. function(err) {}
  3645. );
  3646. }
  3647. );
  3648. }
  3649. );
  3650. }
  3651. );
  3652. }
  3653. );
  3654. }
  3655. );
  3656. }
  3657. );
  3658. });
  3659. });
  3660. });
  3661. });
  3662. }
  3663. }
  3664. if (
  3665. oldMember.roles.has(role.id) &&
  3666. !newMember.roles.has(role.id)
  3667. ) {
  3668. fs.readdir(`./cases/${newMember.guild.id}`, function(
  3669. err,
  3670. items
  3671. ) {
  3672. var itemrare = items.length + 1;
  3673. let lol = bot.channels.find("id", nobro);
  3674. if (!lol) return;
  3675. newMember.guild.fetchAuditLogs().then(r => {
  3676. let lmfao = r.entries
  3677. .filter(r => r.actionType === "UPDATE")
  3678. .filter(r => r.action === "MEMBER_ROLE_UPDATE");
  3679. let lmfao2 = lmfao.map(r => r.target.id);
  3680.  
  3681. const altmoderator =
  3682. lmfao.first().executor.username +
  3683. "#" +
  3684. lmfao.first().executor.discriminator;
  3685. const embed = new Discord.RichEmbed()
  3686. .setDescription("**Unmute | Case" + itemrare + "**")
  3687. .addField(
  3688. "User",
  3689. newMember.user.username +
  3690. "#" +
  3691. newMember.user.discriminator +
  3692. " (" +
  3693. newMember +
  3694. ")"
  3695. )
  3696. .addField("Moderator", altmoderator)
  3697. .setColor("#00ae86")
  3698. .addField(
  3699. "Reason",
  3700. "`moderator, please do >>r " + itemrare + " <reason>`"
  3701. );
  3702. bot.channels
  3703. .get(nobro)
  3704. .send(embed)
  3705. .then(r => {
  3706. fs.readdir(`./cases/${newMember.guild.id}`, function(
  3707. err,
  3708. items
  3709. ) {
  3710. fs.readdir(`./names/${newMember.guild.id}`, function(
  3711. err,
  3712. items2
  3713. ) {
  3714. fs.readdir(
  3715. `./casename/${newMember.guild.id}`,
  3716. function(err, items22) {
  3717. fs.readdir(
  3718. `./color/${newMember.guild.id}`,
  3719. function(err, items33) {
  3720. var items1 = items.length + 1;
  3721. var items3 = items2.length + 1;
  3722. var items4 = items22.length + 1;
  3723. var items5 = items33.length + 1;
  3724. fs.writeFile(
  3725. `./cases/${newMember.guild.id}/` +
  3726. items1 +
  3727. ".txt",
  3728. r.id,
  3729. function(err) {
  3730. fs.writeFile(
  3731. `./names/${newMember.guild.id}/` +
  3732. items3 +
  3733. ".txt",
  3734. newMember.user.username +
  3735. "#" +
  3736. newMember.user.discriminator +
  3737. "(" +
  3738. newMember +
  3739. ")",
  3740. function(err) {
  3741. fs.writeFile(
  3742. `./casename/${
  3743. newMember.guild.id
  3744. }/` +
  3745. items4 +
  3746. ".txt",
  3747. "Unmute",
  3748. function(err) {
  3749. fs.writeFile(
  3750. `./color/${
  3751. newMember.guild.id
  3752. }/` +
  3753. items4 +
  3754. ".txt",
  3755. "#00ae86",
  3756. function(err) {}
  3757. );
  3758. }
  3759. );
  3760. }
  3761. );
  3762. }
  3763. );
  3764. }
  3765. );
  3766. }
  3767. );
  3768. });
  3769. });
  3770. });
  3771. });
  3772. });
  3773. }
  3774. }
  3775. );
  3776. }
  3777. }
  3778. );
  3779. });
  3780. });
  3781. const { MessageEmbed } = require('discord.js');
  3782.  
  3783. const { WebhookClient } = require('discord.js');
  3784. let webhook_url = 'https://discordapp.com/api/webhooks/538905072629973012/onhVaPEIrj4TC6Jca4NBgKtZZavjEgkBPtUDH-Akz9f64tauEWAfSFwVhe3dfIDJubXW';
  3785. const guildWebhook = new WebhookClient(webhook_url.split('/').slice(5)[0], webhook_url.split('/').slice(5)[1]);
  3786.  
  3787. module.exports = async (bot, guild) => {
  3788. let users = guild.members.filter(u => !u.user.bot).size;
  3789. let bots = guild.members.filter(u => u.user.bot).size;
  3790. const guildLog = new RichEmbed()
  3791. .setAuthor(guild.name, guild.iconURL({ format: 'png' }))
  3792. .setTitle(`Joined a new server!`).setURL(`https://discordbots.org/bot/522771517365420032/vote`)
  3793. .setColor('#ED1B24')
  3794. .addField('ID', `${guild.id}`, true)
  3795. .addField('Members', `${users} user${users > 1 ? 's' : ''} **|** ${bots} bot${bots > 1 ? 's' : ''}`, true)
  3796. .addField('Owned by', `${guild.owner.user.tag} [\`${guild.ownerID}\`]`)
  3797. .setTimestamp()
  3798. guildWebhook.send(guildLog);
  3799. }
  3800.  
  3801. //---------------------------------------------------------------------------------------------------
  3802. // HANDLERS + LOGIN
  3803.  
  3804. ["uncaughtException", "unhandledRejection"].forEach(err => {
  3805. process.on(err, function(reason) {
  3806. process.on("unhandledRejection", console.error);
  3807. process.on("uncaughtException", console.error);
  3808. //process.exit(0);
  3809. });
  3810. });
  3811. bot.login(settings.token);
Add Comment
Please, Sign In to add comment