1 |
#!/bin/node |
#!/bin/node |
2 |
|
|
3 |
const { SlashCommandBuilder } = require('@discordjs/builders'); |
/** |
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'); |
const { REST } = require('@discordjs/rest'); |
24 |
const { Routes } = require('discord-api-types/v9'); |
const { Routes } = require('discord-api-types/v9'); |
25 |
const { config } = require('dotenv'); |
const { config } = require('dotenv'); |
26 |
const { existsSync } = require('fs'); |
const { existsSync } = require('fs'); |
|
const { Permissions } = require('discord.js'); |
|
27 |
const path = require('path'); |
const path = require('path'); |
28 |
const { ActivityType } = require('discord-api-types/v10'); |
const { ApplicationCommandType } = require('discord-api-types/v10'); |
29 |
|
|
30 |
if (existsSync(path.join(__dirname, '.env'))) { |
if (existsSync(path.join(__dirname, '.env'))) { |
31 |
config(); |
config(); |
41 |
new SlashCommandBuilder().setName('help').setDescription('A short documentation about the commands') |
new SlashCommandBuilder().setName('help').setDescription('A short documentation about the commands') |
42 |
.addStringOption(option => option.setName('command').setDescription("The command")), |
.addStringOption(option => option.setName('command').setDescription("The command")), |
43 |
new SlashCommandBuilder().setName('about').setDescription('Show information about the bot'), |
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'), |
new SlashCommandBuilder().setName('system').setDescription('Show the system status'), |
47 |
new SlashCommandBuilder().setName('restart').setDescription('Restart the system'), |
new SlashCommandBuilder().setName('restart').setDescription('Restart the system'), |
48 |
new SlashCommandBuilder().setName('setstatus').setDescription('Set status for the bot system') |
new SlashCommandBuilder().setName('setstatus').setDescription('Set status for the bot system') |
79 |
value: 'COMPETING' |
value: 'COMPETING' |
80 |
} |
} |
81 |
])), |
])), |
82 |
|
new SlashCommandBuilder().setName('config').setDescription('View/change the system settings for this server') |
83 |
|
.addStringOption(option => option.setName('key').setDescription('The setting key (e.g. spam_filter.enabled)').setRequired(true).setAutocomplete(true)) |
84 |
|
.addStringOption(option => option.setName('value').setDescription('New value for the setting')), |
85 |
|
|
86 |
// INFORMATION |
// INFORMATION |
87 |
new SlashCommandBuilder().setName('stats').setDescription('Show the server statistics'), |
new SlashCommandBuilder().setName('stats').setDescription('Show the server statistics'), |
88 |
|
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 |
|
) |
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 |
|
|
99 |
new SlashCommandBuilder().setName('profile').setDescription('Show someone\'s profile') |
new SlashCommandBuilder().setName('profile').setDescription('Show someone\'s profile') |
100 |
.addUserOption(option => option.setName('user').setDescription('The user')), |
.addUserOption(option => option.setName('user').setDescription('The user')), |
101 |
new SlashCommandBuilder().setName('avatar').setDescription('Show someone\'s avatar') |
new SlashCommandBuilder().setName('avatar').setDescription('Show someone\'s avatar') |
102 |
.addUserOption(option => option.setName('user').setDescription('The user')), |
.addUserOption(option => option.setName('user').setDescription('The user')), |
103 |
new SlashCommandBuilder().setName('rolelist').setDescription('List all roles or show info about a role') |
new SlashCommandBuilder().setName('rolelist').setDescription('List all roles or show info about a role') |
104 |
.addRoleOption(option => option.setName('role').setDescription('The role')) |
.addRoleOption(option => option.setName('role').setDescription('The role')) |
105 |
.addIntegerOption(option => option.setName('page').setDescription('The page number')), |
.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 |
|
|
118 |
// AUTOMATION |
// AUTOMATION |
119 |
new SlashCommandBuilder().setName('ballot').setDescription('Ballot engine') |
new SlashCommandBuilder().setName('ballot').setDescription('Ballot engine') |
128 |
subcommand |
subcommand |
129 |
.setName('view') |
.setName('view') |
130 |
.setDescription('Get information/stats about a ballot') |
.setDescription('Get information/stats about a ballot') |
131 |
.addIntegerOption(option => option.setName('id').setDescription('The ballot ID'))), |
.addStringOption(option => option.setName('id').setDescription('The ballot ID'))), |
132 |
|
|
133 |
|
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 |
|
.addStringOption(option => option.setName('json_schema').setDescription('The embed JSON schema')) |
169 |
|
), |
170 |
|
|
171 |
new SlashCommandBuilder().setName('queues').setDescription('List all queued jobs'), |
new SlashCommandBuilder().setName('queues').setDescription('List all queued jobs'), |
172 |
|
|
173 |
new SlashCommandBuilder().setName('schedule').setDescription('Schedule a message for sending later') |
new SlashCommandBuilder().setName('schedule').setDescription('Schedule a message for sending later') |
250 |
new SlashCommandBuilder().setName('afk').setDescription('Set your AFK status') |
new SlashCommandBuilder().setName('afk').setDescription('Set your AFK status') |
251 |
.addStringOption(option => option.setName('reason').setDescription("The reason for going AFK")), |
.addStringOption(option => option.setName('reason').setDescription("The reason for going AFK")), |
252 |
|
|
253 |
|
new SlashCommandBuilder().setName('hash').setDescription('Generate hash for a string (text) data') |
254 |
|
.addStringOption(option => option.setName('content').setDescription("The content to be hashed").setRequired(true)) |
255 |
|
.addStringOption(option => |
256 |
|
option |
257 |
|
.setName('algorithm') |
258 |
|
.setDescription("Hash algorithm") |
259 |
|
.setChoices( |
260 |
|
{ |
261 |
|
name: 'SHA1', |
262 |
|
value: 'sha1' |
263 |
|
}, |
264 |
|
{ |
265 |
|
name: 'SHA256', |
266 |
|
value: 'sha256' |
267 |
|
}, |
268 |
|
{ |
269 |
|
name: 'SHA512', |
270 |
|
value: 'sha512' |
271 |
|
}, |
272 |
|
{ |
273 |
|
name: 'MD5', |
274 |
|
value: 'md5' |
275 |
|
}, |
276 |
|
) |
277 |
|
) |
278 |
|
.addStringOption(option => |
279 |
|
option |
280 |
|
.setName('digest') |
281 |
|
.setDescription("Digest mode") |
282 |
|
.setChoices( |
283 |
|
{ |
284 |
|
name: 'HEX', |
285 |
|
value: 'hex' |
286 |
|
}, |
287 |
|
{ |
288 |
|
name: 'Base64', |
289 |
|
value: 'base64' |
290 |
|
}, |
291 |
|
{ |
292 |
|
name: 'Base64 URL', |
293 |
|
value: 'base64url' |
294 |
|
}, |
295 |
|
) |
296 |
|
), |
297 |
|
|
298 |
new SlashCommandBuilder().setName('announce').setDescription('Announce something') |
new SlashCommandBuilder().setName('announce').setDescription('Announce something') |
299 |
.addStringOption(option => option.setName('content').setDescription("The announcemnt message content")), |
.addStringOption(option => option.setName('content').setDescription("The announcemnt message content")), |
300 |
|
|
301 |
// MODERATION |
// MODERATION |
302 |
|
new SlashCommandBuilder().setName('antijoin').setDescription('Enable antijoin system which will kick any new users joining the server'), |
303 |
|
|
304 |
new SlashCommandBuilder().setName('ban').setDescription('Ban a user') |
new SlashCommandBuilder().setName('ban').setDescription('Ban a user') |
305 |
.addUserOption(option => option.setName('user').setDescription("The user").setRequired(true)) |
.addUserOption(option => option.setName('user').setDescription("The user").setRequired(true)) |
306 |
.addStringOption(option => option.setName('reason').setDescription("The reason for banning this user")) |
.addStringOption(option => option.setName('reason').setDescription("The reason for banning this user")) |
307 |
.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)), |
308 |
|
|
309 |
|
new SlashCommandBuilder().setName('softban').setDescription('Softban a user') |
310 |
|
.addUserOption(option => option.setName('user').setDescription("The user").setRequired(true)) |
311 |
|
.addStringOption(option => option.setName('reason').setDescription("The reason for softbanning this user")) |
312 |
|
.addIntegerOption(option => option.setName('days').setDescription("The days old messages to delete of this user (default is 7)").setMinValue(0).setMaxValue(7)), |
313 |
|
|
314 |
|
new SlashCommandBuilder().setName('tempban').setDescription('Temporarily ban a user') |
315 |
|
.addUserOption(option => option.setName('user').setDescription("The user").setRequired(true)) |
316 |
|
.addStringOption(option => option.setName('time').setDescription("TBan duration").setRequired(true)) |
317 |
|
.addStringOption(option => option.setName('reason').setDescription("The reason for softbanning this user")) |
318 |
|
.addIntegerOption(option => option.setName('days').setDescription("The days old messages to delete of this user (default is 7)").setMinValue(0).setMaxValue(7)), |
319 |
|
|
320 |
new SlashCommandBuilder().setName('massban').setDescription('Ban multiple users') |
new SlashCommandBuilder().setName('massban').setDescription('Ban multiple users') |
321 |
.addStringOption(option => option.setName('users').setDescription("The user IDs (separated by spaces)").setRequired(true)) |
.addStringOption(option => option.setName('users').setDescription("The user IDs (separated by spaces)").setRequired(true)) |
322 |
.addStringOption(option => option.setName('reason').setDescription("The reason for banning")) |
.addStringOption(option => option.setName('reason').setDescription("The reason for banning")) |
326 |
.addUserOption(option => option.setName('member').setDescription("The member").setRequired(true)) |
.addUserOption(option => option.setName('member').setDescription("The member").setRequired(true)) |
327 |
.addStringOption(option => option.setName('reason').setDescription("The reason for kicking this user")), |
.addStringOption(option => option.setName('reason').setDescription("The reason for kicking this user")), |
328 |
|
|
329 |
new SlashCommandBuilder().setName('bean').setDescription('Bean a member') |
new SlashCommandBuilder().setName('shot').setDescription('Give a shot to a member') |
330 |
.addUserOption(option => option.setName('member').setDescription("The member").setRequired(true)) |
.addUserOption(option => option.setName('member').setDescription("The member").setRequired(true)) |
331 |
.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")) |
332 |
|
.addBooleanOption(option => option.setName('anonymous').setDescription("Prevents sending your name as the 'Doctor' of the shot")), |
333 |
|
|
334 |
new SlashCommandBuilder().setName('warn').setDescription('Warn a member') |
new SlashCommandBuilder().setName('warn').setDescription('Warn a member') |
335 |
.addUserOption(option => option.setName('member').setDescription("The member").setRequired(true)) |
.addUserOption(option => option.setName('member').setDescription("The member").setRequired(true)) |
336 |
.addStringOption(option => option.setName('reason').setDescription("The reason for warning this user")), |
.addStringOption(option => option.setName('reason').setDescription("The reason for warning this user")), |
337 |
|
|
338 |
new SlashCommandBuilder().setName('note').setDescription('Take a note for a member') |
new SlashCommandBuilder().setName('note').setDescription('Take a note for a user') |
339 |
.addUserOption(option => option.setName('member').setDescription("The member").setRequired(true)) |
.addUserOption(option => option.setName('user').setDescription("The user").setRequired(true)) |
340 |
.addStringOption(option => option.setName('note').setDescription("The note content").setRequired(true)), |
.addStringOption(option => option.setName('note').setDescription("The note content").setRequired(true)), |
341 |
|
|
342 |
new SlashCommandBuilder().setName('mute').setDescription('Mute a member') |
new SlashCommandBuilder().setName('mute').setDescription('Mute a member') |
343 |
.addUserOption(option => option.setName('member').setDescription("The member").setRequired(true)) |
.addUserOption(option => option.setName('member').setDescription("The member").setRequired(true)) |
344 |
.addStringOption(option => option.setName('reason').setDescription("The reason for muting this user")) |
.addStringOption(option => option.setName('reason').setDescription("The reason for muting this user")) |
345 |
.addStringOption(option => option.setName('time').setDescription("Mute duration")), |
.addStringOption(option => option.setName('time').setDescription("Mute duration")) |
346 |
|
.addBooleanOption(option => option.setName('hardmute').setDescription("Specify if the system should take out all roles of the user during the mute")), |
347 |
|
|
348 |
new SlashCommandBuilder().setName('unmute').setDescription('Unmute a member') |
new SlashCommandBuilder().setName('unmute').setDescription('Unmute a member') |
349 |
.addUserOption(option => option.setName('member').setDescription("The member").setRequired(true)), |
.addUserOption(option => option.setName('member').setDescription("The member").setRequired(true)), |
351 |
new SlashCommandBuilder().setName('unban').setDescription('Unban a user') |
new SlashCommandBuilder().setName('unban').setDescription('Unban a user') |
352 |
.addUserOption(option => option.setName('user').setDescription("The user").setRequired(true)), |
.addUserOption(option => option.setName('user').setDescription("The user").setRequired(true)), |
353 |
|
|
354 |
new SlashCommandBuilder().setName('warndel').setDescription('Delete a warning') |
new SlashCommandBuilder().setName('warning').setDescription('Clear, remove or view warnings') |
355 |
.addNumberOption(option => option.setName('id').setDescription("The warning ID").setRequired(true)), |
.addSubcommand(subcmd => { |
356 |
|
return subcmd.setName('view').setDescription('View information about a warning').addStringOption(option => option.setName('id').setDescription("The warning ID").setRequired(true)); |
357 |
new SlashCommandBuilder().setName('warning').setDescription('Get information about a warning') |
}) |
358 |
.addNumberOption(option => option.setName('id').setDescription("The warning ID").setRequired(true)), |
.addSubcommand(subcmd => { |
359 |
|
return subcmd.setName('remove').setDescription('Remove a warning').addStringOption(option => option.setName('id').setDescription("The warning ID").setRequired(true)); |
360 |
|
}) |
361 |
|
.addSubcommand(subcmd => { |
362 |
|
return subcmd.setName('list').setDescription('List warnings for a user').addUserOption(option => option.setName('user').setDescription("The user").setRequired(true)); |
363 |
|
}) |
364 |
|
.addSubcommand(subcmd => { |
365 |
|
return subcmd.setName('clear').setDescription('Clear all warnings for a user').addUserOption(option => option.setName('user').setDescription("The user").setRequired(true)); |
366 |
|
}), |
367 |
|
|
368 |
new SlashCommandBuilder().setName('noteget').setDescription('Get information about a note') |
new SlashCommandBuilder().setName('noteget').setDescription('Get information about a note') |
369 |
.addNumberOption(option => option.setName('id').setDescription("The note ID").setRequired(true)), |
.addNumberOption(option => option.setName('id').setDescription("The note ID").setRequired(true)), |
371 |
new SlashCommandBuilder().setName('notedel').setDescription('Delete a note') |
new SlashCommandBuilder().setName('notedel').setDescription('Delete a note') |
372 |
.addNumberOption(option => option.setName('id').setDescription("The note ID").setRequired(true)), |
.addNumberOption(option => option.setName('id').setDescription("The note ID").setRequired(true)), |
373 |
|
|
|
new SlashCommandBuilder().setName('warnings').setDescription('Fetch all warnings') |
|
|
.addUserOption(option => option.setName('member').setDescription("Show warnings for only this member")), |
|
|
|
|
374 |
new SlashCommandBuilder().setName('notes').setDescription('Fetch all notes for a user') |
new SlashCommandBuilder().setName('notes').setDescription('Fetch all notes for a user') |
375 |
.addUserOption(option => option.setName('member').setDescription("The member").setRequired(true)), |
.addUserOption(option => option.setName('user').setDescription("The user").setRequired(true)), |
376 |
|
|
377 |
new SlashCommandBuilder().setName('history').setDescription('Fetch all moderation history for a user') |
new SlashCommandBuilder().setName('history').setDescription('Fetch all moderation history for a user') |
378 |
.addUserOption(option => option.setName('user').setDescription("The user").setRequired(true)), |
.addUserOption(option => option.setName('user').setDescription("The user").setRequired(true)), |
410 |
]).setRequired(true)), |
]).setRequired(true)), |
411 |
|
|
412 |
new SlashCommandBuilder().setName('lockall').setDescription('Lock multiple channels') |
new SlashCommandBuilder().setName('lockall').setDescription('Lock multiple channels') |
413 |
|
.addStringOption(option => option.setName('channels').setDescription("The channels, must be separated by spaces")) |
414 |
.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")) |
415 |
.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`")), |
416 |
|
|
417 |
new SlashCommandBuilder().setName('unlockall').setDescription('Unlock multiple channels') |
new SlashCommandBuilder().setName('unlockall').setDescription('Unlock multiple channels') |
418 |
|
.addStringOption(option => option.setName('channels').setDescription("The channels, must be separated by spaces")) |
419 |
.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")) |
420 |
.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`")) |
421 |
.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`")), |
428 |
new SlashCommandBuilder().setName('send').setDescription('Send a DM to a user') |
new SlashCommandBuilder().setName('send').setDescription('Send a DM to a user') |
429 |
.addStringOption(option => option.setName('content').setDescription("The message content").setRequired(true)) |
.addStringOption(option => option.setName('content').setDescription("The message content").setRequired(true)) |
430 |
.addUserOption(option => option.setName('member').setDescription("The member").setRequired(true)), |
.addUserOption(option => option.setName('member').setDescription("The member").setRequired(true)), |
431 |
|
|
432 |
|
|
433 |
|
new SlashCommandBuilder().setName('appeal').setDescription('Send us a messages about a punishment appeal') |
434 |
].map(command => command.toJSON()); |
].map(command => command.toJSON()); |
435 |
|
|
436 |
|
let contextMenuCommands = [ |
437 |
|
new ContextMenuCommandBuilder().setName('Moderation History').setType(ApplicationCommandType.User), |
438 |
|
new ContextMenuCommandBuilder().setName('Ban').setType(ApplicationCommandType.User), |
439 |
|
new ContextMenuCommandBuilder().setName('Shot').setType(ApplicationCommandType.User), |
440 |
|
new ContextMenuCommandBuilder().setName('Kick').setType(ApplicationCommandType.User), |
441 |
|
].map(command => command.toJSON()); |
442 |
|
|
443 |
|
commands = commands.concat(contextMenuCommands); |
444 |
|
|
445 |
if (process.argv.includes('--clear')) { |
if (process.argv.includes('--clear')) { |
446 |
commands = []; |
commands = []; |
447 |
|
contextMenuCommands = []; |
448 |
} |
} |
449 |
|
|
450 |
const rest = new REST({ version: '9' }).setToken(TOKEN); |
const rest = new REST({ version: '9' }).setToken(TOKEN); |
451 |
|
|
452 |
rest.put(Routes[process.argv.includes('--guild') ? 'applicationGuildCommands' : 'applicationCommands'](CLIENT_ID, GUILD_ID), { body: commands }) |
rest.put(Routes[process.argv.includes('--guild') ? 'applicationGuildCommands' : 'applicationCommands'](CLIENT_ID, GUILD_ID), { body: commands }) |
453 |
.then(() => console.log('Successfully registered application ' + (process.argv.includes('--guild') ? 'guild ' : '') + 'commands.')) |
.then(() => console.log('Successfully registered application ' + (process.argv.includes('--guild') ? 'guild ' : '') + 'commands.')) |
|
.catch(console.error); |
|
454 |
|
.catch(console.error); |