summaryrefslogtreecommitdiff
path: root/random.lua
blob: c03418dce4a65fa6ce1cbe1223ecf8b9df5c353f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
local http, env, storage
local C = minetest.get_color_escape_sequence

function furrybot.commands.rolldice(name)
	furrybot.ping_message(name, "rolled a dice and got a " .. furrybot.random(1, 6, furrybot.colors.system) .. ".", furrybot.colors.system)
end

function furrybot.commands.coinflip(name)
	furrybot.ping_message(name, "flipped a coin and got " .. furrybot.choose({"Heads", "Tails"}, furrybot.colors.system) .. ".", furrybot.colors.system)
end

function furrybot.commands.choose(name, ...)
	local options = {...}
	if #options > 1 then
		furrybot.ping_message(name, "I choose " .. furrybot.choose(options, "", furrybot.colors.system) .. ".", furrybot.colors.system)
	else
		furrybot.error_message(name, "Not enough options")
	end
end

function furrybot.commands.uwu()
	local msg = ""

	local m = math.random(10)

	for i = 1, m do
		local u_list = {"u", "ü", "o", "ö"}

		local u = u_list[math.random(#u_list)]
		local w = "w"

		if math.random() < 0.5 then
			u = u:upper()
		end

		if math.random() < 0.5 then
			w = w:upper()
		end

		msg = msg .. u .. w .. u

		if i ~= m then
			msg = msg .. " "
		end
	end

	furrybot.send(msg, furrybot.colors.system)
end

return function(_http, _env, _storage)
	http, env, storage = _http, _env, _storage
end