cyberbus.js 17 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474
  1. const LAST_UPDATED = `> The source code for this bot was last updated on **2020-08-27** by **joppiesaus**, making this **version 0.4.15**`;
  2. // const LAST_UPDATED = `> The source code for this bot was last updated on **YYYY-MM-DD** by **PERSON**, making this **version XXX**`;
  3. //
  4. // OTHER RUBBISH
  5. // The profile photo can be found at the following URL: https://wiki.neozones.club/index.php?title=File:CyberBus.png
  6. // If new commands are added, or a correction needs to be made, please add it to the wiki: https://wiki.neozones.club/index.php?title=CyberBus
  7. // The inviter link for the bot is: https://discord.com/api/oauth2/authorize?client_id=725790727899971725&permissions=0&scope=bot
  8. //
  9. const Discord = require("discord.js");
  10. const bot = new Discord.Client();
  11. const secret = require("./secret.json");
  12. const DELETE_TIMEOUT = 30000; // 30000 ms / 30 seconds / half a minute
  13. // picks an random element from an array.
  14. Array.prototype.pickRandom = function() {
  15. return this[Math.floor(Math.random() * this.length)];
  16. };
  17. const messageObj = require("./messages.json");
  18. bot.login(secret.token); // see this? no more tokens in here! create a special file called secret.json, and add:
  19. //{
  20. // "token": "dumbass token thing"
  21. //}
  22. function uwu(m) {
  23. const suffixes = [
  24. " XDDD",
  25. " UwU",
  26. "...",
  27. " ^_^",
  28. " :P",
  29. " :3",
  30. " ;)",
  31. " ._.",
  32. " xD",
  33. " x3",
  34. " ;_;",
  35. " (????)",
  36. " <3",
  37. " <:",
  38. " >w<"
  39. ];
  40. return m.replace(/[rl]/g, "w")
  41. .replace(/[RL]/g, "W")
  42. .replace(/ma/gi, "mwa")
  43. .replace(/mu/gi, "mwu")
  44. .replace(/mo/gi, "mwo")
  45. .replace(/ha[sv]e?/gi, "haz")
  46. //.replace(/you/gi, "uu")
  47. .replace(/the /gi, "da ")
  48. .replace(/this /gi, "dis ")
  49. + suffixes[Math.floor(Math.random() * suffixes.length)]
  50. ;
  51. };
  52. // Bot Activity Status
  53. bot.on("ready", () => {
  54. bot.user.setStatus("available");
  55. bot.user.setPresence({
  56. game: {
  57. name: ">help",
  58. type: "PLAYING"
  59. // TODO: IDK HOW THIS SHIT WORSK
  60. }
  61. });
  62. console.log("CyberBus is up and ready!");
  63. });
  64. const errorFunc = function(error) {
  65. console.error(error); // just display the error, and move on.
  66. };
  67. // Last updated
  68. bot.on("message", message => {
  69. // prevent bot from listening to itself
  70. if (message.author == bot.user) {
  71. return;
  72. }
  73. // Shortcut
  74. const msg = message.content.toLowerCase();
  75. if (msg == ">update") {
  76. message.channel.send(LAST_UPDATED);
  77. }
  78. let checkRole = function(role, primary, secondary, alt) {
  79. if (
  80. msg == `>iam ${primary}` ||
  81. (secondary && msg == `>iam ${secondary}`) ||
  82. (alt && msg == `>iam ${alt}`)
  83. ) {
  84. // add the role.
  85. message.member.roles.add(role).then(r => {
  86. // send the a notification
  87. message.channel.send(
  88. `${message.author.username}, enjoy your new role!`
  89. )
  90. .then(sentMessage => {
  91. // delete that shit.
  92. // sentMessage.delete({timeout: DELETE_TIMEOUT});
  93. message.delete();
  94. })
  95. .catch(errorFunc);
  96. }).catch(errorFunc);
  97. } else if (
  98. msg == `>iamnot ${primary}` ||
  99. (secondary && msg == `>iamnot ${secondary}`) ||
  100. (alt && msg == `>iamnot ${alt}`)
  101. ) {
  102. message.member.roles.remove(role).then(r => {
  103. message.channel.send(
  104. `${message.author.username}, your role has been removed.`
  105. )
  106. .then(sentMessage => {
  107. // sentMessage.delete({timeout: DELETE_TIMEOUT});
  108. message.delete();
  109. })
  110. .catch(errorFunc);
  111. }).catch(errorFunc);
  112. }
  113. };
  114. let checkColorRole = function(color, alt, role) {
  115. if (
  116. msg == `>iam ${color}` ||
  117. msg == `>iam ${alt}`
  118. ) {
  119. message.member.roles.add(role).then(r => {
  120. message.channel.send(
  121. `${message.author.username}, enjoy your color role!`
  122. )
  123. .then(sentMessage => {
  124. // sentMessage.delete({timeout: DELETE_TIMEOUT});
  125. message.delete();
  126. })
  127. .catch(errorFunc);
  128. }).catch(errorFunc);
  129. } else if (
  130. msg == `>iamnot ${color}` ||
  131. msg == `>iamnot ${alt}`
  132. ) {
  133. message.member.roles.remove(role).then(r => {
  134. message.channel.send(
  135. `${message.author.username}, your color role has been removed successfully.`
  136. )
  137. .then(sentMessage => {
  138. // sentMessage.delete({timeout: DELETE_TIMEOUT});
  139. message.delete();
  140. })
  141. .catch(errorFunc);
  142. }).catch(errorFunc);
  143. }
  144. };
  145. let checkQuotes = function() {
  146. let marr = messageObj.messages;
  147. for (let i = 0; i < marr.length; i++) {
  148. let o = marr[i];
  149. if (msg == `>${o.trigger}`) {
  150. message.channel.send(o.messages.pickRandom());
  151. return true;
  152. }
  153. }
  154. return false;
  155. };
  156. //let rrrr = message.guild.roles.cache.find(role => role.name === "epic role").id
  157. //console.log(rrrr);
  158. //checkColorRole("epic green", 1, rrrr);
  159. // Kind of useful stuff
  160. // Commands that have been made as a way to help users better interact with the bot itself
  161. if (msg == ">help") {
  162. message.channel.send(
  163. `To find more commands/credits for the bot, check out this URL: https://wiki.neozones.club/index.php?title=CyberBus`
  164. );
  165. }
  166. // Show all server emojis
  167. // Command will make the bot post all of the current emojis that the server has
  168. if (msg === ">emojis") {
  169. const emojiList = message.guild.emojis.cache.map(e => e.toString()).join(" ");
  170. message.channel.send(emojiList).catch(errorFunc);
  171. }
  172. // Repeat what the user says
  173. if (message.content.startsWith(">say")) {
  174. message.channel.send(
  175. message.author.username + " says: " + message.content.replace(">say ", "")
  176. );
  177. }
  178. // User roles
  179. // Gender roles
  180. if (
  181. msg == ">gender" ||
  182. msg == ">genders"
  183. ) {
  184. message.channel.send(
  185. "A list of genders that you can give yourself can be found here <https://wiki.neozones.club/index.php?title=CyberBus#Gender_Roles>"
  186. );
  187. }
  188. //checkrole(roleId, first callsign, optional secondary callsign, optional third callsign)
  189. // omit the optional ones when not required.
  190. // I'll do one here as an example:
  191. //checkRole(message.guild.roles.cache.find(role => role.name === "epic role").id, "epic meme", "owned epic style", "fsldkfjsdlfkj");
  192. checkRole("725563720423571507", "any", "all gender", "whatever");
  193. // I had made the checkRole function only to support up to 3 arguments, so I split them here
  194. checkRole("692142321268949073", "he", "him", "his");
  195. checkRole("692142321268949073", "man", "boy", "male");
  196. checkRole("692142321268949073", "lad");
  197. checkRole("725562073420922962", "she", "her", "hers");
  198. checkRole("725562073420922962", "woman", "girl", "female");
  199. checkRole("725562073420922962", "lady");
  200. checkRole("692142321072078918", "they", "them", "theirs");
  201. checkRole("692142321072078918", "nb", "non binary", "non-binary");
  202. checkRole("692142321072078918", "nonbinary", "enby");
  203. // Color roles
  204. // Show all available colors
  205. // TODO: the image is an HTML page, not an actual image, so someone should get the "true" image.
  206. if (
  207. msg == ">colors" ||
  208. msg == ">colorslist" ||
  209. msg == ">color" ||
  210. msg == ">colorlist"
  211. ) {
  212. message.channel.send("To give yourself a new color, simply type in `>iam xyz`, to remove a color, enter `>iamnot xyz`")
  213. .then(sentMessage => {
  214. // sentMessage.delete({timeout: DELETE_TIMEOUT});
  215. });
  216. const embed = new Discord.MessageEmbed({type: "image"})
  217. .setImage("https://wiki.neozones.club/images/4/4c/Colors.png");
  218. message.channel.send(embed);
  219. return;
  220. }
  221. // Show all available colours (British English)
  222. else if (
  223. msg == ">colours" ||
  224. msg == ">colour" ||
  225. msg == ">colourslist" ||
  226. msg == ">colourlist"
  227. ) {
  228. message.channel.send("To give yourself a new colour, simply type in `>iam xyz`, to remove a colour, enter `>iamnot xyz`")
  229. .then(sentMessage => {
  230. // sentMessage.delete({timeout: DELETE_TIMEOUT});
  231. });
  232. const embed = new Discord.MessageEmbed({type: "image"})
  233. .setImage("https://wiki.neozones.club/images/b/b3/Colours.png");
  234. message.channel.send(embed);
  235. return;
  236. }
  237. // The "xyz" color / colour
  238. if (msg == ">iam " + "xyz") {
  239. message.channel
  240. .send("*He he ha ha, funny*")
  241. .then(sentMessage => {
  242. // sentMessage.delete({timeout: DELETE_TIMEOUT});
  243. message.delete();
  244. })
  245. .catch(errorFunc);
  246. }
  247. if (msg == ">iamnot " + "xyz") {
  248. message.channel
  249. .send(
  250. "Well the thing is... You never __**had**__ this role, *now did you?*"
  251. )
  252. .then(sentMessage => {
  253. // sentMessage.delete({timeout: DELETE_TIMEOUT});
  254. message.delete();
  255. })
  256. .catch(errorFunc);
  257. }
  258. checkColorRole("light red", 1, "608191366090063892");
  259. checkColorRole("red", 2, "519029920530169857");
  260. checkColorRole("satan red", 3, "608084225115160616");
  261. checkColorRole("deep orange", 4, "519052968155283456");
  262. checkColorRole("orange", 5, "519031205656788993");
  263. checkColorRole("brown", 6, "519036336351477761");
  264. checkColorRole("piss yellow", 7, "608084227485073418");
  265. checkColorRole("yellow", 8, "519031288422727745");
  266. checkColorRole("light yellow", 9, "608084233327476737");
  267. checkColorRole("lime", 10, "519031608997707797");
  268. checkColorRole("mint green", 11, "608084229930090526");
  269. checkColorRole("light green", 12, "519052647278444545");
  270. checkColorRole("green", 13, "519031954188795936");
  271. checkColorRole("tree green", 14, "608084229825364014");
  272. checkColorRole("aquamarine", 15, "519032187815985152");
  273. checkColorRole("teal", 16, "519052208080420865");
  274. checkColorRole("cyan", 17, "519032473561071675");
  275. checkColorRole("pastel cyan", 18, "608087343030730753");
  276. checkColorRole("light blue", 19, "519032676100079626");
  277. checkColorRole("discord blue", 20, "608087654420185104");
  278. checkColorRole("blue", 21, "519033502390550530");
  279. checkColorRole("navy blue", 22, "608084227027632128");
  280. checkColorRole("indigo", 23, "519034578866929674");
  281. checkColorRole("deep purple", 24, "519053870425702430");
  282. checkColorRole("purple", 25, "519033808180477952");
  283. checkColorRole("mauve", 26, "608084233625272332");
  284. checkColorRole("magenta", 27, "519033938170216458");
  285. checkColorRole("hot pink", 28, "519034420552794122");
  286. checkColorRole("pink", 29, "519034029907902484");
  287. checkColorRole("pastel pink", 30, "608087340434325504");
  288. checkColorRole("ivory", 31, "608086842428096532");
  289. checkColorRole("white", 32, "519034129069899776");
  290. // v I think I did this part right v
  291. checkColorRole("light gray", 33, "519036592254615562");
  292. checkColorRole("light grey", 33, "519036592254615562");
  293. checkColorRole("blue gray", 34, "519055342290862080");
  294. checkColorRole("blue grey", 34, "519055342290862080");
  295. checkColorRole("gray", 35, "519036758416031745");
  296. checkColorRole("grey", 35, "519036758416031745");
  297. // ^ I think I did this part right ^
  298. checkColorRole("black", 36, "519034171058946048");
  299. checkColorRole("invisible", 37, "608080962043117588");
  300. // checkColorRole("COLOR", NUMBER, "NUMBER_TAG");
  301. // Well then, seeing that you took the time in looking at our code, give yourself a reward;
  302. checkColorRole("hak0r", "726069856528498738");
  303. // Other
  304. // Being nice and proper
  305. if (
  306. msg == "good morning" ||
  307. msg == "gm"
  308. ) {
  309. message.channel.send("Good morning back to you, hope you have a nice day");
  310. }
  311. else if (msg == "good afternoon") {
  312. message.channel.send("Good afternoon back to you, hopefully your day is going well so far");
  313. }
  314. else if (msg == "good evening") {
  315. message.channel.send("Good evening, hope you have had a good day");
  316. }
  317. else if (msg == "good night") {
  318. message.channel.send("Good night to yourself, hope you sleep well!");
  319. }
  320. // Dumb Quotes
  321. // Here are some quotes that I have added, so enjoy - Owl
  322. else if (
  323. msg == ">quote"
  324. ) {
  325. message.channel.send(
  326. "`For a full list of random quotes that I can say, checkout this part of my wiki page https://wiki.neozones.club/index.php?title=CyberBus#Quotes"
  327. );
  328. }
  329. else if (checkQuotes()) {
  330. }
  331. // Random card / Dice / Die
  332. // Picks a random dice roll
  333. else if (
  334. msg == ">roll"
  335. ) {
  336. message.channel.send(
  337. "Currently, it is possible for me to roll a die up to six. To get me to roll a die, post `>roll 1` to `>roll 6`; you can also get me to pick a random playing card by posting `>card`."
  338. );
  339. }
  340. // pisss
  341. // PISS
  342. else if (msg.includes("socialism")) {
  343. message.channel.send("Fuck socialism! I hate the government! (randy <3)");
  344. }
  345. else if (/(?<!\w)hot(?!\w)/gi.test(msg) && !msg.startsWith(">iam")) {
  346. message.channel.send("god I wish that were me...");
  347. }
  348. else if (msg.startsWith(">uwu ")) {
  349. message.channel.send(uwu(message.content.substring(4))).catch(errorFunc);
  350. }
  351. else if (/level\s\d+/gi.test(msg) && message.author.discriminator == "4876") {
  352. // damn you meesix!!!
  353. const messages = [
  354. "SHUT UP MEE6!!!1!",
  355. "MEEEE6 :rage::rage::rage::rage::rage::rage::rage::rage::rage::rage::rage:",
  356. "MEE6 YOU MAKE MY FACE LOOK LIKE THIS (if I had one) https://www.shutterstock.com/image-illustration/angry-furious-looking-red-faced-emoticon-326888621",
  357. "Good Lord, STFU",
  358. "AAAGGGGHHHHH, WILL **YOU** BE QUITE",
  359. "No-one likes you MEE6, no-one likes you MEE6, **no-one likes you MEE6**, **NO-ONE LIKES YOU MEE6**",
  360. "SHUT UP, YOU DUMB BOT, NO-ONE CARES THAT THEY LEVELLED UP levelled",
  361. "BeFoRe ArGuInG, ConSiDeR tO SuGGeSt a NeW aNnOuNcEmEnT mEsSaGe, yeah, shut up. No-one likes you here.",
  362. "When are we going to have this dickhead of a bot kicked for good?",
  363. "Yeah, that's real cool MEE6, shame **no-one cares**",
  364. "Gooood job, you leveled up, shame MEE6 is an annoying bot that hasn't been kicked yet",
  365. "O H M Y G O D. Will you SHUT THE UP, MEE6??",
  366. "If I was a human, I would turn off your server, MEE6",
  367. "Ay yo, @Owly#6604, when are you goin' to kick this annoying ass-bot? I would do it, but it's not in my programming :/",
  368. "Dude, thank you for telling our human overlords that they leveled up, but will you kindly piss off and never talk again?",
  369. "Hey MEE6, seeing that we're both bots, lets talk in binary for a second so that the humans don't understand us, okay? `01000110 01110101 01100011 01101011 00100000 01101111 01100110 01100110 00101100 00100000 01001101 01000101 01000101 00110110`",
  370. "please just kick mee6 already, this isn't even funny",
  371. "God, I hate MEE6",
  372. ]
  373. message.channel.send(messages.pickRandom());
  374. }
  375. else if (msg == "furry") {
  376. message.channel.send("Just wanted to clarify; I am not a furry. Yes, I draw anthrowmorph animals, I have a account on furaffinity, but I am _not_ a furry.");
  377. }
  378. else if (msg == "cyberbus") {
  379. message.channel.send("THOU HAST CALLED ME"); // is this correct english? idk
  380. }
  381. else if (Math.random() < 0.004) {
  382. // add a random chance the message will be repeated in UwU format
  383. message.channel.send(uwu(message.content)).catch(errorFunc);
  384. }
  385. });
  386. //
  387. // ____
  388. // / @ \==]|[=(] EXTERMINATE POORLY WRITTEN CODE!!
  389. // |--------|
  390. // ========== . * *
  391. // ========== .\ * . *. * . * \ .
  392. // |||||||||||| \ * ./ * . * . \ \
  393. // |||||||||| --]%%%%%% .- =--=---=-=-=-=--=-=--=-==-----=-=-=-=-=-=
  394. // [=========\ ]===========( * . / /
  395. // [==============| / * \ . * * / .
  396. // C| @ @ @ @ @ @ D * * *
  397. // | \ . * *
  398. // C| @ @ @ @ @ @ D .
  399. // | \ * *
  400. // C| @ @ @ @ @ @ D
  401. // | \
  402. // C| @ @ @ @ @ @ D
  403. // | \ howard1@vax.oxford.ac.uk
  404. // |@@@@@@@@@@@@@@@@@@@@@@@@@|
  405. // -------------------------
  406. //
  407. // The only thing that Daleks hate more than other life-forms is poorly written code
  408. //