1 local http, env, storage
2 local C = minetest.get_color_escape_sequence
4 -- taken from 9front source code: /rc/bin/bullshit
5 local bullshit_code = [[
13 if(hassuffix = (rand() < 0.2))
14 return suffixes[int(rand() * nsuffix)]
17 $2 == "*" { protocol[nprotocol++] = $1; next }
18 $2 == "$" { end[nend++] = $1; next }
19 $2 == "%" { suffixes[nsuffix++] = $1; next }
20 $2 == "^" { start[nstart++] = $1; next }
21 $2 == "|" { noend[nword] = 1 }
22 { word[nword++] = $1; next }
27 total = int(rand() * 7) + 3
28 n = int(rand() * min(total - out, 3))
29 for(i = 0; i < n; i++)
30 printf "%s ", start[int(rand() * nstart)]
33 n = int(rand() * min(total - out, 3))
34 for(i = 0; i < n; i++)
35 printf "%s%s ", word[last = int(rand() * nword)], suffix()
39 for(i = 0; i < n; i++)
40 printf "%s %s", protocol[int(rand() * nprotocol)], (i != n-1) ? "over " : ""
45 n = int(rand() * min(total - out, 3))
46 if(out + n == 1 || last == -1)
48 for(i = 0; i < n; i++)
49 printf "%s%s ", word[last = int(rand() * nword)], suffix()
50 if(rand() < 0.1 || (last >= 0 && noend[last]) || hassuffix)
51 printf "%s ", end[int(rand() * nend)]
56 furrybot.commands.bullshit = {
57 help = "Output some random bullshit (ported from the plan9front system)",
59 local pf = env.io.popen("awk '" .. bullshit_code .. "' clientmods/furrybot/bullshit", "r")
60 local bullshit = pf:read("*a")
61 furrybot.send(bullshit:sub(1, #bullshit - 2), furrybot.colors.system)
65 return function(_http, _env, _storage)
66 http, env, storage = _http, _env, _storage