]> git.lizzy.rs Git - furrybot-discord.git/blob - random.js
Add bad apple
[furrybot-discord.git] / random.js
1 const common = require("./common.js")
2 const sha1 = require("sha1")
3 const pseudoRandom = require("pseudo-random")
4
5 const german = require("./german.json")
6 const books = require("./books.json")
7
8 module.exports = {
9         rolldice: {
10                 func: msg => msg.channel.send(`<@!${msg.author.id}> rolled a dice and got a ${1 + Math.floor(Math.random() * 6)}.`)
11         },
12         coinflip: {
13                 func: msg => msg.channel.send(`<@!${msg.author.id}> flipped a coin and got ${common.choose(["Heads", "Tails"])}.`)
14         },
15         choose: {
16                 func: (msg, options) => msg.reply(options.length < 2 ? "Not enough options" : `I choose ${common.choose(options)}.`)
17         },
18         uwu: {
19                 func: msg => msg.reply(
20                         new Array(1 + Math.floor(Math.random() * 10))
21                         .fill(null)
22                         .map(_ => new Array(3)
23                                 .fill(common.choose(["u", "ü", "o", "ö"])[common.choose(["toUpperCase", "toLowerCase"])]())
24                                 .fill("w"[common.choose(["toUpperCase", "toLowerCase"])](), 1, 2)
25                                 .join("")
26                         )
27                         .join(" ")
28                 )
29         },
30         extinct: {
31                 func: (msg, [rawSpecies]) => {
32                         const species = common.uppercase((rawSpecies + (rawSpecies.slice(-1) == "s" ? "" : "s")).toLowerCase())
33                         msg.reply(`${species} are ${pseudoRandom(parseInt(sha1(species), 16) % 1e9).random() < 0.5 ? "" : "not "}extinct.`)
34                 }
35         },
36         german: {
37                 func: msg => msg.reply(common.choose(german))
38         },
39         book: {
40                 func: msg => msg.reply(common.choose(books))
41         },
42         video: {
43                 func: msg => msg.reply("https://youtube.com/watch?v=dQw4w9WgXcQ")
44         },
45 }
46