/[sudobot]/trunk/commands/help.js
ViewVC logotype

Annotation of /trunk/commands/help.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 49 - (hide annotations)
Mon Jul 29 17:28:21 2024 UTC (8 months, 1 week ago) by rakin
File MIME type: text/javascript
File size: 18229 byte(s)
Release version 1.10.0

* Added -queues command to list all queued jobs
* Added -joke command to fetch random jokes
* Added support of user tags in some user-based commands
1 rakin 11 const { MessageActionRow, MessageButton } = require("discord.js");
2     const MessageEmbed = require("../src/MessageEmbed");
3     const { escapeRegex } = require("../src/util");
4    
5     module.exports = {
6 rakin 49 version: "1.10.0",
7 rakin 11 commands: [
8     {
9 rakin 47 name: 'about',
10     shortBrief: "Show information about the bot.",
11     description: null,
12     structure: "",
13     example: "`%%about`",
14     notes: null
15     },
16     {
17     name: 'addqueue',
18     shortBrief: "Add a queue job.",
19     description: 'Adds a queued command to the bot\'s memory and after the given amount of time it gets executed.',
20     structure: "<time> <command>",
21     example: "`%%addqueue 15m echo Hello world`\n`%%addqueue 12h kick 875275828247255`",
22     notes: null
23     },
24     {
25 rakin 11 name: 'addsnippet',
26     shortBrief: "Adds a snippet.",
27     description: null,
28     structure: "<Name> <Content>",
29     example: "`%%addsnippet roles There are 2 roles`\n`%%addsnippet roles There are 2 roles\nAdmin - Administrator\nMod - Moderator`",
30     notes: null
31     },
32     {
33 rakin 30 name: 'afk',
34     shortBrief: "Keeps track of your mentions and tells other users that you're AFK.",
35     description: null,
36     structure: "[Reason]",
37     example: "`%%afk`\n`%%afk Having dinner`",
38     notes: null
39     },
40     {
41 rakin 11 name: 'announce',
42     shortBrief: "Announce something in the given channel.",
43     description: "Announce something in the given channel. The channel should be set in the configuration.",
44     structure: "<Content>",
45     example: "`%%announce Hello there!\nWe've just finished our job!\n@everyone`",
46     notes: null
47     },
48     {
49     name: 'ban',
50     shortBrief: "Ban someone in this server.",
51 rakin 49 description: "Ban a user in this server.",
52     structure: "<UserID|UserTag|Mention> [-d=DAYS] [Reason]",
53 rakin 37 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`",
54 rakin 49 notes: null,
55     options: {
56     "-d": "The number of days old messages to delete. It must be in range 0-7. An argument is required.",
57     }
58 rakin 11 },
59     {
60     name: 'bean',
61     shortBrief: "Bean someone in this server.",
62     description: "Bean someone. It doesn't do anything except pretending.",
63 rakin 49 structure: "<UserID|UserTag|Mention> [Reason]",
64 rakin 11 example: "`%%bean 385753607325075320`\n`%%bean @Someone You are spamming a lot`",
65     notes: null
66     },
67     {
68     name: 'cat',
69     shortBrief: "Get a random kitty picture.",
70     description: "Fetches a random cat picture from `thecatapi.com` API.",
71     structure: "",
72     example: "`%%cat`",
73     notes: null
74     },
75     {
76 rakin 26 name: 'clear',
77     shortBrief: "Clear all messages from a user.",
78     description: "Clear all messages from a user, in the current channel. This might take a while.",
79 rakin 49 structure: "<UserID|UserTag|UserMention>",
80 rakin 26 example: "`%%clear 83474924191884727`\n`%%clear @Someone`",
81     notes: null
82     },
83     {
84 rakin 48 name: 'delqueue',
85     shortBrief: "Delete a queue job.",
86     description: "Delete a queued command by its ID.",
87 rakin 47 structure: "<QueueID>",
88     example: "`%%delqueue 80`",
89     notes: null
90     },
91     {
92 rakin 11 name: 'delsnippet',
93     shortBrief: "Deletes a snippet.",
94     description: null,
95     structure: "<Name>",
96     example: "`%%delsnippet roles`",
97     notes: null
98     },
99     {
100     name: 'dog',
101     shortBrief: "Get a random doggy picture.",
102     description: "Fetches a random cat picture from `thedogapi.com` API.",
103     structure: "",
104     example: "`%%dog`",
105     notes: null
106     },
107     {
108     name: 'echo',
109     shortBrief: "Echo (re-send) a message.",
110     description: "Re-send a message from the bot.",
111     structure: "<content> [channelMention]",
112     example: "`%%echo Something\nVery Cool`\n`%%echo Something\nVery Cool #general`",
113     notes: null
114     },
115     {
116 rakin 45 name: 'expire',
117     shortBrief: "Echo (re-send) a message and delete it after the given time.",
118     description: "Re-send a message from the bot and delete it automatically after the given time interval.",
119     structure: "<timeInterval> <content> [channelMention]",
120     example: "`%%echo 25m Something\nVery Cool`\n`%%echo 1h Something\nVery Cool #general`",
121     notes: null
122     },
123     {
124     name: 'expiresc',
125     shortBrief: "Schedule a message and delete it after the given time.",
126     description: "Schedule a message from the bot and delete it automatically after the given time interval.",
127     structure: "<scheduleTimeInterval> <expireTimeInterval> <content> [channelMention]",
128     example: "`%%echo 25m 5h Something\nVery Cool`\n`%%echo 1h 7d Something\nVery Cool #general`",
129     notes: null
130     },
131     {
132 rakin 11 name: 'general-role',
133     shortBrief: "Set the general role.",
134     description: null,
135     structure: "<RoleID|RoleMention>",
136     example: "`%%general-role 937923625698638`\n`%%general-role @General`",
137     notes: null
138     },
139     {
140     name: 'help',
141     shortBrief: "Show this help and exit.",
142     description: null,
143     structure: "[command]",
144     example: "`%%help`\n`%%help mute`",
145     notes: null
146     },
147     {
148 rakin 26 name: 'history',
149     shortBrief: "Show moderation history for a user.",
150     description: null,
151     structure: "<UserMention|UserID>",
152     example: "`%%history 27372628277272625`\n`%%history @Someone`",
153     notes: null
154     },
155     {
156 rakin 11 name: 'httpcat',
157     shortBrief: "Get some funny cat memes related to HTTP.",
158     description: "Get some funny cat memes related to HTTP status codes, using http.cat API.",
159     structure: "<status>",
160     example: "`%%httpcat 403`",
161     notes: null
162     },
163     {
164     name: 'httpdog',
165     shortBrief: "Get some funny dog memes related to HTTP.",
166     description: "Get some funny dog memes related to HTTP status codes, using http.dog API.",
167     structure: "<status>",
168     example: "`%%httpdog 403`",
169     notes: null
170     },
171     {
172 rakin 49 name: 'joke',
173     shortBrief: "Fetch a random joke from The Joke API.",
174     description: null,
175     structure: "",
176     example: "`%%joke`",
177     notes: null
178     },
179     {
180 rakin 11 name: 'kick',
181     shortBrief: "Kick someone from this server.",
182     description: null,
183 rakin 49 structure: "<UserID|UserTag|Mention> [Reason]",
184 rakin 11 example: "`%%kick 385753607325075320`\n`%%kick @Someone You are spamming a lot`",
185     notes: null
186     },
187     {
188     name: 'lock',
189     shortBrief: "Lock a specific channel.",
190     description: "Makes the given channel read-only for the general members. If no channel is present, the current channel will be locked.",
191     structure: "[ChannelID|ChannelMention] [...options]",
192     example: "`%%lock 385753607325075320`\n`%%lock #general`\n`%%lock`",
193     notes: null,
194     options: {
195     "--no-send": "Do not send a confirmation message to the locked channel",
196     }
197     },
198     {
199     name: 'lockall',
200     shortBrief: "Lock all the channels given in the configuration.",
201     description: "Makes the given channels read-only for the general members.",
202     structure: "[...options]",
203     example: "`%%lockall --no-send\n`%%lockall`\n`%%lockall --everyone`",
204     notes: null,
205     options: {
206     "--no-send": "Do not send a confirmation message to the locked channel",
207     }
208     },
209     {
210     name: 'mod-role',
211     shortBrief: "Set the moderator role.",
212     description: null,
213     structure: "<RoleID|RoleMention>",
214     example: "`%%mod-role 937923625698638`\n`%%mod-role @Moderator`",
215     notes: null
216     },
217     {
218     name: 'mute',
219     shortBrief: "Mute someone in this server.",
220     description: null,
221 rakin 49 structure: "<UserID|UserTag|Mention> [-t=DURATION] [Reason]",
222 rakin 11 example: "`%%mute 385753607325075320`\n`%%mute @Someone You are spamming a lot`\n`%%mute @Someone -t 10m You are spamming a lot`",
223     options: {
224     "-t": "Set the mute duration"
225     },
226     notes: null
227     },
228     {
229     name: 'muted-role',
230     shortBrief: "Set the muted role.",
231     description: null,
232     structure: "<RoleID|RoleMention>",
233     example: "`%%muted-role 937923625698638`\n`%%muted-role @Muted`",
234     notes: null
235     },
236     {
237     name: 'mvsnippet',
238     shortBrief: "Rename a snippet.",
239     description: null,
240     structure: "<oldName> <newName>",
241     example: "`%%mvsnippet abc bca`",
242     notes: null
243     },
244     {
245     name: 'note',
246     shortBrief: "Take a note about an user.",
247     description: null,
248 rakin 49 structure: "<UserID|UserTag|UserMention> <note>",
249 rakin 11 example: "`%%note @Someone Simple note.`",
250     notes: null
251     },
252     {
253     name: 'notedel',
254     shortBrief: "Delete a note.",
255     description: null,
256     structure: "<NoteID>",
257     example: "`%%notedel 922`",
258     notes: null
259     },
260     {
261     name: 'noteget',
262     shortBrief: "Get a note.",
263     description: null,
264     structure: "<NoteID>",
265     example: "`%%noteget 922`",
266     notes: null
267     },
268     {
269     name: 'notes',
270     shortBrief: "Get all notes for a specific user.",
271     description: null,
272 rakin 49 structure: "<UserID|UserTag|UserMention>",
273 rakin 11 example: "`%%notes @Someone`",
274     notes: null
275     },
276     {
277     name: 'pixabay',
278     shortBrief: "Fetch images from Pixabay.",
279     description: "Search & fetch images from Pixabay API.\n\nAvailable Subcommands:\n\tphoto - Fetch photos only.\n\tvector - Fetch vectors only.\n\tillustration - Fetch illustrations only\n\timage - Fetch any image.",
280     structure: "<subcommand> [query]",
281     example: "`%%pixabay image`\n`%%pixabay photo birds`",
282     notes: null
283     },
284     {
285     name: 'prefix',
286     shortBrief: "Change the bot prefix.",
287     description: null,
288     structure: "<NewPrefix>",
289     example: "`%%prefix -`",
290     notes: null
291     },
292     {
293 rakin 49 name: 'queues',
294     shortBrief: "Show a list of all queue jobs.",
295     description: null,
296     structure: "",
297     example: "`%%queues`",
298     notes: null
299     },
300     {
301 rakin 45 name: 'schedule',
302     shortBrief: "Echo (re-send) a message after the given time.",
303     description: "Re-send a message from the bot automatically after the given time interval.",
304     structure: "<timeInterval> <content> [channelMention]",
305     example: "`%%echo 25m Something\nVery Cool`\n`%%echo 1h Something\nVery Cool #general`",
306     notes: null
307     },
308     {
309 rakin 11 name: 'setconfig',
310     shortBrief: "Change the bot configuration keys.",
311     description: null,
312     structure: "<key> <value>",
313     example: "`%%setconfig debug true`",
314     notes: null
315     },
316     {
317 rakin 27 name: 'send',
318     shortBrief: "Send a DM to a user.",
319     description: null,
320 rakin 49 structure: "<UserID|UserTag|Mention> <content>",
321 rakin 27 example: "`%%send 278358918549759428 Hello world`\n`%%send @Someone Hello world`",
322     notes: null
323     },
324     {
325 rakin 11 name: 'spamfilter',
326     shortBrief: "Change the spam filter configuration keys.",
327     description: null,
328     structure: "<key> <value>",
329     example: "`%%spamfilter include #general`",
330     notes: null
331     },
332     {
333 rakin 31 name: 'stats',
334     shortBrief: "Show the server stats.",
335     description: null,
336     structure: "",
337     example: "`%%stats",
338     notes: null
339     },
340     {
341 rakin 11 name: 'unban',
342     shortBrief: "Unban a user from this server.",
343     description: null,
344     structure: "<UserID>",
345     example: "`%%unban 2946255269594753792`",
346     notes: null
347     },
348     {
349     name: 'unlock',
350 rakin 16 shortBrief: "Unlock a specific channel.",
351 rakin 11 description: "Makes the given channel writable for the general members. If no channel is present, the current channel is unlocked.",
352     structure: "[ChannelID|ChannelMention] [...options]",
353     example: "`%%unlock 385753607325075320`\n`%%unlock #general`\n`%%unlock`",
354     notes: null,
355     options: {
356     "--no-send": "Do not send a confirmation message to the locked channel",
357     }
358     },
359     {
360     name: 'unlockall',
361     shortBrief: "Unlock all the channels given in the configuration.",
362     description: "Makes the given channels writable for the general members.",
363     structure: "[...options]",
364     example: "`%%unlockall --no-send\n`%%unlockall`\n`%%unlockall --everyone`",
365     notes: null,
366     options: {
367     "--no-send": "Do not send a confirmation message to the locked channel",
368 rakin 21 "--raid": "Unlock all Raid-locked channels"
369 rakin 11 }
370     },
371     {
372     name: 'unmute',
373 rakin 16 shortBrief: "Unmute someone in this server.",
374 rakin 11 description: null,
375 rakin 49 structure: "<UserID|UserTag|Mention>",
376 rakin 11 example: "`%%unmute 385753607325075320`\n`%%unmute @Someone You are spamming a lot`",
377     notes: null
378     },
379     {
380     name: 'warn',
381     shortBrief: "Warn someone in this server.",
382     description: null,
383 rakin 49 structure: "<UserID|UserTag|Mention> [Reason]",
384 rakin 11 example: "`%%warn 385753607325075320`\n`%%warn @Someone You are spamming a lot`",
385     notes: null
386     },
387     {
388     name: 'warndel',
389     shortBrief: "Delete a warning.",
390     description: null,
391     structure: "<ID>",
392     example: "`%%warndel 39`",
393     notes: null
394     },
395     {
396     name: 'warning',
397     shortBrief: "Show a warning.",
398     description: null,
399     structure: "<ID>",
400     example: "`%%warning 39`",
401     notes: null
402     },
403     {
404     name: 'warnings',
405     shortBrief: "Show all warnings.",
406     description: "Show all warnings in this server. Passing an user will only show their warnings.",
407 rakin 49 structure: "[UserId|UserTag|Mention]",
408 rakin 11 example: "`%%warnings`\n`%%warnings 948489127957979253978538`",
409     notes: null
410     },
411     ],
412     async render() {
413     let string = '';
414    
415     for (let cmd of this.commands) {
416     string += `\n\n**${cmd.name}**\n${cmd.shortBrief}`;
417     }
418    
419     return string;
420     },
421     async handle(msg, cm) {
422     if (typeof cm.args[0] === 'undefined') {
423     await msg.reply({
424     embeds: [
425     new MessageEmbed()
426 rakin 45 .setDescription("The command list.\n\n`<...>` means required argument, `[...]` means optional argument.\n\nRun `" + app.config.get('prefix') + "help <commandName>` for more information about a specific command.\n" + await this.render())
427 rakin 11 .setTitle('Help')
428     ],
429     });
430    
431     return;
432     }
433    
434     const cmd = this.commands.find(c => c.name === cm.args[0]);
435    
436     if (!cmd) {
437     await msg.reply({
438     embeds: [
439     new MessageEmbed()
440     .setColor('#f14a60')
441     .setDescription(`Invalid command \`${cm.args[0]}\`.`)
442     ]
443     });
444    
445     return;
446     }
447    
448     let fields = [
449     {
450     name: "Usage",
451     value: `\`${app.config.get('prefix')}${cmd.name}\`` + (cmd.structure.trim() !== '' ? ` \`${cmd.structure}\`` : '')
452     },
453     {
454     name: 'Examples',
455     value: cmd.example.replace(/\%\%/g, app.config.get('prefix'))
456     }
457     ];
458    
459     if (cmd.options !== undefined) {
460     let str = '';
461    
462     for (let opt in cmd.options)
463     str += `\`${opt}\` - ${cmd.options[opt]}\n`;
464    
465     str = str.substring(0, str.length - 1);
466    
467     fields.push({
468     name: 'Options',
469     value: str
470     });
471     }
472    
473     if (cmd.notes !== null) {
474     fields.push({
475     name: "Notes",
476     value: cmd.notes
477     });
478     }
479    
480     await msg.reply({
481     embeds: [
482     new MessageEmbed()
483     .setTitle(`${app.config.get('prefix')}${cmd.name}`)
484 rakin 45 .setDescription("`<...>` means required argument, `[...]` means optional argument.\n\n" + (cmd.description !== null ? cmd.description : cmd.shortBrief))
485 rakin 11 .addFields(fields)
486     ]
487     });
488     }
489     };

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26