1 |
const { MessageActionRow, MessageButton } = require("discord.js"); |
import { CommandHelpData } from "../types/CommandHelpData"; |
|
const MessageEmbed = require("../src/MessageEmbed"); |
|
|
const { escapeRegex } = require("../src/util"); |
|
2 |
|
|
3 |
module.exports = { |
export default { |
4 |
version: "1.0.0-beta1", |
version: "2.0.0-beta1", |
5 |
commands: [ |
commands: <CommandHelpData[]> [ |
6 |
|
{ |
7 |
|
name: 'about', |
8 |
|
shortBrief: "Show information about the bot.", |
9 |
|
description: null, |
10 |
|
structure: "", |
11 |
|
example: "`%%about`", |
12 |
|
notes: null |
13 |
|
}, |
14 |
|
{ |
15 |
|
name: 'addqueue', |
16 |
|
shortBrief: "Add a queue job.", |
17 |
|
description: 'Adds a queued command to the bot\'s memory and after the given amount of time it gets executed.', |
18 |
|
structure: "<time> <command>", |
19 |
|
example: "`%%addqueue 15m echo Hello world`\n`%%addqueue 12h kick 875275828247255`", |
20 |
|
notes: null |
21 |
|
}, |
22 |
{ |
{ |
23 |
name: 'addsnippet', |
name: 'addsnippet', |
24 |
shortBrief: "Adds a snippet.", |
shortBrief: "Adds a snippet.", |
28 |
notes: null |
notes: null |
29 |
}, |
}, |
30 |
{ |
{ |
31 |
|
name: 'afk', |
32 |
|
shortBrief: "Keeps track of your mentions and tells other users that you're AFK.", |
33 |
|
description: null, |
34 |
|
structure: "[Reason]", |
35 |
|
example: "`%%afk`\n`%%afk Having dinner`", |
36 |
|
notes: null |
37 |
|
}, |
38 |
|
{ |
39 |
name: 'announce', |
name: 'announce', |
40 |
shortBrief: "Announce something in the given channel.", |
shortBrief: "Announce something in the given channel.", |
41 |
description: "Announce something in the given channel. The channel should be set in the configuration.", |
description: "Announce something in the given channel. The channel should be set in the configuration.", |
46 |
{ |
{ |
47 |
name: 'ban', |
name: 'ban', |
48 |
shortBrief: "Ban someone in this server.", |
shortBrief: "Ban someone in this server.", |
49 |
description: null, |
description: "Ban a user in this server.", |
50 |
structure: "<UserID|Mention> [Reason]", |
structure: "<UserID|UserTag|Mention> [-d=DAYS] [Reason]", |
51 |
example: "`%%ban 385753607325075320`\n`%%ban @Someone You are spamming a lot`", |
example: "`%%ban 385753607325075320`\n`%%ban @Someone You are spamming a lot`\n`%%ban @Someone -d 5`\n`%%ban 385753607325075320 -d 5 You are spamming a lot`", |
52 |
notes: null |
notes: null, |
53 |
|
options: { |
54 |
|
"-d": "The number of days old messages to delete. It must be in range 0-7. An argument is required.", |
55 |
|
} |
56 |
}, |
}, |
57 |
{ |
{ |
58 |
name: 'bean', |
name: 'bean', |
59 |
shortBrief: "Bean someone in this server.", |
shortBrief: "Bean someone in this server.", |
60 |
description: "Bean someone. It doesn't do anything except pretending.", |
description: "Bean someone. It doesn't do anything except pretending.", |
61 |
structure: "<UserID|Mention> [Reason]", |
structure: "<UserID|UserTag|Mention> [Reason]", |
62 |
example: "`%%bean 385753607325075320`\n`%%bean @Someone You are spamming a lot`", |
example: "`%%bean 385753607325075320`\n`%%bean @Someone You are spamming a lot`", |
63 |
notes: null |
notes: null |
64 |
}, |
}, |
71 |
notes: null |
notes: null |
72 |
}, |
}, |
73 |
{ |
{ |
74 |
|
name: 'clear', |
75 |
|
shortBrief: "Clear all messages from a user.", |
76 |
|
description: "Clear all messages from a user, in the current channel. This might take a while.", |
77 |
|
structure: "<UserID|UserTag|UserMention>", |
78 |
|
example: "`%%clear 83474924191884727`\n`%%clear @Someone`", |
79 |
|
notes: null |
80 |
|
}, |
81 |
|
{ |
82 |
|
name: 'delqueue', |
83 |
|
shortBrief: "Delete a queue job.", |
84 |
|
description: "Delete a queued command by its ID.", |
85 |
|
structure: "<QueueID>", |
86 |
|
example: "`%%delqueue 80`", |
87 |
|
notes: null |
88 |
|
}, |
89 |
|
{ |
90 |
name: 'delsnippet', |
name: 'delsnippet', |
91 |
shortBrief: "Deletes a snippet.", |
shortBrief: "Deletes a snippet.", |
92 |
description: null, |
description: null, |
111 |
notes: null |
notes: null |
112 |
}, |
}, |
113 |
{ |
{ |
114 |
|
name: 'expire', |
115 |
|
shortBrief: "Echo (re-send) a message and delete it after the given time.", |
116 |
|
description: "Re-send a message from the bot and delete it automatically after the given time interval.", |
117 |
|
structure: "<timeInterval> <content> [channelMention]", |
118 |
|
example: "`%%echo 25m Something\nVery Cool`\n`%%echo 1h Something\nVery Cool #general`", |
119 |
|
notes: null |
120 |
|
}, |
121 |
|
{ |
122 |
|
name: 'expiresc', |
123 |
|
shortBrief: "Schedule a message and delete it after the given time.", |
124 |
|
description: "Schedule a message from the bot and delete it automatically after the given time interval.", |
125 |
|
structure: "<scheduleTimeInterval> <expireTimeInterval> <content> [channelMention]", |
126 |
|
example: "`%%echo 25m 5h Something\nVery Cool`\n`%%echo 1h 7d Something\nVery Cool #general`", |
127 |
|
notes: null |
128 |
|
}, |
129 |
|
{ |
130 |
name: 'general-role', |
name: 'general-role', |
131 |
shortBrief: "Set the general role.", |
shortBrief: "Set the general role.", |
132 |
description: null, |
description: null, |
143 |
notes: null |
notes: null |
144 |
}, |
}, |
145 |
{ |
{ |
146 |
|
name: 'history', |
147 |
|
shortBrief: "Show moderation history for a user.", |
148 |
|
description: null, |
149 |
|
structure: "<UserMention|UserID>", |
150 |
|
example: "`%%history 27372628277272625`\n`%%history @Someone`", |
151 |
|
notes: null |
152 |
|
}, |
153 |
|
{ |
154 |
name: 'httpcat', |
name: 'httpcat', |
155 |
shortBrief: "Get some funny cat memes related to HTTP.", |
shortBrief: "Get some funny cat memes related to HTTP.", |
156 |
description: "Get some funny cat memes related to HTTP status codes, using http.cat API.", |
description: "Get some funny cat memes related to HTTP status codes, using http.cat API.", |
167 |
notes: null |
notes: null |
168 |
}, |
}, |
169 |
{ |
{ |
170 |
|
name: 'joke', |
171 |
|
shortBrief: "Fetch a random joke from The Joke API.", |
172 |
|
description: null, |
173 |
|
structure: "", |
174 |
|
example: "`%%joke`", |
175 |
|
notes: null |
176 |
|
}, |
177 |
|
{ |
178 |
name: 'kick', |
name: 'kick', |
179 |
shortBrief: "Kick someone from this server.", |
shortBrief: "Kick someone from this server.", |
180 |
description: null, |
description: null, |
181 |
structure: "<UserID|Mention> [Reason]", |
structure: "<UserID|UserTag|Mention> [Reason]", |
182 |
example: "`%%kick 385753607325075320`\n`%%kick @Someone You are spamming a lot`", |
example: "`%%kick 385753607325075320`\n`%%kick @Someone You are spamming a lot`", |
183 |
notes: null |
notes: null |
184 |
}, |
}, |
191 |
notes: null, |
notes: null, |
192 |
options: { |
options: { |
193 |
"--no-send": "Do not send a confirmation message to the locked channel", |
"--no-send": "Do not send a confirmation message to the locked channel", |
|
"--everyone": "Lock the channels for @everyone rather than the general role", |
|
194 |
} |
} |
195 |
}, |
}, |
196 |
{ |
{ |
202 |
notes: null, |
notes: null, |
203 |
options: { |
options: { |
204 |
"--no-send": "Do not send a confirmation message to the locked channel", |
"--no-send": "Do not send a confirmation message to the locked channel", |
|
"--everyone": "Lock the channels for @everyone rather than the general role", |
|
205 |
} |
} |
206 |
}, |
}, |
207 |
{ |
{ |
216 |
name: 'mute', |
name: 'mute', |
217 |
shortBrief: "Mute someone in this server.", |
shortBrief: "Mute someone in this server.", |
218 |
description: null, |
description: null, |
219 |
structure: "<UserID|Mention> [-t=DURATION] [Reason]", |
structure: "<UserID|UserTag|Mention> [-t=DURATION] [Reason]", |
220 |
example: "`%%mute 385753607325075320`\n`%%mute @Someone You are spamming a lot`\n`%%mute @Someone -t 10m You are spamming a lot`", |
example: "`%%mute 385753607325075320`\n`%%mute @Someone You are spamming a lot`\n`%%mute @Someone -t 10m You are spamming a lot`", |
221 |
options: { |
options: { |
222 |
"-t": "Set the mute duration" |
"-t": "Set the mute duration" |
243 |
name: 'note', |
name: 'note', |
244 |
shortBrief: "Take a note about an user.", |
shortBrief: "Take a note about an user.", |
245 |
description: null, |
description: null, |
246 |
structure: "<UserID|UserMention> <note>", |
structure: "<UserID|UserTag|UserMention> <note>", |
247 |
example: "`%%note @Someone Simple note.`", |
example: "`%%note @Someone Simple note.`", |
248 |
notes: null |
notes: null |
249 |
}, |
}, |
267 |
name: 'notes', |
name: 'notes', |
268 |
shortBrief: "Get all notes for a specific user.", |
shortBrief: "Get all notes for a specific user.", |
269 |
description: null, |
description: null, |
270 |
structure: "<UserID|UserMention>", |
structure: "<UserID|UserTag|UserMention>", |
271 |
example: "`%%notes @Someone`", |
example: "`%%notes @Someone`", |
272 |
notes: null |
notes: null |
273 |
}, |
}, |
288 |
notes: null |
notes: null |
289 |
}, |
}, |
290 |
{ |
{ |
291 |
|
name: 'queues', |
292 |
|
shortBrief: "Show a list of all queue jobs.", |
293 |
|
description: null, |
294 |
|
structure: "", |
295 |
|
example: "`%%queues`", |
296 |
|
notes: null |
297 |
|
}, |
298 |
|
{ |
299 |
|
name: 'schedule', |
300 |
|
shortBrief: "Echo (re-send) a message after the given time.", |
301 |
|
description: "Re-send a message from the bot automatically after the given time interval.", |
302 |
|
structure: "<timeInterval> <content> [channelMention]", |
303 |
|
example: "`%%echo 25m Something\nVery Cool`\n`%%echo 1h Something\nVery Cool #general`", |
304 |
|
notes: null |
305 |
|
}, |
306 |
|
{ |
307 |
name: 'setconfig', |
name: 'setconfig', |
308 |
shortBrief: "Change the bot configuration keys.", |
shortBrief: "Change the bot configuration keys.", |
309 |
description: null, |
description: null, |
312 |
notes: null |
notes: null |
313 |
}, |
}, |
314 |
{ |
{ |
315 |
|
name: 'send', |
316 |
|
shortBrief: "Send a DM to a user.", |
317 |
|
description: null, |
318 |
|
structure: "<UserID|UserTag|Mention> <content>", |
319 |
|
example: "`%%send 278358918549759428 Hello world`\n`%%send @Someone Hello world`", |
320 |
|
notes: null |
321 |
|
}, |
322 |
|
{ |
323 |
name: 'spamfilter', |
name: 'spamfilter', |
324 |
shortBrief: "Change the spam filter configuration keys.", |
shortBrief: "Change the spam filter configuration keys.", |
325 |
description: null, |
description: null, |
328 |
notes: null |
notes: null |
329 |
}, |
}, |
330 |
{ |
{ |
331 |
|
name: 'stats', |
332 |
|
shortBrief: "Show the server stats.", |
333 |
|
description: null, |
334 |
|
structure: "", |
335 |
|
example: "`%%stats", |
336 |
|
notes: null |
337 |
|
}, |
338 |
|
{ |
339 |
name: 'unban', |
name: 'unban', |
340 |
shortBrief: "Unban a user from this server.", |
shortBrief: "Unban a user from this server.", |
341 |
description: null, |
description: null, |
352 |
notes: null, |
notes: null, |
353 |
options: { |
options: { |
354 |
"--no-send": "Do not send a confirmation message to the locked channel", |
"--no-send": "Do not send a confirmation message to the locked channel", |
|
"--everyone": "Unlock the channels for @everyone rather than the general role", |
|
355 |
} |
} |
356 |
}, |
}, |
357 |
{ |
{ |
363 |
notes: null, |
notes: null, |
364 |
options: { |
options: { |
365 |
"--no-send": "Do not send a confirmation message to the locked channel", |
"--no-send": "Do not send a confirmation message to the locked channel", |
366 |
"--everyone": "Lock the channels for @everyone rather than the general role", |
"--raid": "Unlock all Raid-locked channels" |
367 |
} |
} |
368 |
}, |
}, |
369 |
{ |
{ |
370 |
name: 'unmute', |
name: 'unmute', |
371 |
shortBrief: "Unmute someone in this server.", |
shortBrief: "Unmute someone in this server.", |
372 |
description: null, |
description: null, |
373 |
structure: "<UserID|Mention>", |
structure: "<UserID|UserTag|Mention>", |
374 |
example: "`%%unmute 385753607325075320`\n`%%unmute @Someone You are spamming a lot`", |
example: "`%%unmute 385753607325075320`\n`%%unmute @Someone You are spamming a lot`", |
375 |
notes: null |
notes: null |
376 |
}, |
}, |
378 |
name: 'warn', |
name: 'warn', |
379 |
shortBrief: "Warn someone in this server.", |
shortBrief: "Warn someone in this server.", |
380 |
description: null, |
description: null, |
381 |
structure: "<UserID|Mention> [Reason]", |
structure: "<UserID|UserTag|Mention> [Reason]", |
382 |
example: "`%%warn 385753607325075320`\n`%%warn @Someone You are spamming a lot`", |
example: "`%%warn 385753607325075320`\n`%%warn @Someone You are spamming a lot`", |
383 |
notes: null |
notes: null |
384 |
}, |
}, |
402 |
name: 'warnings', |
name: 'warnings', |
403 |
shortBrief: "Show all warnings.", |
shortBrief: "Show all warnings.", |
404 |
description: "Show all warnings in this server. Passing an user will only show their warnings.", |
description: "Show all warnings in this server. Passing an user will only show their warnings.", |
405 |
structure: "[UserId|Mention]", |
structure: "[UserId|UserTag|Mention]", |
406 |
example: "`%%warnings`\n`%%warnings 948489127957979253978538`", |
example: "`%%warnings`\n`%%warnings 948489127957979253978538`", |
407 |
notes: null |
notes: null |
408 |
}, |
}, |
|
], |
|
|
async render() { |
|
|
let string = ''; |
|
|
|
|
|
for (let cmd of this.commands) { |
|
|
string += `\n\n**${cmd.name}**\n${cmd.shortBrief}`; |
|
|
} |
|
|
|
|
|
return string; |
|
|
}, |
|
|
async handle(msg, cm) { |
|
|
if (typeof cm.args[0] === 'undefined') { |
|
|
// await msg.reply({ |
|
|
// embeds: [ |
|
|
// new MessageEmbed() |
|
|
// .setColor('#f14a60') |
|
|
// .setDescription(`This command requires at least one argument.`) |
|
|
// ] |
|
|
// }); |
|
|
|
|
|
await msg.reply({ |
|
|
embeds: [ |
|
|
new MessageEmbed() |
|
|
.setDescription("The command list. Run `" + app.config.get('prefix') + "help <commandName>` for more information about a specific command.\n" + await this.render()) |
|
|
.setTitle('Help') |
|
|
], |
|
|
}); |
|
|
|
|
|
return; |
|
|
} |
|
|
|
|
|
const cmd = this.commands.find(c => c.name === cm.args[0]); |
|
|
|
|
|
if (!cmd) { |
|
|
await msg.reply({ |
|
|
embeds: [ |
|
|
new MessageEmbed() |
|
|
.setColor('#f14a60') |
|
|
.setDescription(`Invalid command \`${cm.args[0]}\`.`) |
|
|
] |
|
|
}); |
|
|
|
|
|
return; |
|
|
} |
|
|
|
|
|
let fields = [ |
|
|
{ |
|
|
name: "Usage", |
|
|
value: `\`${app.config.get('prefix')}${cmd.name}\`` + (cmd.structure.trim() !== '' ? ` \`${cmd.structure}\`` : '') |
|
|
}, |
|
|
{ |
|
|
name: 'Examples', |
|
|
value: cmd.example.replace(/\%\%/g, app.config.get('prefix')) |
|
|
} |
|
|
]; |
|
|
|
|
|
if (cmd.options !== undefined) { |
|
|
let str = ''; |
|
|
|
|
|
for (let opt in cmd.options) |
|
|
str += `\`${opt}\` - ${cmd.options[opt]}\n`; |
|
|
|
|
|
str = str.substring(0, str.length - 1); |
|
|
|
|
|
fields.push({ |
|
|
name: 'Options', |
|
|
value: str |
|
|
}); |
|
|
} |
|
|
|
|
|
if (cmd.notes !== null) { |
|
|
fields.push({ |
|
|
name: "Notes", |
|
|
value: cmd.notes |
|
|
}); |
|
|
} |
|
|
|
|
|
await msg.reply({ |
|
|
embeds: [ |
|
|
new MessageEmbed() |
|
|
.setTitle(`${app.config.get('prefix')}${cmd.name}`) |
|
|
.setDescription(cmd.description !== null ? cmd.description : cmd.shortBrief) |
|
|
.addFields(fields) |
|
|
] |
|
|
}); |
|
|
} |
|
|
}; |
|
409 |
|
] |
410 |
|
} |