]> git.lizzy.rs Git - furrybot-discord.git/blob - basic.js
Add bad apple
[furrybot-discord.git] / basic.js
1 const common = require("./common.js")
2
3 module.exports = {
4         info: {
5                 help: "Display info about furrybot",
6                 func: msg => msg.reply("**furrybot** _by Elias Fleckenstein_\n\n"
7                         + "Furrybot for Discord: <https://github.com/EliasFleckenstein03/furrybot-discord>\n"
8                         + "Original Furrybot Dragonfire CSM: <https://github.com/EliasFleckenstein03/furrybot>\n"
9                         + "Custom Google Images API: <https://www.npmjs.com/package/free-google-images>"
10                 )
11         },
12         help: {
13                 params: "[<command>]",
14                 help: "Display help for a commands or show list of available commands",
15                 func: (msg, [cmd], {commands}) => {
16                         if (cmd) {
17                                 let def = commands[cmd]
18
19                                 if (def)
20                                         msg.reply(`!${cmd}${def.params ? " " + def.params : ""}: ${def.help || "No description given"}`)
21                                 else
22                                         msg.reply(`Invalid command: ${cmd}`)
23                         } else {
24                                 msg.reply("Available commands:\n\n" + Object.keys(commands).sort().join(", "))
25                         }
26                 },
27         },
28         accept: {
29                 help: "Accept a request",
30                 func: (msg, _, {requests}) => {
31                         const id =      msg.author.id
32                         const req = requests[id]
33
34                         if (req) {
35                                 delete requests[id]
36                                 req.func(msg, req.origin)
37                         } else {
38                                 msg.reply("Nothing to accept")
39                         }
40                 }
41         },
42         deny: {
43                 help: "Deny a request",
44                 func: (msg, _, {requests}) => {
45                         const id = msg.author.id
46                         const req = requests[id]
47
48                         if (req) {
49                                 delete requests[id]
50                                 msg.reply(`Denied request from <@!${req.origin}>`)
51                         } else {
52                                 msg.reply("Nothing to deny")
53                         }
54                 }
55         }
56 }