- local res = http.fetch_sync(req)
- if res.succeeded then
- local data = minetest.parse_json(res.data)[1]
- furrybot.send(data.text .. C("#00FFC3") .. "[" .. data.bookname .. " " .. data.chapter .. "," .. data.verse .. "]")
- else
- furrybot.ping_player_error(name, "Request failed with code", res.code)
- end
+ local res = furrybot.http.fetch(req, function(res)
+ if res.succeeded then
+ local data = minetest.parse_json(res.data)[1]
+ furrybot.send(data.text .. C("#00FFC3") .. "[" .. data.bookname .. " " .. data.chapter .. "," .. data.verse .. "]")
+ else
+ furrybot.ping_player_error(name, "Request failed with code", res.code)
+ end
+ end)
+end
+
+function furrybot.commands.rolldice(name)
+ furrybot.ping_player(name, "rolled a dice and got a " .. C("#AAFF43") .. math.random(6))
+end
+
+function furrybot.commands.coinflip(name)
+ furrybot.ping_player(name, "flipped a coin and got " .. C("#AAFF43") .. furrybot.choose({"Heads", "Tails"}))