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

Diff of /trunk/deploy-commands.js

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

revision 248 by rakin, Mon Jul 29 17:29:12 2024 UTC revision 399 by rakin, Mon Jul 29 17:30:02 2024 UTC
# Line 1  Line 1 
1  #!/bin/node  #!/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');  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, ApplicationCommand } = require('discord.js');  
27  const path = require('path');  const path = require('path');
28  const { ActivityType, ApplicationCommandType } = 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();
# Line 23  let commands = [ Line 41  let commands = [
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')
# Line 60  let commands = [ Line 80  let commands = [
80              }              }
81          ])),          ])),
82      new SlashCommandBuilder().setName('config').setDescription('View/change the system settings for this server')      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))          .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')),          .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')
# Line 86  let commands = [ Line 117  let commands = [
117              subcommand              subcommand
118                  .setName('view')                  .setName('view')
119                  .setDescription('Get information/stats about a ballot')                  .setDescription('Get information/stats about a ballot')
120                  .addIntegerOption(option => option.setName('id').setDescription('The ballot ID'))),                  .addStringOption(option => option.setName('id').setDescription('The ballot ID'))),
121                    
122      new SlashCommandBuilder().setName('embed').setDescription('Make and send an embed')      new SlashCommandBuilder().setName('embed').setDescription('Make an embed')
123          .addStringOption(option => option.setName('author_name').setDescription('The embed author name'))          .addSubcommand(subcmd =>
124          .addStringOption(option => option.setName('author_iconurl').setDescription('The embed author icon URL'))               subcmd.setName("send").setDescription("Make and send an embed")
125          .addStringOption(option => option.setName('title').setDescription('The embed title'))                  .addStringOption(option => option.setName('author_name').setDescription('The embed author name'))
126          .addStringOption(option => option.setName('description').setDescription('The embed description'))                  .addStringOption(option => option.setName('author_iconurl').setDescription('The embed author icon URL'))
127          .addStringOption(option => option.setName('thumbnail').setDescription('The embed thumbnail'))                  .addStringOption(option => option.setName('title').setDescription('The embed title'))
128          .addStringOption(option => option.setName('image').setDescription('The embed image attachment'))                  .addStringOption(option => option.setName('description').setDescription('The embed description'))
129          .addStringOption(option => option.setName('footer_text').setDescription('The embed footer text'))                  .addStringOption(option => option.setName('thumbnail').setDescription('The embed thumbnail URL'))
130          .addStringOption(option => option.setName('footer_iconurl').setDescription('The embed footer icon URL'))                  .addStringOption(option => option.setName('image').setDescription('The embed image attachment URL'))
131          .addStringOption(option => option.setName('timestamp').setDescription('The embed timestamp, use \'current\' to set current date'))                  .addStringOption(option => option.setName('video').setDescription('The embed video attachment URL'))
132          .addStringOption(option => option.setName('color').setDescription('The embed color (default is #007bff)'))                  .addStringOption(option => option.setName('footer_text').setDescription('The embed footer text'))
133          .addStringOption(option => option.setName('url').setDescription('The embed URL'))                  .addStringOption(option => option.setName('footer_iconurl').setDescription('The embed footer icon URL'))
134          .addStringOption(option => option.setName('fields').setDescription('The embed fields, should be in `Field 1: Value 1, Field 2: Value 2` format')),                  .addStringOption(option => option.setName('timestamp').setDescription('The embed timestamp, use \'current\' to set current date'))
135                    .addStringOption(option => option.setName('color').setDescription('The embed color (default is #007bff)'))
136                    .addStringOption(option => option.setName('url').setDescription('The embed URL'))
137                    .addStringOption(option => option.setName('fields').setDescription('The embed fields, should be in `Field 1: Value 1, Field 2: Value 2` format'))
138            )
139            .addSubcommand(subcmd =>
140                 subcmd.setName("schema").setDescription("Make and send an embed schema representation")
141                    .addStringOption(option => option.setName('author_name').setDescription('The embed author name'))
142                    .addStringOption(option => option.setName('author_iconurl').setDescription('The embed author icon URL'))
143                    .addStringOption(option => option.setName('title').setDescription('The embed title'))
144                    .addStringOption(option => option.setName('description').setDescription('The embed description'))
145                    .addStringOption(option => option.setName('thumbnail').setDescription('The embed thumbnail URL'))
146                    .addStringOption(option => option.setName('image').setDescription('The embed image attachment URL'))
147                    .addStringOption(option => option.setName('video').setDescription('The embed video attachment URL'))
148                    .addStringOption(option => option.setName('footer_text').setDescription('The embed footer text'))
149                    .addStringOption(option => option.setName('footer_iconurl').setDescription('The embed footer icon URL'))
150                    .addStringOption(option => option.setName('timestamp').setDescription('The embed timestamp, use \'current\' to set current date'))
151                    .addStringOption(option => option.setName('color').setDescription('The embed color (default is #007bff)'))
152                    .addStringOption(option => option.setName('url').setDescription('The embed URL'))
153                    .addStringOption(option => option.setName('fields').setDescription('The embed fields, should be in `Field 1: Value 1, Field 2: Value 2` format'))
154            )
155            .addSubcommand(subcmd =>
156                 subcmd.setName("build").setDescription("Build an embed from schema")
157                    .addStringOption(option => option.setName('json_schema').setDescription('The embed JSON schema'))
158            ),
159    
160      new SlashCommandBuilder().setName('queues').setDescription('List all queued jobs'),      new SlashCommandBuilder().setName('queues').setDescription('List all queued jobs'),
161    
# Line 184  let commands = [ Line 239  let commands = [
239      new SlashCommandBuilder().setName('afk').setDescription('Set your AFK status')      new SlashCommandBuilder().setName('afk').setDescription('Set your AFK status')
240          .addStringOption(option => option.setName('reason').setDescription("The reason for going AFK")),          .addStringOption(option => option.setName('reason').setDescription("The reason for going AFK")),
241            
242        new SlashCommandBuilder().setName('hash').setDescription('Generate hash for a string (text) data')
243            .addStringOption(option => option.setName('content').setDescription("The content to be hashed").setRequired(true))
244            .addStringOption(option =>
245                option
246                .setName('algorithm')
247                .setDescription("Hash algorithm")
248                .setChoices(
249                    {
250                        name: 'SHA1',
251                        value: 'sha1'
252                    },
253                    {
254                        name: 'SHA256',
255                        value: 'sha256'
256                    },
257                    {
258                        name: 'SHA512',
259                        value: 'sha512'
260                    },
261                    {
262                        name: 'MD5',
263                        value: 'md5'
264                    },
265                )
266            )
267            .addStringOption(option =>
268                option
269                .setName('digest')
270                .setDescription("Digest mode")
271                .setChoices(
272                    {
273                        name: 'HEX',
274                        value: 'hex'
275                    },
276                    {
277                        name: 'Base64',
278                        value: 'base64'
279                    },
280                    {
281                        name: 'Base64 URL',
282                        value: 'base64url'
283                    },
284                )
285            ),
286        
287      new SlashCommandBuilder().setName('announce').setDescription('Announce something')      new SlashCommandBuilder().setName('announce').setDescription('Announce something')
288          .addStringOption(option => option.setName('content').setDescription("The announcemnt message content")),          .addStringOption(option => option.setName('content').setDescription("The announcemnt message content")),
289    
# Line 217  let commands = [ Line 317  let commands = [
317    
318      new SlashCommandBuilder().setName('shot').setDescription('Give a shot to a member')      new SlashCommandBuilder().setName('shot').setDescription('Give a shot to a member')
319          .addUserOption(option => option.setName('member').setDescription("The member").setRequired(true))          .addUserOption(option => option.setName('member').setDescription("The member").setRequired(true))
320          .addStringOption(option => option.setName('reason').setDescription("The reason for giving shot to this user")),          .addStringOption(option => option.setName('reason').setDescription("The reason for giving shot to this user"))
321            .addBooleanOption(option => option.setName('anonymous').setDescription("Prevents sending your name as the 'Doctor' of the shot")),
322    
323      new SlashCommandBuilder().setName('warn').setDescription('Warn a member')      new SlashCommandBuilder().setName('warn').setDescription('Warn a member')
324          .addUserOption(option => option.setName('member').setDescription("The member").setRequired(true))          .addUserOption(option => option.setName('member').setDescription("The member").setRequired(true))
# Line 241  let commands = [ Line 342  let commands = [
342    
343      new SlashCommandBuilder().setName('warning').setDescription('Clear, remove or view warnings')      new SlashCommandBuilder().setName('warning').setDescription('Clear, remove or view warnings')
344          .addSubcommand(subcmd => {          .addSubcommand(subcmd => {
345              return subcmd.setName('view').setDescription('View information about a warning').addNumberOption(option => option.setName('id').setDescription("The warning ID").setRequired(true));              return subcmd.setName('view').setDescription('View information about a warning').addStringOption(option => option.setName('id').setDescription("The warning ID").setRequired(true));
346          })          })
347          .addSubcommand(subcmd => {          .addSubcommand(subcmd => {
348              return subcmd.setName('remove').setDescription('Remove a warning').addNumberOption(option => option.setName('id').setDescription("The warning ID").setRequired(true));              return subcmd.setName('remove').setDescription('Remove a warning').addStringOption(option => option.setName('id').setDescription("The warning ID").setRequired(true));
349          })          })
350          .addSubcommand(subcmd => {          .addSubcommand(subcmd => {
351              return subcmd.setName('list').setDescription('List warnings for a user').addUserOption(option => option.setName('user').setDescription("The user").setRequired(true));              return subcmd.setName('list').setDescription('List warnings for a user').addUserOption(option => option.setName('user').setDescription("The user").setRequired(true));

Legend:
Removed from v.248  
changed lines
  Added in v.399

[email protected]
ViewVC Help
Powered by ViewVC 1.1.26