aboutsummaryrefslogtreecommitdiff
path: root/basic.js
blob: 24171bf0274a65bff38ab4613f3827c046295f92 (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
53
54
55
56
const common = require("./common.js")

module.exports = {
	info: {
		help: "Display info about furrybot",
		func: msg => msg.reply("**furrybot** _by Elias Fleckenstein_\n\n"
			+ "Furrybot for Discord: <https://github.com/EliasFleckenstein03/furrybot-discord>\n"
			+ "Original Furrybot Dragonfire CSM: <https://github.com/EliasFleckenstein03/furrybot>\n"
			+ "Custom Google Images API: <https://www.npmjs.com/package/free-google-images>"
		)
	},
	help: {
		params: "[<command>]",
		help: "Display help for a commands or show list of available commands",
		func: (msg, [cmd], {commands}) => {
			if (cmd) {
				let def = commands[cmd]

				if (def)
					msg.reply(`!${cmd}${def.params ? " " + def.params : ""}: ${def.help || "No description given"}`)
				else
					msg.reply(`Invalid command: ${cmd}`)
			} else {
				msg.reply("Available commands:\n\n" + Object.keys(commands).sort().join(", "))
			}
		},
	},
	accept: {
		help: "Accept a request",
		func: (msg, _, {requests}) => {
			const id = 	msg.author.id
			const req = requests[id]

			if (req) {
				delete requests[id]
				req.func(msg, req.origin)
			} else {
				msg.reply("Nothing to accept")
			}
		}
	},
	deny: {
		help: "Deny a request",
		func: (msg, _, {requests}) => {
			const id = msg.author.id
			const req = requests[id]

			if (req) {
				delete requests[id]
				msg.reply(`Denied request from <@!${req.origin}>`)
			} else {
				msg.reply("Nothing to deny")
			}
		}
	}
}