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

Annotation of /trunk/deploy-commands.js

Parent Directory Parent Directory | Revision Log Revision Log


Revision 537 - (hide annotations)
Mon Jul 29 17:30:42 2024 UTC (8 months, 1 week ago) by rakin
File MIME type: text/javascript
File size: 25854 byte(s)
feat(commands): add private channel creation command
1 rakin 57 #!/bin/node
2 rakin 51
3 rakin 398 /**
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 rakin 125 const { SlashCommandBuilder, ContextMenuCommandBuilder } = require('@discordjs/builders');
23 rakin 57 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 rakin 399 const { ApplicationCommandType } = require('discord-api-types/v10');
29 rakin 51
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 rakin 67 let commands = [
40 rakin 54 // SETTINGS
41     new SlashCommandBuilder().setName('help').setDescription('A short documentation about the commands')
42     .addStringOption(option => option.setName('command').setDescription("The command")),
43 rakin 51 new SlashCommandBuilder().setName('about').setDescription('Show information about the bot'),
44 rakin 268 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 rakin 51 new SlashCommandBuilder().setName('system').setDescription('Show the system status'),
47 rakin 58 new SlashCommandBuilder().setName('restart').setDescription('Restart the system'),
48 rakin 71 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 rakin 215 new SlashCommandBuilder().setName('config').setDescription('View/change the system settings for this server')
83 rakin 383 .addStringOption(option => option.setName('key').setDescription('The setting key (e.g. spam_filter.enabled)').setRequired(true).setAutocomplete(true))
84 rakin 215 .addStringOption(option => option.setName('value').setDescription('New value for the setting')),
85 rakin 51
86     // INFORMATION
87     new SlashCommandBuilder().setName('stats').setDescription('Show the server statistics'),
88 rakin 290 new SlashCommandBuilder().setName('lookup').setDescription('Lookup something')
89     .addSubcommand(subcommand => subcommand.setName("user").setDescription("User lookup")
90     .addUserOption(option => option.setName("user").setDescription("The user to search").setRequired(true))
91 rakin 297 )
92     .addSubcommand(subcommand => subcommand.setName("guild").setDescription("Server/Guild lookup")
93     .addStringOption(option => option.setName("guild_id").setDescription("The ID of the server/guild to lookup").setRequired(true))
94     )
95     .addSubcommand(subcommand => subcommand.setName("avatar").setDescription("Avatar lookup using Google Image Search")
96     .addUserOption(option => option.setName("user").setDescription("The user to lookup").setRequired(true))
97     ),
98 rakin 290
99 rakin 54 new SlashCommandBuilder().setName('profile').setDescription('Show someone\'s profile')
100     .addUserOption(option => option.setName('user').setDescription('The user')),
101     new SlashCommandBuilder().setName('avatar').setDescription('Show someone\'s avatar')
102     .addUserOption(option => option.setName('user').setDescription('The user')),
103 rakin 60 new SlashCommandBuilder().setName('rolelist').setDescription('List all roles or show info about a role')
104 rakin 75 .addRoleOption(option => option.setName('role').setDescription('The role'))
105 rakin 466 .addStringOption(option =>
106     option
107     .setName('order')
108     .setDescription('Order style of the list (according to the role positions)')
109     .setChoices({
110     name: "Ascending",
111     value: "a"
112     }, {
113     name: "Descending",
114     value: "d"
115     })
116     ),
117 rakin 51
118     // AUTOMATION
119 rakin 55 new SlashCommandBuilder().setName('ballot').setDescription('Ballot engine')
120     .addSubcommand(subcommand =>
121     subcommand
122     .setName('create')
123     .setDescription('Send a ballot/poll message for collecting votes')
124     .addStringOption(option => option.setName('content').setDescription('Message content').setRequired(true))
125     .addBooleanOption(option => option.setName('anonymous').setDescription('If this is set to true then the syetem won\'t show your username'))
126     .addChannelOption(option => option.setName('channel').setDescription('The channel where the message should be sent')))
127     .addSubcommand(subcommand =>
128     subcommand
129     .setName('view')
130     .setDescription('Get information/stats about a ballot')
131 rakin 328 .addStringOption(option => option.setName('id').setDescription('The ballot ID'))),
132 rakin 55
133 rakin 252 new SlashCommandBuilder().setName('embed').setDescription('Make an embed')
134     .addSubcommand(subcmd =>
135     subcmd.setName("send").setDescription("Make and send an embed")
136     .addStringOption(option => option.setName('author_name').setDescription('The embed author name'))
137     .addStringOption(option => option.setName('author_iconurl').setDescription('The embed author icon URL'))
138     .addStringOption(option => option.setName('title').setDescription('The embed title'))
139     .addStringOption(option => option.setName('description').setDescription('The embed description'))
140     .addStringOption(option => option.setName('thumbnail').setDescription('The embed thumbnail URL'))
141     .addStringOption(option => option.setName('image').setDescription('The embed image attachment URL'))
142     .addStringOption(option => option.setName('video').setDescription('The embed video attachment URL'))
143     .addStringOption(option => option.setName('footer_text').setDescription('The embed footer text'))
144     .addStringOption(option => option.setName('footer_iconurl').setDescription('The embed footer icon URL'))
145     .addStringOption(option => option.setName('timestamp').setDescription('The embed timestamp, use \'current\' to set current date'))
146     .addStringOption(option => option.setName('color').setDescription('The embed color (default is #007bff)'))
147     .addStringOption(option => option.setName('url').setDescription('The embed URL'))
148     .addStringOption(option => option.setName('fields').setDescription('The embed fields, should be in `Field 1: Value 1, Field 2: Value 2` format'))
149     )
150     .addSubcommand(subcmd =>
151     subcmd.setName("schema").setDescription("Make and send an embed schema representation")
152     .addStringOption(option => option.setName('author_name').setDescription('The embed author name'))
153     .addStringOption(option => option.setName('author_iconurl').setDescription('The embed author icon URL'))
154     .addStringOption(option => option.setName('title').setDescription('The embed title'))
155     .addStringOption(option => option.setName('description').setDescription('The embed description'))
156     .addStringOption(option => option.setName('thumbnail').setDescription('The embed thumbnail URL'))
157     .addStringOption(option => option.setName('image').setDescription('The embed image attachment URL'))
158     .addStringOption(option => option.setName('video').setDescription('The embed video attachment URL'))
159     .addStringOption(option => option.setName('footer_text').setDescription('The embed footer text'))
160     .addStringOption(option => option.setName('footer_iconurl').setDescription('The embed footer icon URL'))
161     .addStringOption(option => option.setName('timestamp').setDescription('The embed timestamp, use \'current\' to set current date'))
162     .addStringOption(option => option.setName('color').setDescription('The embed color (default is #007bff)'))
163     .addStringOption(option => option.setName('url').setDescription('The embed URL'))
164     .addStringOption(option => option.setName('fields').setDescription('The embed fields, should be in `Field 1: Value 1, Field 2: Value 2` format'))
165     )
166     .addSubcommand(subcmd =>
167     subcmd.setName("build").setDescription("Build an embed from schema")
168 rakin 254 .addStringOption(option => option.setName('json_schema').setDescription('The embed JSON schema'))
169 rakin 252 ),
170 rakin 248
171 rakin 51 new SlashCommandBuilder().setName('queues').setDescription('List all queued jobs'),
172    
173     new SlashCommandBuilder().setName('schedule').setDescription('Schedule a message for sending later')
174     .addStringOption(option => option.setName('time').setDescription('The time interval').setRequired(true))
175     .addStringOption(option => option.setName('content').setDescription('Message content').setRequired(true))
176     .addChannelOption(option => option.setName('channel').setDescription('The channel where the message should be sent')),
177    
178     new SlashCommandBuilder().setName('expire').setDescription('Expire (delete) a message after a certain amount of time')
179     .addStringOption(option => option.setName('time').setDescription('The time interval').setRequired(true))
180     .addStringOption(option => option.setName('content').setDescription('Message content').setRequired(true))
181     .addChannelOption(option => option.setName('channel').setDescription('The channel where the message should be sent')),
182    
183     new SlashCommandBuilder().setName('expiresc').setDescription('Schedule and expire (delete) a message after a certain amount of time')
184     .addStringOption(option => option.setName('send-after').setDescription('The time after the message should be sent').setRequired(true))
185     .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)
186     .addStringOption(option => option.setName('content').setDescription('Message content').setRequired(true))
187     .addChannelOption(option => option.setName('channel').setDescription('The channel where the message should be sent')),
188    
189     // FUN
190     new SlashCommandBuilder().setName('cat').setDescription('Fetch a random kitty image'),
191    
192     new SlashCommandBuilder().setName('dog').setDescription('Fetch a random doggy image'),
193    
194     new SlashCommandBuilder().setName('joke').setDescription('Fetch a random joke from the Joke API'),
195    
196     new SlashCommandBuilder().setName('httpcat').setDescription('Fetch a funny cat meme associated with an HTTP status code')
197     .addIntegerOption(option => option.setName('status').setDescription('The HTTP status Code').setRequired(true).setMinValue(100).setMaxValue(599)),
198    
199     new SlashCommandBuilder().setName('httpdog').setDescription('Fetch a funny dog meme associated with an HTTP status code')
200     .addIntegerOption(option => option.setName('status').setDescription('The HTTP status Code').setRequired(true).setMinValue(100).setMaxValue(599)),
201    
202     new SlashCommandBuilder().setName('pixabay').setDescription('Search & fetch images from the Pixabay API')
203     .addSubcommand(subcommand =>
204     subcommand
205     .setName('image')
206     .setDescription('Get any type of image')
207     .addStringOption(option => option.setName('query').setDescription('Search query')))
208     .addSubcommand(subcommand =>
209     subcommand
210     .setName('photo')
211     .setDescription('Get photos')
212     .addStringOption(option => option.setName('query').setDescription('Search query')))
213     .addSubcommand(subcommand =>
214     subcommand
215     .setName('illustration')
216     .setDescription('Get illustrations')
217     .addStringOption(option => option.setName('query').setDescription('Search query')))
218     .addSubcommand(subcommand =>
219     subcommand
220     .setName('vector')
221     .setDescription('Get vectors')
222     .addStringOption(option => option.setName('query').setDescription('Search query'))),
223    
224     // UTILS
225     new SlashCommandBuilder().setName('snippet').setDescription('Snippets are instant custom messages')
226     .addSubcommand(subcommand =>
227     subcommand
228     .setName('get')
229     .setDescription('Get a snippet')
230     .addStringOption(option => option.setName('name').setDescription('The snippet name').setRequired(true)))
231     .addSubcommand(subcommand =>
232     subcommand
233     .setName('create')
234     .setDescription('Create a snippet')
235     .addStringOption(option => option.setName('name').setDescription('The snippet name').setRequired(true))
236     .addStringOption(option => option.setName('content').setDescription('Snippet message content').setRequired(true))
237     .addAttachmentOption(option => option.setName('file').setDescription('Snippet message file')))
238     .addSubcommand(subcommand =>
239     subcommand
240     .setName('rename')
241     .setDescription('Rename a snippet')
242     .addStringOption(option => option.setName('old-name').setDescription('The old snippet name').setRequired(true))
243     .addStringOption(option => option.setName('new-name').setDescription('The new name').setRequired(true)))
244     .addSubcommand(subcommand =>
245     subcommand
246     .setName('delete')
247     .setDescription('Delete a snippet')
248     .addStringOption(option => option.setName('name').setDescription('The snippet name').setRequired(true))),
249    
250     new SlashCommandBuilder().setName('afk').setDescription('Set your AFK status')
251     .addStringOption(option => option.setName('reason').setDescription("The reason for going AFK")),
252    
253 rakin 537 new SlashCommandBuilder().setName('private').setDescription('Create a private channel for specific members')
254     .addUserOption(option => option.setName('member').setDescription("The member to add in the private channel").setRequired(true))
255     .addChannelOption(option => option.setName('category').setDescription("Create channel in the specified category")),
256    
257 rakin 261 new SlashCommandBuilder().setName('hash').setDescription('Generate hash for a string (text) data')
258     .addStringOption(option => option.setName('content').setDescription("The content to be hashed").setRequired(true))
259     .addStringOption(option =>
260     option
261     .setName('algorithm')
262     .setDescription("Hash algorithm")
263     .setChoices(
264     {
265     name: 'SHA1',
266     value: 'sha1'
267     },
268     {
269     name: 'SHA256',
270     value: 'sha256'
271     },
272     {
273     name: 'SHA512',
274     value: 'sha512'
275     },
276     {
277     name: 'MD5',
278     value: 'md5'
279     },
280     )
281     )
282     .addStringOption(option =>
283     option
284     .setName('digest')
285     .setDescription("Digest mode")
286     .setChoices(
287     {
288     name: 'HEX',
289     value: 'hex'
290     },
291     {
292     name: 'Base64',
293     value: 'base64'
294     },
295     {
296     name: 'Base64 URL',
297     value: 'base64url'
298     },
299     )
300     ),
301    
302 rakin 51 new SlashCommandBuilder().setName('announce').setDescription('Announce something')
303     .addStringOption(option => option.setName('content').setDescription("The announcemnt message content")),
304    
305     // MODERATION
306 rakin 225 new SlashCommandBuilder().setName('antijoin').setDescription('Enable antijoin system which will kick any new users joining the server'),
307    
308 rakin 51 new SlashCommandBuilder().setName('ban').setDescription('Ban a user')
309     .addUserOption(option => option.setName('user').setDescription("The user").setRequired(true))
310     .addStringOption(option => option.setName('reason').setDescription("The reason for banning this user"))
311     .addIntegerOption(option => option.setName('days').setDescription("The days old messages to delete of this user").setMinValue(0).setMaxValue(7)),
312    
313 rakin 106 new SlashCommandBuilder().setName('softban').setDescription('Softban a user')
314     .addUserOption(option => option.setName('user').setDescription("The user").setRequired(true))
315     .addStringOption(option => option.setName('reason').setDescription("The reason for softbanning this user"))
316     .addIntegerOption(option => option.setName('days').setDescription("The days old messages to delete of this user (default is 7)").setMinValue(0).setMaxValue(7)),
317    
318     new SlashCommandBuilder().setName('tempban').setDescription('Temporarily ban a user')
319     .addUserOption(option => option.setName('user').setDescription("The user").setRequired(true))
320     .addStringOption(option => option.setName('time').setDescription("TBan duration").setRequired(true))
321     .addStringOption(option => option.setName('reason').setDescription("The reason for softbanning this user"))
322     .addIntegerOption(option => option.setName('days').setDescription("The days old messages to delete of this user (default is 7)").setMinValue(0).setMaxValue(7)),
323    
324 rakin 61 new SlashCommandBuilder().setName('massban').setDescription('Ban multiple users')
325     .addStringOption(option => option.setName('users').setDescription("The user IDs (separated by spaces)").setRequired(true))
326     .addStringOption(option => option.setName('reason').setDescription("The reason for banning"))
327     .addIntegerOption(option => option.setName('days').setDescription("The days old messages to delete of these users").setMinValue(0).setMaxValue(7)),
328    
329 rakin 51 new SlashCommandBuilder().setName('kick').setDescription('Kick a member')
330     .addUserOption(option => option.setName('member').setDescription("The member").setRequired(true))
331     .addStringOption(option => option.setName('reason').setDescription("The reason for kicking this user")),
332    
333 rakin 197 new SlashCommandBuilder().setName('shot').setDescription('Give a shot to a member')
334 rakin 51 .addUserOption(option => option.setName('member').setDescription("The member").setRequired(true))
335 rakin 363 .addStringOption(option => option.setName('reason').setDescription("The reason for giving shot to this user"))
336     .addBooleanOption(option => option.setName('anonymous').setDescription("Prevents sending your name as the 'Doctor' of the shot")),
337 rakin 51
338     new SlashCommandBuilder().setName('warn').setDescription('Warn a member')
339     .addUserOption(option => option.setName('member').setDescription("The member").setRequired(true))
340     .addStringOption(option => option.setName('reason').setDescription("The reason for warning this user")),
341    
342 rakin 86 new SlashCommandBuilder().setName('note').setDescription('Take a note for a user')
343     .addUserOption(option => option.setName('user').setDescription("The user").setRequired(true))
344 rakin 51 .addStringOption(option => option.setName('note').setDescription("The note content").setRequired(true)),
345    
346     new SlashCommandBuilder().setName('mute').setDescription('Mute a member')
347     .addUserOption(option => option.setName('member').setDescription("The member").setRequired(true))
348     .addStringOption(option => option.setName('reason').setDescription("The reason for muting this user"))
349 rakin 124 .addStringOption(option => option.setName('time').setDescription("Mute duration"))
350     .addBooleanOption(option => option.setName('hardmute').setDescription("Specify if the system should take out all roles of the user during the mute")),
351 rakin 51
352     new SlashCommandBuilder().setName('unmute').setDescription('Unmute a member')
353     .addUserOption(option => option.setName('member').setDescription("The member").setRequired(true)),
354    
355     new SlashCommandBuilder().setName('unban').setDescription('Unban a user')
356     .addUserOption(option => option.setName('user').setDescription("The user").setRequired(true)),
357    
358 rakin 85 new SlashCommandBuilder().setName('warning').setDescription('Clear, remove or view warnings')
359     .addSubcommand(subcmd => {
360 rakin 336 return subcmd.setName('view').setDescription('View information about a warning').addStringOption(option => option.setName('id').setDescription("The warning ID").setRequired(true));
361 rakin 85 })
362     .addSubcommand(subcmd => {
363 rakin 336 return subcmd.setName('remove').setDescription('Remove a warning').addStringOption(option => option.setName('id').setDescription("The warning ID").setRequired(true));
364 rakin 85 })
365     .addSubcommand(subcmd => {
366     return subcmd.setName('list').setDescription('List warnings for a user').addUserOption(option => option.setName('user').setDescription("The user").setRequired(true));
367     })
368     .addSubcommand(subcmd => {
369     return subcmd.setName('clear').setDescription('Clear all warnings for a user').addUserOption(option => option.setName('user').setDescription("The user").setRequired(true));
370     }),
371 rakin 51
372     new SlashCommandBuilder().setName('noteget').setDescription('Get information about a note')
373     .addNumberOption(option => option.setName('id').setDescription("The note ID").setRequired(true)),
374    
375     new SlashCommandBuilder().setName('notedel').setDescription('Delete a note')
376     .addNumberOption(option => option.setName('id').setDescription("The note ID").setRequired(true)),
377    
378     new SlashCommandBuilder().setName('notes').setDescription('Fetch all notes for a user')
379 rakin 86 .addUserOption(option => option.setName('user').setDescription("The user").setRequired(true)),
380 rakin 51
381     new SlashCommandBuilder().setName('history').setDescription('Fetch all moderation history for a user')
382     .addUserOption(option => option.setName('user').setDescription("The user").setRequired(true)),
383    
384 rakin 79 new SlashCommandBuilder().setName('clear').setDescription('Clear messages in bulk')
385 rakin 78 .addUserOption(option => option.setName('user').setDescription("The user"))
386     .addIntegerOption(option => option.setName('count').setDescription("The amount of messages to delete").setMaxValue(400).setMinValue(0))
387     .addChannelOption(option => option.setName('channel').setDescription("The channel where the messages will be deleted")),
388 rakin 51
389     new SlashCommandBuilder().setName('echo').setDescription('Re-send a message from the bot system')
390     .addStringOption(option => option.setName('content').setDescription("The message content").setRequired(true))
391     .addChannelOption(option => option.setName('channel').setDescription("The channel where the message should be sent")),
392    
393     new SlashCommandBuilder().setName('lock').setDescription('Lock a channel')
394     .addRoleOption(option => option.setName('role').setDescription("Lock channel for the given role. Default is @everyone"))
395     .addChannelOption(option => option.setName('channel').setDescription("The channel that will be locked. Default is the current channel")),
396    
397 rakin 63 new SlashCommandBuilder().setName('setchperms').setDescription('Set permissions for channels')
398     .addChannelOption(option => option.setName('channel').setDescription("The channel that (or its children) will be updated").setRequired(true))
399     .addRoleOption(option => option.setName('role').setDescription("Lock channel for the given role.").setRequired(true))
400 rakin 64 .addStringOption(option => option.setName('permission').setDescription("The permission codename").setRequired(true).setAutocomplete(true))
401 rakin 63 .addStringOption(option => option.setName('value').setDescription("The permission value").addChoices(...[
402     {
403     name: 'Allow',
404     value: 'true'
405     },
406     {
407     name: 'Deny',
408     value: 'false',
409     },
410     {
411     name: 'Default',
412     value: 'null',
413     }
414     ]).setRequired(true)),
415    
416 rakin 51 new SlashCommandBuilder().setName('lockall').setDescription('Lock multiple channels')
417 rakin 244 .addStringOption(option => option.setName('channels').setDescription("The channels, must be separated by spaces"))
418 rakin 51 .addRoleOption(option => option.setName('role').setDescription("Lock channels for the given role. Default is @everyone"))
419     .addBooleanOption(option => option.setName('raid').setDescription("The raid protected channels will be locked. Default is `false`")),
420    
421     new SlashCommandBuilder().setName('unlockall').setDescription('Unlock multiple channels')
422 rakin 244 .addStringOption(option => option.setName('channels').setDescription("The channels, must be separated by spaces"))
423 rakin 51 .addRoleOption(option => option.setName('role').setDescription("Unlock channels for the given role. Default is @everyone"))
424     .addBooleanOption(option => option.setName('force').setDescription("Force set the channel permissions to `true`"))
425     .addBooleanOption(option => option.setName('raid').setDescription("The raid protected channels will be unlocked. Default is `false`")),
426    
427     new SlashCommandBuilder().setName('unlock').setDescription('Unlock a channel')
428     .addRoleOption(option => option.setName('role').setDescription("Unlock channel for the given role. Default is @everyone"))
429     .addBooleanOption(option => option.setName('force').setDescription("Force set the channel permission to `true`"))
430     .addChannelOption(option => option.setName('channel').setDescription("The channel that will be unlocked. Default is the current channel")),
431    
432     new SlashCommandBuilder().setName('send').setDescription('Send a DM to a user')
433     .addStringOption(option => option.setName('content').setDescription("The message content").setRequired(true))
434     .addUserOption(option => option.setName('member').setDescription("The member").setRequired(true)),
435 rakin 81
436    
437     new SlashCommandBuilder().setName('appeal').setDescription('Send us a messages about a punishment appeal')
438 rakin 51 ].map(command => command.toJSON());
439    
440 rakin 125 let contextMenuCommands = [
441     new ContextMenuCommandBuilder().setName('Moderation History').setType(ApplicationCommandType.User),
442     new ContextMenuCommandBuilder().setName('Ban').setType(ApplicationCommandType.User),
443 rakin 197 new ContextMenuCommandBuilder().setName('Shot').setType(ApplicationCommandType.User),
444 rakin 125 new ContextMenuCommandBuilder().setName('Kick').setType(ApplicationCommandType.User),
445     ].map(command => command.toJSON());
446    
447     commands = commands.concat(contextMenuCommands);
448    
449 rakin 67 if (process.argv.includes('--clear')) {
450     commands = [];
451 rakin 125 contextMenuCommands = [];
452 rakin 67 }
453    
454 rakin 57 const rest = new REST({ version: '9' }).setToken(TOKEN);
455 rakin 51
456 rakin 67 rest.put(Routes[process.argv.includes('--guild') ? 'applicationGuildCommands' : 'applicationCommands'](CLIENT_ID, GUILD_ID), { body: commands })
457     .then(() => console.log('Successfully registered application ' + (process.argv.includes('--guild') ? 'guild ' : '') + 'commands.'))
458 rakin 197 .catch(console.error);

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26