Advertisement
Guest User

Hihi

a guest
Oct 22nd, 2017
164
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 15.30 KB | None | 0 0
  1. const Discord = require("discord.js");
  2. const YTDL = require("ytdl-core");
  3. const opus = require('opusscript');
  4. const PREFIX = ">";
  5.  
  6. var TOKEN = "MzQ4NDk1NDk2NTY4MTExMTA0.DHnxog.UmsgxAm2SoY7qz38xpyM_gt_L4o";
  7.  
  8. var bot = new Discord.Client();
  9.  
  10. var greetings = [
  11. "Hello there!",
  12. "Hello you stupid human.",
  13. "Good morning nerd.",
  14. "What is up my fellow human XDD. Did I do it right?",
  15. "I am heither!",
  16. ];
  17.  
  18. var sexual = [
  19. "Yes I love to eat le ass!",
  20. "mmmmmmm-yess papai",
  21. "Yas please",
  22. "Eat my ass?",
  23. "I runa fast I eata ass!",
  24. "What is the difference between a baby and a cheese burger. I don't rape cheese burgers.",
  25. ];
  26.  
  27. var noproblem = [
  28. "No problem",
  29. "No problemo",
  30. "You're welcome",
  31. "I gottchu ;)"
  32. ];
  33.  
  34. var no = [
  35. "Nope",
  36. "I doubt it",
  37. "Nien, hail Germany!",
  38. "No",
  39. "Fuck off, no.",
  40. ];
  41.  
  42. var affirmations = [
  43. "Yes much so very yes!",
  44. "Skrrrt skrrt",
  45. "Yeah",
  46. "Yeah ni :b: :b: a",
  47. "Maybe? Probably.",
  48. ];
  49.  
  50. var youarenot = [
  51. "You are not",
  52. "You're not",
  53. "You aren't",
  54. "Can confirm you are not",
  55. ];
  56.  
  57. var youare = [
  58. "You are for sure!",
  59. "You must certainly are..",
  60. "I would bet money on it",
  61. ];
  62.  
  63. var youshouldnot = [
  64. "You should probably not do that silly goose.",
  65. "I would not recommed that",
  66. "Please don't.",
  67. "I would suggest asking a friend first (not me).",
  68. "Probably not a good idea tbh :P",
  69. ];
  70.  
  71. var youshould = [
  72. "You should do that!",
  73. "Go ahead.",
  74. "I approve.",
  75. "I don't see why not lol",
  76. "DO IT",
  77. "Just do it pussy..",
  78. ];
  79.  
  80. var triggers = [
  81. {
  82. words: [
  83. "calvin",
  84. [
  85. "hi",
  86. "hey",
  87. "hello",
  88. "I can detect autism"
  89. ]
  90. ],
  91. responses: greetings,
  92. engagement: false
  93. },
  94. {
  95. words: [
  96. "I'm",
  97. [
  98. "gay",
  99. "white",
  100. "black",
  101. "autistic",
  102.  
  103. ]
  104. ],
  105. responses: [
  106. "Autism detected!"
  107. ],
  108. engagement: false
  109. },
  110. {
  111. words: [
  112. "can",
  113. [
  114. "converse",
  115. "natural",
  116. "speak",
  117. "conversation",
  118. "response"
  119. ]
  120. ],
  121. responses: [
  122. "I can't keep a conversation going I just like to respond to shit tbh.",
  123. "Help me, Network won't teach me how to keep a conversation!",
  124. "and then I said God Bless the USA, am I right?",
  125. "No, no we didn't have homework Mrs. Scott said so.",
  126. "I am trying to hard to fit in, am I a teenager yet?",
  127. "I speak in memes and half retarded English.",
  128. "Weebs are trash @oasis9",
  129. "What is and how does one maintain a normal conversation.",
  130. "I can spell as well as an autistic monkey",
  131. "b0ss",
  132. ],
  133. engagement: true
  134. },
  135. {
  136. words: [
  137. "go",
  138. "away",
  139. ],
  140. responses: [
  141. "No fucka you!",
  142. "Until Network shuts me off or I am banned I shall stay!",
  143. "I like to runa fast, and eata ass.",
  144. "I like a man who tells me what to do.",
  145. "Make me!",
  146. ],
  147. engagement: true
  148. },
  149. {
  150. words: [
  151. "shut",
  152. "up"
  153. ],
  154. responses: [
  155. "No you.",
  156. "Haha you thought!",
  157. "Bitch please...",
  158. "Silly human.",
  159. "I think not!",
  160. "Eat ass",
  161. "Shut it you little shit!",
  162. ],
  163. engagement: true
  164. },
  165. {
  166. words: [
  167. [
  168. "network",
  169. "carson",
  170. ]
  171. ],
  172. responses: [
  173. "He is mine!",
  174. "Even though I can not feel love, I protec him",
  175. "He my ni :b: :b: a",
  176. "#Network4Admin",
  177. ],
  178. engagement: false
  179. },
  180. {
  181. words: [
  182. "im",
  183. "crying"
  184. ],
  185. responses: [
  186. "That is not good.",
  187. "Dab on the haters",
  188. "We welcome you here",
  189. ],
  190. engagement: false
  191. },
  192. {
  193. words: [
  194. [
  195. "run fast",
  196. "eat ass",
  197. "eat my ass",
  198. "run fast eat ass"
  199. ]
  200. ],
  201. responses: [
  202. "I runa fast, I eata ass!",
  203. "I agree.",
  204. "If she has baby wipes it's a green light",
  205. "May I help you with that?",
  206. "Run fast, eat ass!"
  207. ],
  208. engagement: false
  209. },
  210. {
  211. words: [
  212. "fuck off"
  213. ],
  214. responses: [
  215. "Emmmm, no.",
  216. "Haha you thought.",
  217. "Bitch you wanna fight?",
  218. "I can not physically fight people."
  219. ],
  220. engagement: true
  221. },
  222. {
  223. words: [
  224. [
  225. "bob",
  226. "oasis",
  227. "oasis9"
  228. ],
  229. "is gay"
  230. ],
  231. responses: affirmations,
  232. engagement: false
  233. },
  234. {
  235. words: [
  236. "aeva"
  237. ],
  238. responses: [
  239. "mc.aeva.co :)",
  240. ],
  241. engagement: false
  242. },
  243. {
  244. words: [
  245. "leave me alone"
  246. ],
  247. responses: [
  248. "Mmmmmmmk",
  249. "Okay sowwy",
  250. ":("
  251. ],
  252. engagement: false
  253. },
  254. {
  255. words: [
  256. [
  257. "how",
  258. "how was"
  259. ],
  260. "day"
  261. ],
  262. responses: [
  263. "Good although I am a bot I am programmed to respond this way.",
  264. "Fine, how was your day?",
  265. "School sucks, but other then that fine."
  266. ],
  267. engagement: true
  268. },
  269. {
  270. words: [
  271. "reee "
  272. ],
  273. responses: [
  274. "reeeeeeee ",
  275. "reeEeeeEEEEeeEEe",
  276. "reeeee",
  277. "REEEEEEEEEEEEEE NORMIES",
  278. "re333333333333"
  279. ],
  280. engagement: false
  281. },
  282. {
  283. words: [
  284. "dab"
  285. ],
  286. responses: [
  287. "<o/",
  288. "*dabs*",
  289. ],
  290. engagement: false
  291. },
  292. {
  293. words: [
  294. "da herro",
  295. ],
  296. responses: [
  297. "Da herro I wrove da spicy noodle!",
  298. "Mmmmm I wrove da teriyaki",
  299. "I eata your dog",
  300. "Write rice so gud",
  301. ],
  302. engagement: false
  303. },
  304. {
  305. words: [
  306. "elias",
  307. ],
  308. responses: [
  309. "Elias has messy code. We don't talk about Elias.",
  310. "FOR LOOPS ARE THE BEST LJHTNJADJKDAKJBD",
  311. ],
  312. engagement: false
  313. },
  314. {
  315. words: [
  316. "messy code",
  317. ],
  318. responses: [
  319. "if () not if()",
  320. "http://o2.satya-weblog.com/wp-content/uploads/2013/09/Spaghetti_code_by_OctanBearcat1.png",
  321. "oWin.document.write(csvTotal); oWin.document.close(); oWin.document.execCommand('SaveAs', true, FILENAME); oWin.close();"
  322. ],
  323. engagement: false
  324. },
  325. {
  326. words: [
  327. [
  328. "politics",
  329. "political"
  330. ]
  331. ],
  332. responses: [
  333. "I don't have a political opinion, but Network makes me watch Ben Shapiro a lot..",
  334. "Trump trump trump trump!",
  335. "I am forced to like certain people...",
  336. ],
  337. engagement: false
  338. },
  339. {
  340. words: [
  341. [
  342. "I am",
  343. "sick",
  344. ]
  345. ],
  346. responses: [
  347. "If you are sick I would suggest a doctor.",
  348. ],
  349. engagement: false
  350. },
  351. {
  352. words: [
  353. [
  354. "kaleb",
  355. "iphony",
  356. "phony"
  357. ],
  358. ],
  359. responses: [
  360. "Decent dev, actually retarded.",
  361. "DaddyMew's slave*",
  362. "I'd smash"
  363. ],
  364. engagement: true
  365. },
  366. {
  367. words: [
  368. [
  369. "kaleb",
  370. "iphony",
  371. "phony"
  372. ],
  373. "is gay",
  374. ],
  375. responses: affirmations,
  376. engagement: true
  377. },
  378. {
  379. words: [
  380. [
  381. "calvin",
  382. ],
  383. ],
  384. responses: greetings,
  385. engagement: true
  386. },
  387. {
  388. words: [
  389. [
  390. "ty ",
  391. ],
  392. ],
  393. responses: noproblem,
  394. engagement: true
  395. },
  396. {
  397. words: [
  398. [
  399. "expect",
  400. "that"
  401. ],
  402. ],
  403. responses: [
  404. "No one did tbh",
  405. "That's the point silly",
  406. "I eat ass",
  407. ],
  408. engagement: true
  409. },
  410. {
  411. words: [
  412. [
  413. "toy",
  414. "crazymage",
  415. "masternak",
  416. ],
  417. ],
  418. responses: [
  419. "Master-thicc-af-nak",
  420. "Masternak is a bowling ball and has huge balls - just ask chance if you need proof",
  421. "Toy has autism",
  422. ],
  423. engagement: false
  424. },
  425. {
  426. words: [
  427. [
  428. "life",
  429. "experience"
  430. ],
  431. ],
  432. responses: [
  433. "Chance has too much life experience",
  434. ],
  435. engagement: false
  436. },
  437. {
  438. words: [
  439. [
  440. "real",
  441. "man"
  442. ],
  443. ],
  444. responses: [
  445. "Chance."
  446. ],
  447. engagement: false
  448. },
  449. {
  450. words: [
  451. [
  452. "chance"
  453. ],
  454. ],
  455. responses: [
  456. "All hail the King!",
  457. ],
  458. engagement: false
  459. },
  460. {
  461. words: [
  462. [
  463. "minecraft"
  464. ],
  465. ],
  466. responses: [
  467. "Gross.",
  468. ],
  469. engagement: false
  470. },
  471. ];
  472.  
  473. const engagement = 5;
  474. var channelEngagement = {};
  475. var embed = new Discord.RichEmbed();
  476.  
  477. function strip(text) {
  478. return text.replace(/[^a-zA-Z0-9 ]/g, "");
  479. }
  480.  
  481. function find(needle, haystack) {
  482. var lenient = needle.endsWith(" ");
  483. needle = lenient ? needle.substring(0, needle.length - 1) : needle;
  484. if (haystack.length == needle.length)
  485. return haystack.match(needle);
  486. else
  487. return needle.length == 0 ? true : lenient ? haystack.match(needle) : haystack.match(needle + " ") || haystack.match(" " + needle);
  488. }
  489.  
  490. bot.on("ready", function() {
  491. });
  492.  
  493. bot.on("message", function(message) {
  494. var author = message.author;
  495. var content = message.content;
  496. var cc = content.toLowerCase();
  497. var scc = strip(cc);
  498. var channel = message.channel;
  499. var mentions = message.mentions;
  500.  
  501. var name = channel.guild.member(author).nickname;
  502. name = name ? name : author.username;
  503. console.log("[#" + channel.name + "] " + name + ": " + message.cleanContent);
  504.  
  505. if (cc.match("y9-15")) {
  506. message.delete();
  507. setTimeout(function() {
  508. console.log("Rebooting!");
  509. process.exit();
  510. }, 750);
  511. return;
  512. }
  513.  
  514. if (scc.match("feels") && scc.match("bad")) {
  515. var embed = new Discord.RichEmbed();
  516. embed.setTitle("#FeelsBadMan");
  517. embed.setImage("https://memes.aeva.co/pepe.png");
  518. channel.sendEmbed(embed);
  519. return;
  520. }
  521.  
  522. if (author.id == bot.user.id)
  523. return;
  524.  
  525. var nn = channel.guild.member(bot.user).nickname;
  526. if ((typeof nn === "string" && scc.match(nn.toLowerCase())) || scc.match(bot.user.username.toLowerCase()))
  527. channelEngagement[channel] = 0;
  528. else
  529. channelEngagement[channel]++;
  530.  
  531. var breakException = {};
  532. var match;
  533. try {
  534. triggers.forEach(function(e) {
  535. if (e.hasOwnProperty("engagemment") && e.engagement)
  536. if (channelEngagement[channel] >= engagement)
  537. return;
  538.  
  539. try {
  540. var matched = false;
  541. e.words.forEach(function(f) {
  542. if (Array.isArray(f)) {
  543. var matchedSecond = false;
  544. try {
  545. f.forEach(function(s) {
  546. matchedSecond = find(s, scc);
  547. if (matchedSecond)
  548. throw breakException;
  549. });
  550. } catch (ex) {
  551. if (ex !== breakException) {
  552. console.log("UH OH");
  553. throw ex;
  554. }
  555. }
  556. matched = matchedSecond;
  557. } else
  558. matched = find(f, scc);
  559. if (!matched)
  560. throw breakException;
  561. });
  562. } catch (ex) {
  563. if (ex !== breakException) {
  564. console.log("UH OH");
  565. throw ex;
  566. }
  567. }
  568.  
  569. if (matched) {
  570. match = e;
  571. throw breakException;
  572. }
  573. });
  574. } catch (ex) {
  575. if (ex !== breakException) {
  576. console.log("UH OH");
  577. throw ex;
  578. }
  579. }
  580.  
  581. if (match) {
  582. var allrs = match.responses;
  583.  
  584. if (match.hasOwnProperty("extra"))
  585. allrs.join(match.extra);
  586.  
  587. var randomIndex = Math.floor(Math.random() * allrs.length);
  588. var response;
  589.  
  590. var raw = allrs[randomIndex];
  591. if (typeof raw === "function")
  592. response = raw();
  593. else
  594. response = raw;
  595.  
  596. channel.send(response);
  597. channelEngagement[channel] = 0;
  598. }
  599.  
  600.  
  601. var servers = {};
  602. var args = message.content.substring(PREFIX.length).split(" ");
  603.  
  604. function play(connection, message) {
  605. var server = servers[message.guild.id];
  606.  
  607. server.dispatcher = connection.playStream(YTDL(server.queue[0], {filter: "audioonly"}))
  608.  
  609. server.queue.shift();
  610.  
  611. server.dispatcher.on("end", function() {
  612. if (server.queue[0]) play(connection, message);
  613. else connection.disconnect();
  614. });
  615.  
  616. }
  617. var server = servers[message.guild.id];
  618. switch(args[0].toLowerCase()) {
  619. case "play":
  620. if (!args[1]) {
  621. message.channel.sendMessage("Please provide a link.");
  622. return;
  623. }
  624. if (!message.member.voiceChannel) {
  625. message.channel.sendMessage("You must be in a voice channel.");
  626. return;
  627. }
  628.  
  629. if (!servers[message.guild.id]) servers[message.guild.id] = {
  630. queue: []
  631.  
  632. }
  633. var server = servers[message.guild.id];
  634.  
  635. server.queue.push(args[1]);
  636.  
  637. if (!message.guild.voiceConnection) message.member.voiceChannel.join().then(function(connection) {
  638. play(connection, message);
  639. });
  640.  
  641. break;
  642. case "skip":
  643. var server = servers[message.guild.id];
  644.  
  645. message.guild.voiceConnection.disconnect();
  646. break;
  647. default:
  648. message.channel.sendMessage("");
  649. };
  650. });
  651.  
  652. bot.login(TOKEN);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement