Advertisement
Guest User

Untitled

a guest
Apr 18th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 14.31 KB | None | 0 0
  1. const mysql = require("mysql");
  2. const botSettings = require("./botSettings.json");
  3. const Discord = require("discord.js");
  4. const prefix = botSettings.prefix;
  5. const fs = require("fs");
  6. var osutils = require("./node_modules/os-utils");
  7. var cpustat = require("./node_modules/cpu-stat");
  8. const urban = module.require("urban");
  9. var os = require("os");
  10. var cpu = osutils.cpu;
  11. function getRandomInt(max) {
  12. return Math.floor(Math.random() * Math.floor(max));
  13. }
  14.  
  15. const bot = new Discord.Client({ disableEveryone: true });
  16. bot.commands = new Discord.Collection();
  17. bot.on("ready", async () => {
  18. console.log(bot.commands);
  19. bot.generateInvite(["ADMINISTRATOR"]).then(link => {
  20. console.log(link);
  21. }).catch(err => {
  22. console.log(err.stack);
  23. });
  24. await bot.generateInvite(["ADMINISTRATOR"]);
  25. bot.user.setActivity(`Whenever Blazy is ${botSettings.sanity} you see this game`);
  26. });
  27. var connected = 0;
  28. var con = mysql.createConnection({
  29. host: "localhost",
  30. user: "root",
  31. password: "**I WILL NOT PUT THE PASSWORD IN A PUBLIC PASTEBIN**",
  32. database: "botxp"
  33. });
  34.  
  35. con.connect(err => {
  36. if (err) throw err;
  37. console.log("connected to database");
  38. connected = 1;
  39. });
  40.  
  41. bot.on('message', async message => {
  42. if (message.author.bot) return;
  43. if (message.channel.type === "dm") return;
  44. con.query(`SELECT * FROM xp WHERE id = '${message.author.id}'`, (err, rows) => {
  45. if (err) throw err;
  46. let sql;
  47. if (rows.length < 1) {
  48. sql = `INSERT INTO xp (id, xp) VALUES ('${message.author.id}', 1)`
  49.  
  50. }
  51. else {
  52. let xp = rows[0].xp;
  53. sql = `UPDATE xp SET xp = ${xp + 1} WHERE id = '${message.author.id}'`;
  54. }
  55. con.query(sql);
  56. });
  57. let messageArray = message.content.split(" ");
  58. let command = messageArray[0];
  59. let var1 = messageArray[1];
  60. let var2 = messageArray[2];
  61. let args = messageArray.slice(1);
  62. let mentions = message.mentions.users.first();
  63. if (message.content) {
  64. console.log(`${message.author.username}: ${message.content}`);
  65. }
  66. if (command === `${prefix}ping`) {
  67. var kapi = getRandomInt(4);
  68. if (kapi === 0)
  69. message.channel.send('fock');
  70. if (kapi === 1)
  71. message.channel.send('NO');
  72. if (kapi === 2)
  73. message.channel.send('No, this is Patrik!');
  74. if (kapi === 3)
  75. message.channel.send('Nobody here');
  76.  
  77. }
  78. if (command === `OwO` || command === `owo`) {
  79. message.channel.send('**Kill it with fire**');
  80. }
  81. if (/(?:https?:\/)?discord(?:app.com\/invite|.gg)/gi.test(message.content)) {
  82. message.delete();
  83. message.channel.send("This type of link is not allowed!");
  84. }
  85. if (/(?:https?:\/)?selly(?:.gg)/gi.test(message.content)) {
  86. message.delete();
  87. message.channel.send("This type of link is not allowed!");
  88. }
  89. if (command === `${prefix}resolver`) {
  90. var chance = getRandomInt(10001);
  91. console.log(`Someone used the resolver command, got the number ${chance}`)
  92. if (chance === 0)
  93. message.channel.send("Don't tell anyone, but it's https://pastebin.com/02nB4Fie");
  94. else message.channel.send("void Resolver() { //removed for antipasta}");
  95. }
  96. if (command == `${prefix}8ball`) {
  97. var blob = getRandomInt(2);
  98. if (blob === 0) {
  99. console.log("Someone used 8ball, got a No response.");
  100. var joy = getRandomInt(3);
  101. if (joy === 0)
  102. message.channel.send('Nope');
  103. if (joy === 1)
  104. message.channel.send('Not in a million years!');
  105. if (joy === 2)
  106. message.channel.send('I hate to break it to you...but NO!');
  107. }
  108. if (blob === 1) {
  109. console.log("Someone used 8ball, got a Yes response.");
  110. var sob = getRandomInt(3);
  111. if (sob === 0)
  112. message.channel.send('Hell yea!');
  113. if (sob === 1)
  114. message.channel.send('Duh!');
  115. if (sob === 2)
  116. message.channel.send('Ye m8 ;)');
  117. }
  118. }
  119. if (command === `${prefix}roll`) {
  120. var roll = getRandomInt(6)
  121. if (roll === 0)
  122. message.channel.send('Rolled 1..bad luck m8');
  123. if (roll === 1)
  124. message.channel.send('Rolled 2..nothing good here');
  125. if (roll === 2)
  126. message.channel.send('Rolled 3..better luck next time');
  127. if (roll === 3)
  128. message.channel.send('Rolled 4..hittin p? almost');
  129. if (roll === 4)
  130. message.channel.send('Rolled 5..lucky af');
  131. if (roll === 5)
  132. message.channel.send('Rolled 6..p100');
  133.  
  134. }
  135. if (command === `${prefix}info`) {
  136. var thot = getRandomInt(8)
  137. let p100embed = new Discord.RichEmbed()
  138. .setAuthor(message.author.username)
  139. if (thot === 0)
  140. p100embed.setDescription(`"The problem with quotes from the internet is that they are often not true." - Abraham Lincoln`);
  141. if (thot === 1)
  142. p100embed.setDescription(`"Bitches ain't shit but hoes and tricks." - Gandhi`);
  143. if (thot === 2)
  144. p100embed.setDescription(`"Idk, info machine :b:roke." - Kapi Wulon`);
  145. if (thot === 3)
  146. p100embed.setDescription(`"Two things are infinite; the Universe and the Winrar 40 day trial, I'm not sure about the Universe." - Albert Einstein`);
  147. if (thot === 4)
  148. p100embed.setDescription(`"Behind every great man there stands a great woman. Behind every great woman is a great behind." - Bill Clinton `);
  149. if (thot === 5)
  150. p100embed.setDescription(`"I don't drink water because this is where fish reproduce. Miss me with that gay shit niBBa" - Steve Jobs`);
  151. if (thot === 6)
  152. p100embed.setDescription(`"you and your father dead in graveyard" - Neveu`);
  153. if (thot === 7)
  154. p100embed.setDescription(`"Can I put AimTux in Visual Studio?" - Mark Zuckerberg`);
  155.  
  156. console.log("Someone used the info command");
  157. message.channel.send(p100embed);
  158.  
  159. }
  160. if (command === `${prefix}flame`) {
  161. var oof = getRandomInt(10)
  162. if (oof === 0)
  163. message.channel.send('Bark more slum dogs');
  164. if (oof === 1)
  165. message.channel.send('Mad?');
  166. if (oof === 2)
  167. message.channel.send('1');
  168. if (oof === 3)
  169. message.channel.send('Nice baim u sell?');
  170. if (oof === 4)
  171. message.channel.send('Hit head due to spread?');
  172. if (oof === 5)
  173. message.channel.send('Raging irl');
  174. if (oof === 6)
  175. message.channel.send('Nice afghanistan.cc');
  176. if (oof === 7)
  177. message.channel.send('Pelvis fix p100?');
  178. if (oof === 8)
  179. message.channel.send('**NO U**');
  180. if (oof === 9)
  181. message.channel.send('Are you using AimJunkies? xdd');
  182.  
  183. }
  184. if (command === `oof`) {
  185. message.channel.send("Get oof`d");
  186. }
  187. if (command === `nhu`) {
  188. message.channel.send("Ba dha!");
  189.  
  190. }
  191. if (command === `${prefix}kapi`) {
  192. console.log("Someone used the kapi command rawr xD");
  193. message.channel.send(`<:Bitcoin:419149329866162206> + <:kapithinker:419080441165905940> = :spy: :money_with_wings: quick maths`);
  194.  
  195. }
  196. if (command === `${prefix}rzbd`) {
  197. message.channel.send(":sob:<:angery:419080639623593985>");
  198. }
  199.  
  200. if (command === `thu`) {
  201. message.channel.send("Ehu?! Nhu!");
  202. }
  203. if (command === "bleizi" || command === "Bleizi") {
  204. if (var1 === "rau" || var1 === "rhau" || var1 === "Rau" || var1 === "Rhau") {
  205. console.log("Somebody called Blazy bad!");
  206. message.channel.send("thu esti rhau, ochei? OK!");
  207. }
  208. if (var1 === "bun" || var1 === "Bun") {
  209. console.log("Somebody called Blazy good!");
  210. message.channel.send("Dha!");
  211. }
  212. if (var1 === "cyka" || var1 === "Cyka") {
  213. console.log("Somebody called Blazy cyka!");
  214. message.channel.send(`${message.author.username} cyka`);
  215. }
  216. }
  217. if (command === "blob") {
  218. if (var1 === "joy") {
  219. message.channel.send("<:blobjoy:421755071328681995>");
  220. }
  221. }
  222. if (message.content == "ma-ta" || message.content == "ma ta" || message.content == "mata")
  223. message.channel.send("m-ata*");
  224. if (message.content == "Iti iau vurul la futut")
  225. message.channel.send("**Mai bine te dai batut**");
  226. if (message.content == "Mai bine te dai batut")
  227. message.channel.send("**Ling in pizda si dau in gura**");
  228. if (message.content == "Ling in pizda si dau in gura")
  229. message.channel.send("**Si imi bag legale-n pula**");
  230. if (message.content == "Si imi bag legale-n pula")
  231. message.channel.send("**Mananc Chamo pe paine**");
  232.  
  233. if (message.content === `rofl`) {
  234. console.log("Someone is a kurka proasta");
  235. message.channel.send(":rofl: esti thu");
  236. }
  237. if (command === `${prefix}rand`) {
  238. var cunt = getRandomInt(var1);
  239. message.channel.send(`${cunt}`);
  240. }
  241. if (command === `${prefix}help`)
  242. message.channel.send("https://pastebin.com/3mn4ibm5");
  243. if (message.content == "Rawr" || message.content == "rawr")
  244. message.channel.send("ecks dee");
  245. if (message.content == "your mom gay" || message.content == "you're mom gay" || message.content == "ur mom gay" || message.content == "u r mom gay")
  246. message.channel.send("no u");
  247. if (command === `${prefix}feed`) {
  248. if (var1 === "romica") {
  249. message.channel.send("<:dramaaaa:411315295546769408>");
  250. }
  251. else {
  252. message.channel.send(`:baby_bottle: ${args}`);
  253. }
  254. }
  255. if (command === `${prefix}flag`) {
  256. if (var1) {
  257. console.log(`${message.author.username} reported ${var1}`)
  258. }
  259. else message.channel.send("Please enter the username of the person you want to report");
  260. }
  261. if (command === `${prefix}insanity`) {
  262. message.channel.send("<:luAaaa:414852437833285642>");
  263. }
  264. if (command === `${prefix}scan`) {
  265. var thot = getRandomInt(7)
  266. let scanned = message.mentions.users.first() || message.guild.members.get(args[1]) || message.author;
  267. let p300embed = new Discord.RichEmbed()
  268. p300embed.setAuthor(`${scanned.username}`)
  269. p300embed.setDescription(`Avatar: ${scanned.avatarURL}`);
  270. p300embed.setThumbnail(`${scanned.avatarURL }`);
  271. console.log(`Someone scanned ${scanned.username}`);
  272. message.channel.send(p300embed);
  273. }
  274. if (command === `${prefix}muteuser`) {
  275. if (!message.member.hasPermissions("MUTE_MEMBERS")) return message.channel.send("You need Admin privileges to use this command!");
  276. let mentionsmute = message.guild.member(message.mentions.users.first()) || message.guild.members.get(args[0]);
  277. if (!mentionsmute) return message.channel.send("Please specify a user to mute!");
  278. let role = message.guild.roles.find(r => r.name === "Intern Muted");
  279. if (!role) {
  280. try {
  281. role = message.guild.createRole({
  282. name: "Intern Muted",
  283. color: "#000000",
  284. permissions: []
  285. });
  286. message.guild.channels.forEach(async (channel, id) => {
  287. await channel.overwritePermissions(role, {
  288. SEND_MESSAGES: false,
  289. ADD_REACTIONS: false
  290. });
  291. });
  292. } catch (e) {
  293. console.log(e.stack);
  294. }
  295. }
  296. if (mentionsmute.roles.has(role.id)) return message.channel.send("This user is already muted!");
  297. if (mentionsmute.id === message.author.id) return message.channel.send("You can't mute yourself!");
  298. if (mentionsmute.highestRole.position >= message.member.highestRole) return message.channel.send("You can't mute someone with higher or equal permissions as you!");
  299. await (mentionsmute.addRole(role));
  300. message.channel.send("I have muted them!");
  301.  
  302. }
  303. if (command === `${prefix}unmuteuser`) {
  304. if (!message.member.hasPermissions("MUTE_MEMBERS")) return message.channel.send("You need Admin privileges to use this command!");
  305. let mentionsunmute = message.guild.member(message.mentions.users.first()) || message.guild.members.get(args[0]);
  306. if (!mentionsunmute) return message.channel.send("Please specify a user to unmute!");
  307. let role = message.guild.roles.find(r => r.name === "Intern Muted");
  308. if (!role || !mentionsunmute.roles.has(role.id)) return message.channel.send("This user is not muted!");
  309. await (mentionsunmute.removeRole(role));
  310. message.channel.send("I have unmuted them!");
  311. }
  312. if (command === `${prefix}xp`) {
  313. let target = message.mentions.users.first() || message.guild.members.get(args[1]) || message.author;
  314. con.query(`SELECT * FROM xp WHERE id = '${target.id}'`, (err, rows) => {
  315. if (err) throw err;
  316. if (!rows[0]) message.channel.send("This user has no XP :(");
  317. let xp = rows[0].xp;
  318. var level = Math.round(xp / 100);
  319. let rawricsde = new Discord.RichEmbed();
  320. rawricsde.setAuthor(`${target.username}'s Stats`);
  321. rawricsde.addField("Level", `${level}`);
  322. rawricsde.addField("XP", `${xp}`);
  323. rawricsde.setThumbnail(`${target.avatarURL}`);
  324. message.channel.send(rawricsde);
  325. });
  326. }
  327. if (command === `${prefix}stats`) {
  328. osutils.cpuUsage(cpuscan => {
  329. var cpusage = Math.round(cpuscan * 100);
  330. let statsembed = new Discord.RichEmbed()
  331. statsembed.setAuthor("Performance Stats");
  332. if (cpusage > 75) {
  333. statsembed.addField("CPU Usage", `${cpusage}% :rage:`, true);
  334. }
  335. else statsembed.addField("CPU Usage", `${cpusage}% :ok_hand:`, true);
  336. statsembed.addField("CPU ClockSpeed", `${cpustat.avgClockMHz()} MHZ`, true);
  337. statsembed.addField("CPU Core Count", `${osutils.cpuCount()}`, true);
  338. statsembed.addField("Memory Usage", `${Math.round(osutils.totalmem() - osutils.freemem())} MB / ${Math.round(osutils.totalmem())} MB`, true);
  339. statsembed.addField("Discord.js version", `${Discord.version}`, true);
  340. if (connected = 0) {
  341. statsembed.addField("Connected to MySQL database", `No`, true);
  342. }
  343. else statsembed.addField("Connected to MySQL database", `Yes`, true);
  344. message.channel.send(statsembed);
  345. });
  346. }
  347. if (command === `${prefix}urban`)
  348. {
  349. if (args.length < 1) return message.channel.send("Please Enter Something");
  350. let str = args.join(" ");
  351. urban(str).first(json => {
  352. if (!json) return message.channel.send("No results found!");
  353. let embedurban = new Discord.RichEmbed()
  354. .setTitle(json.word)
  355. .setDescription(json.definition)
  356. .addField("Upvotes", json.thumbs_up, true)
  357. .addField("Downvotes", json.thumbs_down, true)
  358. .setFooter(`Written by ${json.author}`);
  359. message.channel.send(embedurban);
  360. });
  361. }
  362. if (command === `dha`)
  363. {
  364. message.channel.send("Ba nhu!");
  365. }
  366. if (command === `${prefix}randomurban`) {
  367. urban.random().first(json => {
  368. let randomembed = new Discord.RichEmbed()
  369. .setTitle(json.word)
  370. .setDescription(json.definition)
  371. .addField("Upvotes", json.thumbs_up, true)
  372. .addField("Downvotes", json.thumbs_down, true)
  373. .setFooter(`Written by ${json.author}`);
  374. message.channel.send(randomembed);
  375. });
  376. }
  377. if (message.content == `let the bass kick`)
  378. {
  379. message.channel.send("O-oooooooooo AAAAE-A-A-I-A-U- JO-oooooooooooo AAE-O-A-A-U-U-A- E-eee-ee-eee AAAAE-A-E-I-E-A- JO-ooo-oo-oo-oo EEEEO-A-AAA-AAAA");
  380. }
  381. if (message.content == "rekai cringe" || message.content == "Chamo cringe" || message.content == "Rekai cringe" || message.content == "chamo cringe")
  382. {
  383. message.channel.send("Adev");
  384. }
  385.  
  386. });
  387. bot.login(botSettings.token);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement