]> git.lizzy.rs Git - furrybot-discord.git/blob - basic.js
Fully ping proof
[furrybot-discord.git] / basic.js
1 const common = require("./common.js")
2
3 module.exports = {
4         help: {
5                 params: "[<command>]",
6                 help: "Display help for a commands or show list of available commands",
7                 func: (msg, [cmd], {commands}) => {
8                         if (cmd) {
9                                 let def = commands[cmd]
10
11                                 if (def)
12                                         msg.reply(`!${cmd}${def.params ? " " + def.params : ""}: ${def.help || "No description given"}`)
13                                 else
14                                         msg.reply(`Invalid command: ${cmd}`)
15                         } else {
16                                 msg.reply("Available commands:\n\t" + Object.keys(commands).join("\n\t"))
17                         }
18                 },
19         },
20         accept: {
21                 help: "Accept a request",
22                 func: (msg, _, {requests}) => {
23                         const id =      msg.author.id
24                         const req = requests[id]
25
26                         if (req) {
27                                 delete requests[id]
28                                 req.func(msg, req.origin)
29                         } else {
30                                 msg.reply("Nothing to accept")
31                         }
32                 }
33         },
34         deny: {
35                 help: "Deny a request",
36                 func: (msg, _, {requests}) => {
37                         const id = msg.author.id
38                         const req = requests[id]
39
40                         if (req) {
41                                 delete requests[id]
42                                 msg.reply(`Denied request from <@!${req.origin}>`)
43                         } else {
44                                 msg.reply("Nothing to deny")
45                         }
46                 }
47         }
48 }