Advertisement
Guest User

Calvin

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