/[sudobot]/branches/4.x/deploy-commands.js
ViewVC logotype

Contents of /branches/4.x/deploy-commands.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 577 - (show annotations)
Mon Jul 29 18:52:37 2024 UTC (8 months ago) by rakinar2
File MIME type: text/javascript
File size: 37442 byte(s)
chore: add old version archive branches (2.x to 9.x-dev)
1 #!/bin/node
2
3 /**
4 * This file is part of SudoBot.
5 *
6 * Copyright (C) 2021-2022 OSN Inc.
7 *
8 * SudoBot is free software; you can redistribute it and/or modify it
9 * under the terms of the GNU Affero General Public License as published by
10 * the Free Software Foundation, either version 3 of the License, or
11 * (at your option) any later version.
12 *
13 * SudoBot is distributed in the hope that it will be useful, but
14 * WITHOUT ANY WARRANTY; without even the implied warranty of
15 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
16 * GNU Affero General Public License for more details.
17 *
18 * You should have received a copy of the GNU Affero General Public License
19 * along with SudoBot. If not, see <https://www.gnu.org/licenses/>.
20 */
21
22 const { SlashCommandBuilder, ContextMenuCommandBuilder } = require('@discordjs/builders');
23 const { REST } = require('@discordjs/rest');
24 const { Routes } = require('discord-api-types/v9');
25 const { config } = require('dotenv');
26 const { existsSync } = require('fs');
27 const path = require('path');
28 const { ApplicationCommandType } = require('discord-api-types/v10');
29
30 if (existsSync(path.join(__dirname, '.env'))) {
31 config();
32 }
33 else {
34 process.env.ENV = 'prod';
35 }
36
37 const { CLIENT_ID, GUILD_ID, TOKEN } = process.env;
38
39 let commands = [
40 // SETTINGS
41 new SlashCommandBuilder().setName('help').setDescription('A short documentation about the commands')
42 .addStringOption(option => option.setName('command').setDescription("The command")),
43 new SlashCommandBuilder().setName('about').setDescription('Show information about the bot'),
44 new SlashCommandBuilder().setName('eval').setDescription('Execute raw code in the runtime environment')
45 .addStringOption(option => option.setName('code').setDescription('The code to be executed').setRequired(true)),
46 new SlashCommandBuilder().setName('system').setDescription('Show the system status'),
47 new SlashCommandBuilder().setName('restart').setDescription('Restart the system'),
48 new SlashCommandBuilder().setName('setstatus').setDescription('Set status for the bot system')
49 .addStringOption(option => option.setName('activity').setDescription('The activity').setRequired(true))
50 .addStringOption(option => option.setName('status').setDescription('The status').setChoices(...[
51 {
52 name: 'Online',
53 value: 'online'
54 },
55 {
56 name: 'Idle',
57 value: 'idle'
58 },
59 {
60 name: 'DND',
61 value: 'dnd'
62 },
63 {
64 name: 'Invisible',
65 value: 'invisible'
66 }
67 ]))
68 .addStringOption(option => option.setName('type').setDescription('The activity type').setChoices(...[
69 {
70 name: 'Playing',
71 value: 'PLAYING'
72 },
73 {
74 name: 'Watching',
75 value: 'WATCHING'
76 },
77 {
78 name: 'Competing',
79 value: 'COMPETING'
80 },
81 {
82 name: 'Listening',
83 value: 'LISTENING'
84 },
85 {
86 name: 'Streaming',
87 value: 'STREAMING'
88 }
89 ])),
90 new SlashCommandBuilder().setName('config').setDescription('View/change the system settings for this server')
91 .addStringOption(option => option.setName('key').setDescription('The setting key (e.g. spam_filter.enabled)').setRequired(true).setAutocomplete(true))
92 .addStringOption(option => option.setName('value').setDescription('New value for the setting')),
93
94 new SlashCommandBuilder().setName('blockedword').setDescription('Manage blocked words')
95 .addSubcommand(subcmd =>
96 subcmd.setName("add").setDescription("Block words")
97 .addStringOption(option => option.setName("words").setDescription("The words that should be blocked; separated by spaces").setRequired(true))
98 )
99 .addSubcommand(subcmd =>
100 subcmd.setName("remove").setDescription("Remove blocked words")
101 .addStringOption(option => option.setName("words").setDescription("The words that should be removed from blocklist; separated by spaces").setRequired(true))
102 )
103 .addSubcommand(subcmd =>
104 subcmd.setName("has").setDescription("Check if a word is blocked")
105 .addStringOption(option => option.setName("word").setDescription("The word").setRequired(true))
106 )
107 .addSubcommand(subcmd =>
108 subcmd.setName("list").setDescription("List the blocked words")
109 ),
110
111 new SlashCommandBuilder().setName('blockedtoken').setDescription('Manage blocked tokens')
112 .addSubcommand(subcmd =>
113 subcmd.setName("add").setDescription("Block a token")
114 .addStringOption(option => option.setName("token").setDescription("The token that should be blocked").setRequired(true))
115 )
116 .addSubcommand(subcmd =>
117 subcmd.setName("remove").setDescription("Remove a blocked token")
118 .addStringOption(option => option.setName("token").setDescription("The token that should be removed from blocklist").setRequired(true))
119 )
120 .addSubcommand(subcmd =>
121 subcmd.setName("has").setDescription("Check if a token is blocked")
122 .addStringOption(option => option.setName("token").setDescription("The token").setRequired(true))
123 )
124 .addSubcommand(subcmd =>
125 subcmd.setName("list").setDescription("List the blocked tokens")
126 ),
127
128 // INFORMATION
129 new SlashCommandBuilder().setName('messagerulestats').setDescription('View stats of message rules (blocked words/tokens etc)')
130 .addUserOption(option =>
131 option.setName('user').setDescription('The user to search').setRequired(true)
132 )
133 .addStringOption(option =>
134 option.setName('word_or_token').setDescription('The word/token to search').setRequired(true)
135 ),
136
137 new SlashCommandBuilder().setName('profileinfo').setDescription('Manage your profile information in the bot')
138 .addSubcommand(subcmd =>
139 subcmd.setName('set').setDescription('Set or edit your profile information')
140 .addStringOption(option => option.setName('gender').setDescription('Your gender').setChoices(...(['Male', 'Female', 'Other', "None"].map(op => ({ name: op, value: op })))))
141 .addStringOption(option => option.setName('zodiac').setDescription('Your zodiac sign').setChoices(...([
142 "None",
143 "Taurus",
144 "Gemini",
145 "Aries",
146 "Cancer",
147 "Leo",
148 "Virgo",
149 "Libra",
150 "Scorpius",
151 "Sagittarius",
152 "Capricorn",
153 "Aquarius",
154 "Pisces"
155 ].map(op => ({ name: op, value: op })))))
156 .addStringOption(option => option.setName('continent').setDescription('Your continent').setChoices(...([
157 "None",
158 "Asia",
159 "Europe",
160 "North America",
161 "South America",
162 "Africa",
163 "Oceania",
164 "Australia",
165 ].map(op => ({ name: op, value: op.replace(/ /g, '_') })))))
166 .addStringOption(option => option.setName('job').setDescription('Your job or occupation, type \'none\' to remove this field'))
167 .addStringOption(option => option.setName('pronoun').setDescription('Your pronoun').setChoices(...(['He/Him', 'She/Her', 'They/Them', "Any Pronoun", "Other Pronouns", "None"].map(op => ({ name: op, value: op.replace(/ /g, '_').replace(/\//g, '__') })))))
168 .addIntegerOption(option => option.setName('age').setDescription('Your age, put \'0\' to remove your age from the database'))
169 )
170 .addSubcommand(subcmd =>
171 subcmd.setName('subjects').setDescription('Set or edit the subjects you\'re interested in your studies or you feel you are expert of')
172 .addStringOption(option => option.setName('subjects').setDescription("The subjects, must be less than 2000 in length!"))
173 .addBooleanOption(option => option.setName('remove').setDescription("If true, the bot will remove your subjects information. Default is false"))
174 )
175 .addSubcommand(subcmd =>
176 subcmd.setName('bio').setDescription('Set or edit your bio')
177 .addStringOption(option => option.setName('bio').setDescription("The bio, must be less than 2000 in length!"))
178 .addBooleanOption(option => option.setName('remove').setDescription("If true, the bot will remove your bio. Default is false"))
179 )
180 .addSubcommand(subcmd =>
181 subcmd.setName('hobbies').setDescription('Set or edit your hobbes')
182 .addStringOption(option => option.setName('hobbies').setDescription("Your hobbies, must be less than 1000 in length!"))
183 .addBooleanOption(option => option.setName('remove').setDescription("If true, the bot will remove your hobby information. Default is false"))
184 )
185 .addSubcommand(subcmd =>
186 subcmd.setName('languages').setDescription('Set or edit your languages that you speak')
187 .addStringOption(option => option.setName('languages').setDescription("Your languages, must be less than 1000 in length!"))
188 .addBooleanOption(option => option.setName('remove').setDescription("If true, the bot will remove your language information. Default is false"))
189 ),
190
191 new SlashCommandBuilder().setName('stats').setDescription('Show the server statistics'),
192 new SlashCommandBuilder().setName('lookup').setDescription('Lookup something')
193 .addSubcommand(subcommand => subcommand.setName("user").setDescription("User lookup")
194 .addUserOption(option => option.setName("user").setDescription("The user to search").setRequired(true))
195 )
196 .addSubcommand(subcommand => subcommand.setName("guild").setDescription("Server/Guild lookup")
197 .addStringOption(option => option.setName("guild_id").setDescription("The ID of the server/guild to lookup").setRequired(true))
198 )
199 .addSubcommand(subcommand => subcommand.setName("avatar").setDescription("Avatar lookup using Google Image Search")
200 .addUserOption(option => option.setName("user").setDescription("The user to lookup").setRequired(true))
201 ),
202
203 new SlashCommandBuilder().setName('profile').setDescription('Show someone\'s profile')
204 .addUserOption(option => option.setName('user').setDescription('The user')),
205 new SlashCommandBuilder().setName('avatar').setDescription('Show someone\'s avatar')
206 .addUserOption(option => option.setName('user').setDescription('The user')),
207 new SlashCommandBuilder().setName('rolelist').setDescription('List all roles or show info about a role')
208 .addRoleOption(option => option.setName('role').setDescription('The role'))
209 .addStringOption(option =>
210 option
211 .setName('order')
212 .setDescription('Order style of the list (according to the role positions)')
213 .setChoices({
214 name: "Ascending",
215 value: "a"
216 }, {
217 name: "Descending",
218 value: "d"
219 })
220 ),
221
222 new SlashCommandBuilder().setName('spotify').setDescription('Shows your or someone else\'s current Spotify listening activity')
223 .addUserOption(option => option.setName('member').setDescription("Show someone else's activity")),
224
225 // AUTOMATION
226 new SlashCommandBuilder().setName('remind').setDescription('Let the system remind you something after a certain amount of time')
227 .addStringOption(option => option.setName("time").setDescription("Enter the time interval. For example, \"1 day\" or \"4h 45m\".").setRequired(true))
228 .addStringOption(option => option.setName("description").setDescription("Enter what should the system remind you.").setRequired(true)),
229
230 new SlashCommandBuilder().setName('ballot').setDescription('Ballot engine')
231 .addSubcommand(subcommand =>
232 subcommand
233 .setName('create')
234 .setDescription('Send a ballot/poll message for collecting votes')
235 .addStringOption(option => option.setName('content').setDescription('Message content').setRequired(true))
236 .addBooleanOption(option => option.setName('anonymous').setDescription('If this is set to true then the syetem won\'t show your username'))
237 .addChannelOption(option => option.setName('channel').setDescription('The channel where the message should be sent')))
238 .addSubcommand(subcommand =>
239 subcommand
240 .setName('view')
241 .setDescription('Get information/stats about a ballot')
242 .addStringOption(option => option.setName('id').setDescription('The ballot ID'))),
243
244 new SlashCommandBuilder().setName('embed').setDescription('Make an embed')
245 .addSubcommand(subcmd =>
246 subcmd.setName("send").setDescription("Make and send an embed")
247 .addStringOption(option => option.setName('author_name').setDescription('The embed author name'))
248 .addStringOption(option => option.setName('author_iconurl').setDescription('The embed author icon URL'))
249 .addStringOption(option => option.setName('title').setDescription('The embed title'))
250 .addStringOption(option => option.setName('description').setDescription('The embed description'))
251 .addStringOption(option => option.setName('thumbnail').setDescription('The embed thumbnail URL'))
252 .addStringOption(option => option.setName('image').setDescription('The embed image attachment URL'))
253 .addStringOption(option => option.setName('video').setDescription('The embed video attachment URL'))
254 .addStringOption(option => option.setName('footer_text').setDescription('The embed footer text'))
255 .addStringOption(option => option.setName('footer_iconurl').setDescription('The embed footer icon URL'))
256 .addStringOption(option => option.setName('timestamp').setDescription('The embed timestamp, use \'current\' to set current date'))
257 .addStringOption(option => option.setName('color').setDescription('The embed color (default is #007bff)'))
258 .addStringOption(option => option.setName('url').setDescription('The embed URL'))
259 .addStringOption(option => option.setName('fields').setDescription('The embed fields, should be in `Field 1: Value 1, Field 2: Value 2` format'))
260 )
261 .addSubcommand(subcmd =>
262 subcmd.setName("schema").setDescription("Make and send an embed schema representation")
263 .addStringOption(option => option.setName('author_name').setDescription('The embed author name'))
264 .addStringOption(option => option.setName('author_iconurl').setDescription('The embed author icon URL'))
265 .addStringOption(option => option.setName('title').setDescription('The embed title'))
266 .addStringOption(option => option.setName('description').setDescription('The embed description'))
267 .addStringOption(option => option.setName('thumbnail').setDescription('The embed thumbnail URL'))
268 .addStringOption(option => option.setName('image').setDescription('The embed image attachment URL'))
269 .addStringOption(option => option.setName('video').setDescription('The embed video attachment URL'))
270 .addStringOption(option => option.setName('footer_text').setDescription('The embed footer text'))
271 .addStringOption(option => option.setName('footer_iconurl').setDescription('The embed footer icon URL'))
272 .addStringOption(option => option.setName('timestamp').setDescription('The embed timestamp, use \'current\' to set current date'))
273 .addStringOption(option => option.setName('color').setDescription('The embed color (default is #007bff)'))
274 .addStringOption(option => option.setName('url').setDescription('The embed URL'))
275 .addStringOption(option => option.setName('fields').setDescription('The embed fields, should be in `Field 1: Value 1, Field 2: Value 2` format'))
276 )
277 .addSubcommand(subcmd =>
278 subcmd.setName("build").setDescription("Build an embed from schema")
279 .addStringOption(option => option.setName('json_schema').setDescription('The embed JSON schema'))
280 ),
281
282 new SlashCommandBuilder().setName('buttonrole').setDescription('Button role management')
283 .addSubcommand(subcmd =>
284 subcmd.setName("create").setDescription("Create a new button role provider message")
285 )
286 .addSubcommand(subcmd =>
287 subcmd.setName("delete").setDescription("Delete button role provider message information")
288 .addStringOption(option => option.setName('message_id').setDescription("The message ID to delete").setRequired(true))
289 ),
290
291 new SlashCommandBuilder().setName('queues').setDescription('List all queued jobs'),
292
293 new SlashCommandBuilder().setName('schedule').setDescription('Schedule a message for sending later')
294 .addStringOption(option => option.setName('time').setDescription('The time interval').setRequired(true))
295 .addStringOption(option => option.setName('content').setDescription('Message content').setRequired(true))
296 .addChannelOption(option => option.setName('channel').setDescription('The channel where the message should be sent')),
297
298 new SlashCommandBuilder().setName('expire').setDescription('Expire (delete) a message after a certain amount of time')
299 .addStringOption(option => option.setName('time').setDescription('The time interval').setRequired(true))
300 .addStringOption(option => option.setName('content').setDescription('Message content').setRequired(true))
301 .addChannelOption(option => option.setName('channel').setDescription('The channel where the message should be sent')),
302
303 new SlashCommandBuilder().setName('expiresc').setDescription('Schedule and expire (delete) a message after a certain amount of time')
304 .addStringOption(option => option.setName('send-after').setDescription('The time after the message should be sent').setRequired(true))
305 .addStringOption(option => option.setName('delete-after').setDescription('The time after the message should be deleted').setRequired(true)) // (the system will start counting this after the message gets sent)
306 .addStringOption(option => option.setName('content').setDescription('Message content').setRequired(true))
307 .addChannelOption(option => option.setName('channel').setDescription('The channel where the message should be sent')),
308
309 // FUN
310 new SlashCommandBuilder().setName('cat').setDescription('Fetch a random kitty image'),
311
312 new SlashCommandBuilder().setName('dog').setDescription('Fetch a random doggy image'),
313
314 new SlashCommandBuilder().setName('joke').setDescription('Fetch a random joke from the Joke API'),
315
316 new SlashCommandBuilder().setName('httpcat').setDescription('Fetch a funny cat meme associated with an HTTP status code')
317 .addIntegerOption(option => option.setName('status').setDescription('The HTTP status Code').setRequired(true).setMinValue(100).setMaxValue(599)),
318
319 new SlashCommandBuilder().setName('httpdog').setDescription('Fetch a funny dog meme associated with an HTTP status code')
320 .addIntegerOption(option => option.setName('status').setDescription('The HTTP status Code').setRequired(true).setMinValue(100).setMaxValue(599)),
321
322 new SlashCommandBuilder().setName('pixabay').setDescription('Search & fetch images from the Pixabay API')
323 .addSubcommand(subcommand =>
324 subcommand
325 .setName('image')
326 .setDescription('Get any type of image')
327 .addStringOption(option => option.setName('query').setDescription('Search query')))
328 .addSubcommand(subcommand =>
329 subcommand
330 .setName('photo')
331 .setDescription('Get photos')
332 .addStringOption(option => option.setName('query').setDescription('Search query')))
333 .addSubcommand(subcommand =>
334 subcommand
335 .setName('illustration')
336 .setDescription('Get illustrations')
337 .addStringOption(option => option.setName('query').setDescription('Search query')))
338 .addSubcommand(subcommand =>
339 subcommand
340 .setName('vector')
341 .setDescription('Get vectors')
342 .addStringOption(option => option.setName('query').setDescription('Search query'))),
343
344 // UTILS
345 new SlashCommandBuilder().setName('translate').setDescription('Translates the input text. Powered by Google Translate.')
346 .addStringOption(option => option.setName('text').setDescription("The text to translate").setRequired(true))
347 .addStringOption(option => option.setName("from").setDescription("Specify the language of the input text, defaults to automatic detection.").setAutocomplete(true))
348 .addStringOption(option => option.setName("to").setDescription("Specify the language to translate the input text, defaults to English.").setAutocomplete(true))
349 .addBooleanOption(option => option.setName("ephemeral").setDescription("Specify if the response should be ephemeral or not, defaults to false.")),
350
351 new SlashCommandBuilder().setName('snippet').setDescription('Snippets are instant custom messages')
352 .addSubcommand(subcommand =>
353 subcommand
354 .setName('get')
355 .setDescription('Get a snippet')
356 .addStringOption(option => option.setName('name').setDescription('The snippet name').setRequired(true)))
357 .addSubcommand(subcommand =>
358 subcommand
359 .setName('create')
360 .setDescription('Create a snippet')
361 .addStringOption(option => option.setName('name').setDescription('The snippet name').setRequired(true))
362 .addStringOption(option => option.setName('content').setDescription('Snippet message content').setRequired(true))
363 .addAttachmentOption(option => option.setName('file').setDescription('Snippet message file')))
364 .addSubcommand(subcommand =>
365 subcommand
366 .setName('rename')
367 .setDescription('Rename a snippet')
368 .addStringOption(option => option.setName('old-name').setDescription('The old snippet name').setRequired(true))
369 .addStringOption(option => option.setName('new-name').setDescription('The new name').setRequired(true)))
370 .addSubcommand(subcommand =>
371 subcommand
372 .setName('delete')
373 .setDescription('Delete a snippet')
374 .addStringOption(option => option.setName('name').setDescription('The snippet name').setRequired(true))),
375
376 new SlashCommandBuilder().setName('afk').setDescription('Set your AFK status')
377 .addStringOption(option => option.setName('reason').setDescription("The reason for going AFK")),
378
379 new SlashCommandBuilder().setName('confess').setDescription('Confess something')
380 .addStringOption(option => option.setName('description').setDescription("Confession description...").setRequired(true))
381 .addBooleanOption(option => option.setName('anonymous').setDescription("Specify if the confession should be anonymous or not, default is True")),
382
383 new SlashCommandBuilder().setName('private').setDescription('Create a private channel for specific members')
384 .addUserOption(option => option.setName('member').setDescription("The member to add in the private channel").setRequired(true))
385 .addChannelOption(option => option.setName('category').setDescription("Create channel in the specified category")),
386
387 new SlashCommandBuilder().setName('hash').setDescription('Generate hash for a string (text) data')
388 .addStringOption(option => option.setName('content').setDescription("The content to be hashed").setRequired(true))
389 .addStringOption(option =>
390 option
391 .setName('algorithm')
392 .setDescription("Hash algorithm")
393 .setChoices(
394 {
395 name: 'SHA1',
396 value: 'sha1'
397 },
398 {
399 name: 'SHA256',
400 value: 'sha256'
401 },
402 {
403 name: 'SHA512',
404 value: 'sha512'
405 },
406 {
407 name: 'MD5',
408 value: 'md5'
409 },
410 )
411 )
412 .addStringOption(option =>
413 option
414 .setName('digest')
415 .setDescription("Digest mode")
416 .setChoices(
417 {
418 name: 'HEX',
419 value: 'hex'
420 },
421 {
422 name: 'Base64',
423 value: 'base64'
424 },
425 {
426 name: 'Base64 URL',
427 value: 'base64url'
428 },
429 )
430 ),
431
432 new SlashCommandBuilder().setName('announce').setDescription('Announce something')
433 .addStringOption(option => option.setName('content').setDescription("The announcemnt message content")),
434
435 // MODERATION
436 new SlashCommandBuilder().setName('antijoin').setDescription('Enable antijoin system which will kick any new users joining the server'),
437
438 new SlashCommandBuilder().setName('ban').setDescription('Ban a user')
439 .addUserOption(option => option.setName('user').setDescription("The user").setRequired(true))
440 .addStringOption(option => option.setName('reason').setDescription("The reason for banning this user"))
441 .addIntegerOption(option => option.setName('days').setDescription("The days old messages to delete of this user").setMinValue(0).setMaxValue(7)),
442
443 new SlashCommandBuilder().setName('softban').setDescription('Softban a user')
444 .addUserOption(option => option.setName('user').setDescription("The user").setRequired(true))
445 .addStringOption(option => option.setName('reason').setDescription("The reason for softbanning this user"))
446 .addIntegerOption(option => option.setName('days').setDescription("The days old messages to delete of this user (default is 7)").setMinValue(0).setMaxValue(7)),
447
448 new SlashCommandBuilder().setName('tempban').setDescription('Temporarily ban a user')
449 .addUserOption(option => option.setName('user').setDescription("The user").setRequired(true))
450 .addStringOption(option => option.setName('time').setDescription("TBan duration").setRequired(true))
451 .addStringOption(option => option.setName('reason').setDescription("The reason for softbanning this user"))
452 .addIntegerOption(option => option.setName('days').setDescription("The days old messages to delete of this user (default is 7)").setMinValue(0).setMaxValue(7)),
453
454 new SlashCommandBuilder().setName('massban').setDescription('Ban multiple users')
455 .addStringOption(option => option.setName('users').setDescription("The user IDs (separated by spaces)").setRequired(true))
456 .addStringOption(option => option.setName('reason').setDescription("The reason for banning"))
457 .addIntegerOption(option => option.setName('days').setDescription("The days old messages to delete of these users").setMinValue(0).setMaxValue(7)),
458
459 new SlashCommandBuilder().setName('kick').setDescription('Kick a member')
460 .addUserOption(option => option.setName('member').setDescription("The member").setRequired(true))
461 .addStringOption(option => option.setName('reason').setDescription("The reason for kicking this user")),
462
463 new SlashCommandBuilder().setName('shot').setDescription('Give a shot to a member')
464 .addUserOption(option => option.setName('member').setDescription("The member").setRequired(true))
465 .addStringOption(option => option.setName('reason').setDescription("The reason for giving shot to this user"))
466 .addBooleanOption(option => option.setName('anonymous').setDescription("Prevents sending your name as the 'Doctor' of the shot")),
467
468 new SlashCommandBuilder().setName('bean').setDescription('Beans a member')
469 .addUserOption(option => option.setName('member').setDescription("The member").setRequired(true))
470 .addStringOption(option => option.setName('reason').setDescription("The reason for giving shot to this user")),
471
472 new SlashCommandBuilder().setName('warn').setDescription('Warn a member')
473 .addUserOption(option => option.setName('member').setDescription("The member").setRequired(true))
474 .addStringOption(option => option.setName('reason').setDescription("The reason for warning this user")),
475
476 new SlashCommandBuilder().setName('note').setDescription('Take a note for a user')
477 .addUserOption(option => option.setName('user').setDescription("The user").setRequired(true))
478 .addStringOption(option => option.setName('note').setDescription("The note content").setRequired(true)),
479
480 new SlashCommandBuilder().setName('mute').setDescription('Mute a member')
481 .addUserOption(option => option.setName('member').setDescription("The member").setRequired(true))
482 .addStringOption(option => option.setName('reason').setDescription("The reason for muting this user"))
483 .addStringOption(option => option.setName('time').setDescription("Mute duration"))
484 .addBooleanOption(option => option.setName('hardmute').setDescription("Specify if the system should take out all roles of the user during the mute")),
485
486 new SlashCommandBuilder().setName('unmute').setDescription('Unmute a member')
487 .addUserOption(option => option.setName('member').setDescription("The member").setRequired(true)),
488
489 new SlashCommandBuilder().setName('unban').setDescription('Unban a user')
490 .addUserOption(option => option.setName('user').setDescription("The user").setRequired(true)),
491
492 new SlashCommandBuilder().setName('warning').setDescription('Clear, remove or view warnings')
493 .addSubcommand(subcmd => {
494 return subcmd.setName('view').setDescription('View information about a warning').addStringOption(option => option.setName('id').setDescription("The warning ID").setRequired(true));
495 })
496 .addSubcommand(subcmd => {
497 return subcmd.setName('remove').setDescription('Remove a warning').addStringOption(option => option.setName('id').setDescription("The warning ID").setRequired(true));
498 })
499 .addSubcommand(subcmd => {
500 return subcmd.setName('list').setDescription('List warnings for a user').addUserOption(option => option.setName('user').setDescription("The user").setRequired(true));
501 })
502 .addSubcommand(subcmd => {
503 return subcmd.setName('clear').setDescription('Clear all warnings for a user').addUserOption(option => option.setName('user').setDescription("The user").setRequired(true));
504 }),
505
506 new SlashCommandBuilder().setName('dmhistory').setDescription('Get your full infraction list via DMs'),
507 new SlashCommandBuilder().setName('sendhistory').setDescription('Get someone\'s full infraction list')
508 .addUserOption(option => option.setName("user").setDescription("The user").setRequired(true))
509 .addBooleanOption(option => option.setName("send_dm").setDescription("If true, the system will send a DM to the user with the infraction history")),
510
511 new SlashCommandBuilder().setName('noteget').setDescription('Get information about a note')
512 .addNumberOption(option => option.setName('id').setDescription("The note ID").setRequired(true)),
513
514 new SlashCommandBuilder().setName('notedel').setDescription('Delete a note')
515 .addNumberOption(option => option.setName('id').setDescription("The note ID").setRequired(true)),
516
517 new SlashCommandBuilder().setName('infraction').setDescription('Manage infractions')
518 .addSubcommand(subcommand =>
519 subcommand.setName('view').setDescription("View information about an infraction")
520 .addIntegerOption(option => option.setName('id').setDescription("The infraction ID").setRequired(true))
521 )
522 .addSubcommand(subcommand =>
523 subcommand.setName('reasonupdate').setDescription("Update reason of an infraction")
524 .addIntegerOption(option => option.setName('id').setDescription("The infraction ID").setRequired(true))
525 .addStringOption(option => option.setName('reason').setDescription("New reason to set").setRequired(true))
526 .addBooleanOption(option => option.setName('silent').setDescription("Specify if the bot should not let the user know about this"))
527 )
528 .addSubcommand(subcommand =>
529 subcommand.setName('delete').setDescription("Delete an infraction")
530 .addIntegerOption(option => option.setName('id').setDescription("The infraction ID").setRequired(true))
531 )
532 .addSubcommand(subcommand =>
533 subcommand.setName('clear').setDescription("Clear infractions for a user")
534 .addUserOption(option => option.setName('user').setDescription("The target user").setRequired(true))
535 .addStringOption(option => option.setName('type').setDescription("Specify infraction type").setChoices(
536 ...['Ban', "Mute", "Hardmute", "Kick", "Warning", "Softban", "Tempban", "Unmute", "Unban", "Timeout", "Timeout Remove", "Bean", "Shot"].map(option => ({ name: option, value: option.toLowerCase().replace(' ', '_') }))
537 ))
538 )
539 .addSubcommand(subcommand =>
540 subcommand.setName('create').setDescription("Add infractions to a user")
541 .addUserOption(option => option.setName('user').setDescription("The target user").setRequired(true))
542 .addStringOption(option => option.setName('type').setDescription("Specify infraction type").setChoices(
543 ...['Ban', "Mute", "Hardmute", "Kick", "Warning", "Softban", "Tempban", "Unmute", "Unban", "Timeout", "Timeout Remove", "Bean", "Shot"].map(option => ({ name: option, value: option.toLowerCase().replace(' ', '_') }))
544 ).setRequired(true))
545 .addStringOption(option => option.setName('reason').setDescription("The reason for giving this infraction"))
546 ),
547
548 new SlashCommandBuilder().setName('notes').setDescription('Fetch all notes for a user')
549 .addUserOption(option => option.setName('user').setDescription("The user").setRequired(true)),
550
551 new SlashCommandBuilder().setName('history').setDescription('Fetch all moderation history for a user')
552 .addUserOption(option => option.setName('user').setDescription("The user").setRequired(true))
553 .addBooleanOption(option => option.setName('verbose').setDescription('Specify if the bot should return information in verbose mode (default: true)')),
554
555 new SlashCommandBuilder().setName('reply').setDescription('Reply to someone\'s message')
556 .addStringOption(option => option.setName('message_id').setDescription("The message ID").setRequired(true))
557 .addStringOption(option => option.setName('content').setDescription("The message content").setRequired(true))
558 .addChannelOption(option => option.setName('channel').setDescription("The channel where the bot should make reply, defaults to current channel").setRequired(false)),
559
560 new SlashCommandBuilder().setName('clear').setDescription('Clear messages in bulk')
561 .addUserOption(option => option.setName('user').setDescription("The user"))
562 .addIntegerOption(option => option.setName('count').setDescription("The amount of messages to delete").setMaxValue(100).setMinValue(2))
563 .addChannelOption(option => option.setName('channel').setDescription("The channel where the messages will be deleted")),
564
565 new SlashCommandBuilder().setName('echo').setDescription('Re-send a message from the bot system')
566 .addStringOption(option => option.setName('content').setDescription("The message content").setRequired(true))
567 .addChannelOption(option => option.setName('channel').setDescription("The channel where the message should be sent")),
568
569 new SlashCommandBuilder().setName('lock').setDescription('Lock a channel')
570 .addRoleOption(option => option.setName('role').setDescription("Lock channel for the given role. Default is @everyone"))
571 .addChannelOption(option => option.setName('channel').setDescription("The channel that will be locked. Default is the current channel")),
572
573 new SlashCommandBuilder().setName('setchperms').setDescription('Set permissions for channels')
574 .addChannelOption(option => option.setName('channel').setDescription("The channel that (or its children) will be updated").setRequired(true))
575 .addRoleOption(option => option.setName('role').setDescription("Lock channel for the given role.").setRequired(true))
576 .addStringOption(option => option.setName('permission').setDescription("The permission codename").setRequired(true).setAutocomplete(true))
577 .addStringOption(option => option.setName('value').setDescription("The permission value").addChoices(...[
578 {
579 name: 'Allow',
580 value: 'true'
581 },
582 {
583 name: 'Deny',
584 value: 'false',
585 },
586 {
587 name: 'Default',
588 value: 'null',
589 }
590 ]).setRequired(true)),
591
592 new SlashCommandBuilder().setName('lockall').setDescription('Lock multiple channels')
593 .addStringOption(option => option.setName('channels').setDescription("The channels, must be separated by spaces"))
594 .addRoleOption(option => option.setName('role').setDescription("Lock channels for the given role. Default is @everyone"))
595 .addBooleanOption(option => option.setName('raid').setDescription("The raid protected channels will be locked. Default is `false`")),
596
597 new SlashCommandBuilder().setName('unlockall').setDescription('Unlock multiple channels')
598 .addStringOption(option => option.setName('channels').setDescription("The channels, must be separated by spaces"))
599 .addRoleOption(option => option.setName('role').setDescription("Unlock channels for the given role. Default is @everyone"))
600 .addBooleanOption(option => option.setName('force').setDescription("Force set the channel permissions to `true`"))
601 .addBooleanOption(option => option.setName('raid').setDescription("The raid protected channels will be unlocked. Default is `false`")),
602
603 new SlashCommandBuilder().setName('unlock').setDescription('Unlock a channel')
604 .addRoleOption(option => option.setName('role').setDescription("Unlock channel for the given role. Default is @everyone"))
605 .addBooleanOption(option => option.setName('force').setDescription("Force set the channel permission to `true`"))
606 .addChannelOption(option => option.setName('channel').setDescription("The channel that will be unlocked. Default is the current channel")),
607
608 new SlashCommandBuilder().setName('send').setDescription('Send a DM to a user')
609 .addStringOption(option => option.setName('content').setDescription("The message content").setRequired(true))
610 .addUserOption(option => option.setName('member').setDescription("The member").setRequired(true)),
611
612
613 new SlashCommandBuilder().setName('appeal').setDescription('Send us a messages about a punishment appeal')
614 ].map(command => command.toJSON());
615
616 let contextMenuCommands = [
617 new ContextMenuCommandBuilder().setName('Moderation History').setType(ApplicationCommandType.User),
618 new ContextMenuCommandBuilder().setName('Ban').setType(ApplicationCommandType.User),
619 new ContextMenuCommandBuilder().setName('Shot').setType(ApplicationCommandType.User),
620 new ContextMenuCommandBuilder().setName('Kick').setType(ApplicationCommandType.User),
621 new ContextMenuCommandBuilder().setName('Save Message').setType(ApplicationCommandType.Message),
622 new ContextMenuCommandBuilder().setName('Send Reply').setType(ApplicationCommandType.Message),
623 new ContextMenuCommandBuilder().setName('Report Message').setType(ApplicationCommandType.Message),
624 new ContextMenuCommandBuilder().setName('Translate to English').setType(ApplicationCommandType.Message),
625 ].map(command => command.toJSON());
626
627 commands = commands.concat(contextMenuCommands);
628
629 if (process.argv.includes('--clear')) {
630 commands = [];
631 contextMenuCommands = [];
632 }
633
634 const rest = new REST({ version: '9' }).setToken(TOKEN);
635
636 rest.put(Routes[process.argv.includes('--guild') ? 'applicationGuildCommands' : 'applicationCommands'](CLIENT_ID, GUILD_ID), { body: commands })
637 .then(() => console.log('Successfully registered application ' + (process.argv.includes('--guild') ? 'guild ' : '') + 'commands.'))
638 .catch(console.error);

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26