/[sudobot]/trunk/deploy-commands.js
ViewVC logotype

Diff of /trunk/deploy-commands.js

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

trunk/deploy-commands.ts revision 51 by rakin, Mon Jul 29 17:28:23 2024 UTC trunk/deploy-commands.js revision 398 by rakin, Mon Jul 29 17:30:02 2024 UTC
# Line 1  Line 1 
1  #!/bin/ts-node  #!/bin/node
2    
3  import { SlashCommandBuilder } from '@discordjs/builders';  /**
4  import { REST } from '@discordjs/rest';  * This file is part of SudoBot.
5  import { Routes } from 'discord-api-types/v9';  *
6  import { config } from 'dotenv';  * Copyright (C) 2021-2022 OSN Inc.
7  import { existsSync } from 'fs';  *
8  import path from 'path';  * 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 { Permissions, ApplicationCommand } = require('discord.js');
28    const path = require('path');
29    const { ActivityType, ApplicationCommandType } = require('discord-api-types/v10');
30    
31  if (existsSync(path.join(__dirname, '.env'))) {  if (existsSync(path.join(__dirname, '.env'))) {
32      config();      config();
# Line 16  else { Line 37  else {
37    
38  const { CLIENT_ID, GUILD_ID, TOKEN } = process.env;  const { CLIENT_ID, GUILD_ID, TOKEN } = process.env;
39    
40  const commands = [  let commands = [
41      new SlashCommandBuilder().setName('about').setDescription('Show information about the bot'),      // SETTINGS
     new SlashCommandBuilder().setName('test').setDescription('Test command'),  
     new SlashCommandBuilder().setName('system').setDescription('Show the system status'),  
   
     // ABOUT  
42      new SlashCommandBuilder().setName('help').setDescription('A short documentation about the commands')      new SlashCommandBuilder().setName('help').setDescription('A short documentation about the commands')
43          .addStringOption(option => option.setName('command').setDescription("The command")),          .addStringOption(option => option.setName('command').setDescription("The command")),
44        new SlashCommandBuilder().setName('about').setDescription('Show information about the bot'),
45        new SlashCommandBuilder().setName('eval').setDescription('Execute raw code in the runtime environment')
46            .addStringOption(option => option.setName('code').setDescription('The code to be executed').setRequired(true)),
47        new SlashCommandBuilder().setName('system').setDescription('Show the system status'),
48        new SlashCommandBuilder().setName('restart').setDescription('Restart the system'),
49        new SlashCommandBuilder().setName('setstatus').setDescription('Set status for the bot system')
50            .addStringOption(option => option.setName('activity').setDescription('The activity').setRequired(true))
51            .addStringOption(option => option.setName('status').setDescription('The status').setChoices(...[
52                {
53                    name: 'Online',
54                    value: 'online'
55                },
56                {
57                    name: 'Idle',
58                    value: 'idle'
59                },
60                {
61                    name: 'DND',
62                    value: 'dnd'
63                },
64                {
65                    name: 'Invisible',
66                    value: 'invisible'
67                }
68            ]))
69            .addStringOption(option => option.setName('type').setDescription('The activity type').setChoices(...[
70                {
71                    name: 'Playing',
72                    value: 'PLAYING'
73                },
74                {
75                    name: 'Watching',
76                    value: 'WATCHING'
77                },
78                {
79                    name: 'Competing',
80                    value: 'COMPETING'
81                }
82            ])),
83        new SlashCommandBuilder().setName('config').setDescription('View/change the system settings for this server')
84            .addStringOption(option => option.setName('key').setDescription('The setting key (e.g. spam_filter.enabled)').setRequired(true).setAutocomplete(true))
85            .addStringOption(option => option.setName('value').setDescription('New value for the setting')),
86    
87      // INFORMATION      // INFORMATION
88      new SlashCommandBuilder().setName('stats').setDescription('Show the server statistics'),      new SlashCommandBuilder().setName('stats').setDescription('Show the server statistics'),
89        new SlashCommandBuilder().setName('lookup').setDescription('Lookup something')
90            .addSubcommand(subcommand => subcommand.setName("user").setDescription("User lookup")
91                .addUserOption(option => option.setName("user").setDescription("The user to search").setRequired(true))
92                )
93                .addSubcommand(subcommand => subcommand.setName("guild").setDescription("Server/Guild lookup")
94                    .addStringOption(option => option.setName("guild_id").setDescription("The ID of the server/guild to lookup").setRequired(true))
95                )
96                .addSubcommand(subcommand => subcommand.setName("avatar").setDescription("Avatar lookup using Google Image Search")
97                    .addUserOption(option => option.setName("user").setDescription("The user to lookup").setRequired(true))
98                ),
99    
100        new SlashCommandBuilder().setName('profile').setDescription('Show someone\'s profile')
101            .addUserOption(option => option.setName('user').setDescription('The user')),
102        new SlashCommandBuilder().setName('avatar').setDescription('Show someone\'s avatar')
103            .addUserOption(option => option.setName('user').setDescription('The user')),
104        new SlashCommandBuilder().setName('rolelist').setDescription('List all roles or show info about a role')
105            .addRoleOption(option => option.setName('role').setDescription('The role'))
106            .addIntegerOption(option => option.setName('page').setDescription('The page number')),
107    
108      // AUTOMATION      // AUTOMATION
109        new SlashCommandBuilder().setName('ballot').setDescription('Ballot engine')
110            .addSubcommand(subcommand =>
111                subcommand
112                    .setName('create')
113                    .setDescription('Send a ballot/poll message for collecting votes')
114                    .addStringOption(option => option.setName('content').setDescription('Message content').setRequired(true))
115                    .addBooleanOption(option => option.setName('anonymous').setDescription('If this is set to true then the syetem won\'t show your username'))
116                    .addChannelOption(option => option.setName('channel').setDescription('The channel where the message should be sent')))
117            .addSubcommand(subcommand =>
118                subcommand
119                    .setName('view')
120                    .setDescription('Get information/stats about a ballot')
121                    .addStringOption(option => option.setName('id').setDescription('The ballot ID'))),
122            
123        new SlashCommandBuilder().setName('embed').setDescription('Make an embed')
124            .addSubcommand(subcmd =>
125                 subcmd.setName("send").setDescription("Make and send an embed")
126                    .addStringOption(option => option.setName('author_name').setDescription('The embed author name'))
127                    .addStringOption(option => option.setName('author_iconurl').setDescription('The embed author icon URL'))
128                    .addStringOption(option => option.setName('title').setDescription('The embed title'))
129                    .addStringOption(option => option.setName('description').setDescription('The embed description'))
130                    .addStringOption(option => option.setName('thumbnail').setDescription('The embed thumbnail URL'))
131                    .addStringOption(option => option.setName('image').setDescription('The embed image attachment URL'))
132                    .addStringOption(option => option.setName('video').setDescription('The embed video attachment URL'))
133                    .addStringOption(option => option.setName('footer_text').setDescription('The embed footer text'))
134                    .addStringOption(option => option.setName('footer_iconurl').setDescription('The embed footer icon URL'))
135                    .addStringOption(option => option.setName('timestamp').setDescription('The embed timestamp, use \'current\' to set current date'))
136                    .addStringOption(option => option.setName('color').setDescription('The embed color (default is #007bff)'))
137                    .addStringOption(option => option.setName('url').setDescription('The embed URL'))
138                    .addStringOption(option => option.setName('fields').setDescription('The embed fields, should be in `Field 1: Value 1, Field 2: Value 2` format'))
139            )
140            .addSubcommand(subcmd =>
141                 subcmd.setName("schema").setDescription("Make and send an embed schema representation")
142                    .addStringOption(option => option.setName('author_name').setDescription('The embed author name'))
143                    .addStringOption(option => option.setName('author_iconurl').setDescription('The embed author icon URL'))
144                    .addStringOption(option => option.setName('title').setDescription('The embed title'))
145                    .addStringOption(option => option.setName('description').setDescription('The embed description'))
146                    .addStringOption(option => option.setName('thumbnail').setDescription('The embed thumbnail URL'))
147                    .addStringOption(option => option.setName('image').setDescription('The embed image attachment URL'))
148                    .addStringOption(option => option.setName('video').setDescription('The embed video attachment URL'))
149                    .addStringOption(option => option.setName('footer_text').setDescription('The embed footer text'))
150                    .addStringOption(option => option.setName('footer_iconurl').setDescription('The embed footer icon URL'))
151                    .addStringOption(option => option.setName('timestamp').setDescription('The embed timestamp, use \'current\' to set current date'))
152                    .addStringOption(option => option.setName('color').setDescription('The embed color (default is #007bff)'))
153                    .addStringOption(option => option.setName('url').setDescription('The embed URL'))
154                    .addStringOption(option => option.setName('fields').setDescription('The embed fields, should be in `Field 1: Value 1, Field 2: Value 2` format'))
155            )
156            .addSubcommand(subcmd =>
157                 subcmd.setName("build").setDescription("Build an embed from schema")
158                    .addStringOption(option => option.setName('json_schema').setDescription('The embed JSON schema'))
159            ),
160    
161      new SlashCommandBuilder().setName('queues').setDescription('List all queued jobs'),      new SlashCommandBuilder().setName('queues').setDescription('List all queued jobs'),
162    
163      new SlashCommandBuilder().setName('schedule').setDescription('Schedule a message for sending later')      new SlashCommandBuilder().setName('schedule').setDescription('Schedule a message for sending later')
# Line 111  const commands = [ Line 240  const commands = [
240      new SlashCommandBuilder().setName('afk').setDescription('Set your AFK status')      new SlashCommandBuilder().setName('afk').setDescription('Set your AFK status')
241          .addStringOption(option => option.setName('reason').setDescription("The reason for going AFK")),          .addStringOption(option => option.setName('reason').setDescription("The reason for going AFK")),
242            
243        new SlashCommandBuilder().setName('hash').setDescription('Generate hash for a string (text) data')
244            .addStringOption(option => option.setName('content').setDescription("The content to be hashed").setRequired(true))
245            .addStringOption(option =>
246                option
247                .setName('algorithm')
248                .setDescription("Hash algorithm")
249                .setChoices(
250                    {
251                        name: 'SHA1',
252                        value: 'sha1'
253                    },
254                    {
255                        name: 'SHA256',
256                        value: 'sha256'
257                    },
258                    {
259                        name: 'SHA512',
260                        value: 'sha512'
261                    },
262                    {
263                        name: 'MD5',
264                        value: 'md5'
265                    },
266                )
267            )
268            .addStringOption(option =>
269                option
270                .setName('digest')
271                .setDescription("Digest mode")
272                .setChoices(
273                    {
274                        name: 'HEX',
275                        value: 'hex'
276                    },
277                    {
278                        name: 'Base64',
279                        value: 'base64'
280                    },
281                    {
282                        name: 'Base64 URL',
283                        value: 'base64url'
284                    },
285                )
286            ),
287        
288      new SlashCommandBuilder().setName('announce').setDescription('Announce something')      new SlashCommandBuilder().setName('announce').setDescription('Announce something')
289          .addStringOption(option => option.setName('content').setDescription("The announcemnt message content")),          .addStringOption(option => option.setName('content').setDescription("The announcemnt message content")),
290    
291      // MODERATION      // MODERATION
292        new SlashCommandBuilder().setName('antijoin').setDescription('Enable antijoin system which will kick any new users joining the server'),
293    
294      new SlashCommandBuilder().setName('ban').setDescription('Ban a user')      new SlashCommandBuilder().setName('ban').setDescription('Ban a user')
295          .addUserOption(option => option.setName('user').setDescription("The user").setRequired(true))          .addUserOption(option => option.setName('user').setDescription("The user").setRequired(true))
296          .addStringOption(option => option.setName('reason').setDescription("The reason for banning this user"))          .addStringOption(option => option.setName('reason').setDescription("The reason for banning this user"))
297          .addIntegerOption(option => option.setName('days').setDescription("The days old messages to delete of this user").setMinValue(0).setMaxValue(7)),          .addIntegerOption(option => option.setName('days').setDescription("The days old messages to delete of this user").setMinValue(0).setMaxValue(7)),
298    
299        new SlashCommandBuilder().setName('softban').setDescription('Softban a user')
300            .addUserOption(option => option.setName('user').setDescription("The user").setRequired(true))
301            .addStringOption(option => option.setName('reason').setDescription("The reason for softbanning this user"))
302            .addIntegerOption(option => option.setName('days').setDescription("The days old messages to delete of this user (default is 7)").setMinValue(0).setMaxValue(7)),
303    
304        new SlashCommandBuilder().setName('tempban').setDescription('Temporarily ban a user')
305            .addUserOption(option => option.setName('user').setDescription("The user").setRequired(true))
306            .addStringOption(option => option.setName('time').setDescription("TBan duration").setRequired(true))
307            .addStringOption(option => option.setName('reason').setDescription("The reason for softbanning this user"))
308            .addIntegerOption(option => option.setName('days').setDescription("The days old messages to delete of this user (default is 7)").setMinValue(0).setMaxValue(7)),
309    
310        new SlashCommandBuilder().setName('massban').setDescription('Ban multiple users')
311            .addStringOption(option => option.setName('users').setDescription("The user IDs (separated by spaces)").setRequired(true))
312            .addStringOption(option => option.setName('reason').setDescription("The reason for banning"))
313            .addIntegerOption(option => option.setName('days').setDescription("The days old messages to delete of these users").setMinValue(0).setMaxValue(7)),
314    
315      new SlashCommandBuilder().setName('kick').setDescription('Kick a member')      new SlashCommandBuilder().setName('kick').setDescription('Kick a member')
316          .addUserOption(option => option.setName('member').setDescription("The member").setRequired(true))          .addUserOption(option => option.setName('member').setDescription("The member").setRequired(true))
317          .addStringOption(option => option.setName('reason').setDescription("The reason for kicking this user")),          .addStringOption(option => option.setName('reason').setDescription("The reason for kicking this user")),
318    
319      new SlashCommandBuilder().setName('bean').setDescription('Bean a member')      new SlashCommandBuilder().setName('shot').setDescription('Give a shot to a member')
320          .addUserOption(option => option.setName('member').setDescription("The member").setRequired(true))          .addUserOption(option => option.setName('member').setDescription("The member").setRequired(true))
321          .addStringOption(option => option.setName('reason').setDescription("The reason for beaning this user")),          .addStringOption(option => option.setName('reason').setDescription("The reason for giving shot to this user"))
322            .addBooleanOption(option => option.setName('anonymous').setDescription("Prevents sending your name as the 'Doctor' of the shot")),
323    
324      new SlashCommandBuilder().setName('warn').setDescription('Warn a member')      new SlashCommandBuilder().setName('warn').setDescription('Warn a member')
325          .addUserOption(option => option.setName('member').setDescription("The member").setRequired(true))          .addUserOption(option => option.setName('member').setDescription("The member").setRequired(true))
326          .addStringOption(option => option.setName('reason').setDescription("The reason for warning this user")),          .addStringOption(option => option.setName('reason').setDescription("The reason for warning this user")),
327    
328      new SlashCommandBuilder().setName('note').setDescription('Take a note for a member')      new SlashCommandBuilder().setName('note').setDescription('Take a note for a user')
329          .addUserOption(option => option.setName('member').setDescription("The member").setRequired(true))          .addUserOption(option => option.setName('user').setDescription("The user").setRequired(true))
330          .addStringOption(option => option.setName('note').setDescription("The note content").setRequired(true)),          .addStringOption(option => option.setName('note').setDescription("The note content").setRequired(true)),
331    
332      new SlashCommandBuilder().setName('mute').setDescription('Mute a member')      new SlashCommandBuilder().setName('mute').setDescription('Mute a member')
333          .addUserOption(option => option.setName('member').setDescription("The member").setRequired(true))          .addUserOption(option => option.setName('member').setDescription("The member").setRequired(true))
334          .addStringOption(option => option.setName('reason').setDescription("The reason for muting this user"))          .addStringOption(option => option.setName('reason').setDescription("The reason for muting this user"))
335          .addStringOption(option => option.setName('time').setDescription("Mute duration")),          .addStringOption(option => option.setName('time').setDescription("Mute duration"))
336            .addBooleanOption(option => option.setName('hardmute').setDescription("Specify if the system should take out all roles of the user during the mute")),
337    
338      new SlashCommandBuilder().setName('unmute').setDescription('Unmute a member')      new SlashCommandBuilder().setName('unmute').setDescription('Unmute a member')
339          .addUserOption(option => option.setName('member').setDescription("The member").setRequired(true)),          .addUserOption(option => option.setName('member').setDescription("The member").setRequired(true)),
# Line 147  const commands = [ Line 341  const commands = [
341      new SlashCommandBuilder().setName('unban').setDescription('Unban a user')      new SlashCommandBuilder().setName('unban').setDescription('Unban a user')
342          .addUserOption(option => option.setName('user').setDescription("The user").setRequired(true)),          .addUserOption(option => option.setName('user').setDescription("The user").setRequired(true)),
343    
344      new SlashCommandBuilder().setName('warndel').setDescription('Delete a warning')      new SlashCommandBuilder().setName('warning').setDescription('Clear, remove or view warnings')
345          .addNumberOption(option => option.setName('id').setDescription("The warning ID").setRequired(true)),          .addSubcommand(subcmd => {
346                return subcmd.setName('view').setDescription('View information about a warning').addStringOption(option => option.setName('id').setDescription("The warning ID").setRequired(true));
347      new SlashCommandBuilder().setName('warning').setDescription('Get information about a warning')          })
348          .addNumberOption(option => option.setName('id').setDescription("The warning ID").setRequired(true)),          .addSubcommand(subcmd => {
349                return subcmd.setName('remove').setDescription('Remove a warning').addStringOption(option => option.setName('id').setDescription("The warning ID").setRequired(true));
350            })
351            .addSubcommand(subcmd => {
352                return subcmd.setName('list').setDescription('List warnings for a user').addUserOption(option => option.setName('user').setDescription("The user").setRequired(true));
353            })
354            .addSubcommand(subcmd => {
355                return subcmd.setName('clear').setDescription('Clear all warnings for a user').addUserOption(option => option.setName('user').setDescription("The user").setRequired(true));
356            }),
357    
358      new SlashCommandBuilder().setName('noteget').setDescription('Get information about a note')      new SlashCommandBuilder().setName('noteget').setDescription('Get information about a note')
359          .addNumberOption(option => option.setName('id').setDescription("The note ID").setRequired(true)),          .addNumberOption(option => option.setName('id').setDescription("The note ID").setRequired(true)),
# Line 159  const commands = [ Line 361  const commands = [
361      new SlashCommandBuilder().setName('notedel').setDescription('Delete a note')      new SlashCommandBuilder().setName('notedel').setDescription('Delete a note')
362          .addNumberOption(option => option.setName('id').setDescription("The note ID").setRequired(true)),          .addNumberOption(option => option.setName('id').setDescription("The note ID").setRequired(true)),
363    
     new SlashCommandBuilder().setName('warnings').setDescription('Fetch all warnings')  
         .addUserOption(option => option.setName('member').setDescription("Show warnings for only this member")),  
   
364      new SlashCommandBuilder().setName('notes').setDescription('Fetch all notes for a user')      new SlashCommandBuilder().setName('notes').setDescription('Fetch all notes for a user')
365          .addUserOption(option => option.setName('member').setDescription("The member").setRequired(true)),          .addUserOption(option => option.setName('user').setDescription("The user").setRequired(true)),
366    
367      new SlashCommandBuilder().setName('history').setDescription('Fetch all moderation history for a user')      new SlashCommandBuilder().setName('history').setDescription('Fetch all moderation history for a user')
368          .addUserOption(option => option.setName('user').setDescription("The user").setRequired(true)),          .addUserOption(option => option.setName('user').setDescription("The user").setRequired(true)),
369    
370      new SlashCommandBuilder().setName('clear').setDescription('Clear all messages in the current channel for a user')      new SlashCommandBuilder().setName('clear').setDescription('Clear messages in bulk')
371          .addUserOption(option => option.setName('member').setDescription("The member").setRequired(true)),          .addUserOption(option => option.setName('user').setDescription("The user"))
372            .addIntegerOption(option => option.setName('count').setDescription("The amount of messages to delete").setMaxValue(400).setMinValue(0))
373            .addChannelOption(option => option.setName('channel').setDescription("The channel where the messages will be deleted")),
374    
375      new SlashCommandBuilder().setName('echo').setDescription('Re-send a message from the bot system')      new SlashCommandBuilder().setName('echo').setDescription('Re-send a message from the bot system')
376          .addStringOption(option => option.setName('content').setDescription("The message content").setRequired(true))          .addStringOption(option => option.setName('content').setDescription("The message content").setRequired(true))
# Line 179  const commands = [ Line 380  const commands = [
380          .addRoleOption(option => option.setName('role').setDescription("Lock channel for the given role. Default is @everyone"))          .addRoleOption(option => option.setName('role').setDescription("Lock channel for the given role. Default is @everyone"))
381          .addChannelOption(option => option.setName('channel').setDescription("The channel that will be locked. Default is the current channel")),          .addChannelOption(option => option.setName('channel').setDescription("The channel that will be locked. Default is the current channel")),
382    
383        new SlashCommandBuilder().setName('setchperms').setDescription('Set permissions for channels')
384            .addChannelOption(option => option.setName('channel').setDescription("The channel that (or its children) will be updated").setRequired(true))
385            .addRoleOption(option => option.setName('role').setDescription("Lock channel for the given role.").setRequired(true))
386            .addStringOption(option => option.setName('permission').setDescription("The permission codename").setRequired(true).setAutocomplete(true))
387            .addStringOption(option => option.setName('value').setDescription("The permission value").addChoices(...[
388                {
389                    name: 'Allow',
390                    value: 'true'
391                },
392                {
393                    name: 'Deny',
394                    value: 'false',
395                },
396                {
397                    name: 'Default',
398                    value: 'null',
399                }
400            ]).setRequired(true)),
401    
402      new SlashCommandBuilder().setName('lockall').setDescription('Lock multiple channels')      new SlashCommandBuilder().setName('lockall').setDescription('Lock multiple channels')
403            .addStringOption(option => option.setName('channels').setDescription("The channels, must be separated by spaces"))
404          .addRoleOption(option => option.setName('role').setDescription("Lock channels for the given role. Default is @everyone"))          .addRoleOption(option => option.setName('role').setDescription("Lock channels for the given role. Default is @everyone"))
405          .addBooleanOption(option => option.setName('raid').setDescription("The raid protected channels will be locked. Default is `false`")),          .addBooleanOption(option => option.setName('raid').setDescription("The raid protected channels will be locked. Default is `false`")),
406    
407      new SlashCommandBuilder().setName('unlockall').setDescription('Unlock multiple channels')      new SlashCommandBuilder().setName('unlockall').setDescription('Unlock multiple channels')
408            .addStringOption(option => option.setName('channels').setDescription("The channels, must be separated by spaces"))
409          .addRoleOption(option => option.setName('role').setDescription("Unlock channels for the given role. Default is @everyone"))          .addRoleOption(option => option.setName('role').setDescription("Unlock channels for the given role. Default is @everyone"))
410          .addBooleanOption(option => option.setName('force').setDescription("Force set the channel permissions to `true`"))          .addBooleanOption(option => option.setName('force').setDescription("Force set the channel permissions to `true`"))
411          .addBooleanOption(option => option.setName('raid').setDescription("The raid protected channels will be unlocked. Default is `false`")),          .addBooleanOption(option => option.setName('raid').setDescription("The raid protected channels will be unlocked. Default is `false`")),
# Line 196  const commands = [ Line 418  const commands = [
418      new SlashCommandBuilder().setName('send').setDescription('Send a DM to a user')      new SlashCommandBuilder().setName('send').setDescription('Send a DM to a user')
419          .addStringOption(option => option.setName('content').setDescription("The message content").setRequired(true))          .addStringOption(option => option.setName('content').setDescription("The message content").setRequired(true))
420          .addUserOption(option => option.setName('member').setDescription("The member").setRequired(true)),          .addUserOption(option => option.setName('member').setDescription("The member").setRequired(true)),
421    
422    
423        new SlashCommandBuilder().setName('appeal').setDescription('Send us a messages about a punishment appeal')
424    ].map(command => command.toJSON());
425    
426    let contextMenuCommands = [
427        new ContextMenuCommandBuilder().setName('Moderation History').setType(ApplicationCommandType.User),
428        new ContextMenuCommandBuilder().setName('Ban').setType(ApplicationCommandType.User),
429        new ContextMenuCommandBuilder().setName('Shot').setType(ApplicationCommandType.User),
430        new ContextMenuCommandBuilder().setName('Kick').setType(ApplicationCommandType.User),
431  ].map(command => command.toJSON());  ].map(command => command.toJSON());
432    
433  const rest = new REST({ version: '9' }).setToken(TOKEN!);  commands = commands.concat(contextMenuCommands);
434    
435    if (process.argv.includes('--clear')) {
436        commands = [];
437        contextMenuCommands = [];
438    }
439    
440    const rest = new REST({ version: '9' }).setToken(TOKEN);
441    
 rest.put(Routes.applicationGuildCommands(CLIENT_ID!, GUILD_ID!), { body: commands })  
     .then(() => console.log('Successfully registered application commands.'))  
     .catch(console.error);  
442    rest.put(Routes[process.argv.includes('--guild') ? 'applicationGuildCommands' : 'applicationCommands'](CLIENT_ID, GUILD_ID), { body: commands })
443        .then(() => console.log('Successfully registered application ' + (process.argv.includes('--guild') ? 'guild ' : '') + 'commands.'))
444        .catch(console.error);

Legend:
Removed from v.51  
changed lines
  Added in v.398

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26