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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
|
const fetch = require("node-fetch")
const google_images = require("free-google-images")
const common = require("./common.js")
module.exports = {
google: {
params: "<keyword> [...]",
help: "Google Image Search",
func: (msg, keywords) => {
google_images.searchRandom(keywords.join(" "))
.then(result => msg.reply(result.image.url))
}
},
verse: {
func: msg => fetch("https://labs.bible.org/api/?type=json&passage=random")
.then(res => res.json())
.then(data => msg.reply(`${data[0].text} [${data[0].bookname} ${data[0].chapter}, ${data[0].verse}]`))
},
define: {
func: (msg, [word]) => word ? fetch("https://api.dictionaryapi.dev/api/v1/entries/en_US/" + word)
.then(res => res.json())
.then(data => {
let def = data[0]
msg.reply(`__**${def.word}**__`
+ (def.phonetic ? ` (_${def.phonetic}_)` : "")
+ "\n\n"
+ Object.entries(def.meaning).reduce((str, meaning) => str
+ `_${meaning[0]}_\n`
+ meaning[1].reduce((str, definition, i) => str + `\t${i + 1}. ${definition.definition}\n`, "")
, "")
+ `\n[Definitions from ${def.sourceUrls.join(", ")}]`
)
})
.catch(_ => msg.reply("Not found"))
: msg.reply("You need to specify a word")
},
urban: {
func: (msg, [word]) => word ? fetch("https://api.urbandictionary.com/v0/define?term=" + word)
.then(res => res.json())
.then(data => {
let def = common.choose(data.list)
msg.reply(`__**${def.word}**__\n`
+ def.definition.replace(/\[/g,"").replace(/\]/g,"") + "\n\n"
+ "**Example:**\n"
+ def.example.replace(/\[/g,"").replace(/\]/g,"")
)
})
.catch(_ => msg.reply("Not found"))
: msg.reply("You need to specify a word")
},
insult: {
func: (msg, [targetPing]) => {
const target = common.getPing(msg, targetPing, true)
if (target)
fetch("https://insult.mattbas.org/api/insult")
.then(res => res.text())
.then(data => msg.channel.send(`<@!${target}> ${data}`))
}
}
}
/*
furrybot.commands.joke = {
func = function(name, first, last)
if not first then
first = "Chuck"
last = "Norris"
elseif not last then
last = ""
end
furrybot.json_http_request("http://api.icndb.com/jokes/random?firstName=" .. first .. "&lastName=" .. last, name, function(data)
local joke = data.value.joke:gsub(""", "\""):gsub(" ", " ")
furrybot.send(joke, furrybot.colors.fun)
end)
end,
}
furrybot.commands["8ball"] = {
func = function(name)
furrybot.json_http_request("https://8ball.delegator.com/magic/JSON/anything", name, function(data)
furrybot.ping_message(name, data.magic.answer, furrybot.colors.fun)
end)
end,
}
return function(_http, _env, _storage)
http, env, storage = _http, _env, _storage
end
*/
|