/ src / commands / guide.ts
guide.ts
 1  import { AmethystCommand } from 'amethystjs';
 2  import { ActionRowBuilder, ButtonBuilder, ButtonStyle, EmbedBuilder } from 'discord.js';
 3  import { buildLocalizations } from '../utils/functions';
 4  
 5  const locals = buildLocalizations('guide');
 6  export default new AmethystCommand({
 7      name: 'guide',
 8      description: 'Display the guide of the bot',
 9      nameLocalizations: locals.name,
10      descriptionLocalizations: locals.description
11  }).setChatInputRun(async ({ interaction }) => {
12      await Promise.all([interaction.deferReply(), interaction.client.application.commands.fetch()]);
13  
14      const getCmd = (name: string) => {
15          return `</${name}:${interaction.client.application.commands.cache.find((x) => x.name === name)?.id}>`;
16      };
17  
18      const embed = new EmbedBuilder()
19          .setTitle(interaction.client.langs.getText(interaction, 'guide', 'title'))
20          .setColor('Orange')
21          .setDescription(
22              `${interaction.client.langs.getText(interaction, 'guide', 'intro')}\n\n${interaction.client.langs.getText(
23                  interaction,
24                  'guide',
25                  'playMusic',
26                  { play: getCmd('play') }
27              )}\n\n${interaction.client.langs.getText(interaction, 'guide', 'recommendation', {
28                  play: getCmd('play')
29              })}\n\n${interaction.client.langs.getText(interaction, 'guide', 'songAddition', {
30                  add: getCmd('add')
31              })}\n\n${interaction.client.langs.getText(interaction, 'guide', 'autoadd', {
32                  autoadd: getCmd('autoadd')
33              })}\n\n${interaction.client.langs.getText(interaction, 'guide', 'protip', {
34                  playing: getCmd('playing')
35              })}\n\n${interaction.client.langs.getText(interaction, 'guide', 'feedback', {
36                  support: 'https://discord.gg/fHyN5w84g6',
37                  topgg: 'https://top.gg/bot/1037028318404419596',
38                  playing: getCmd('playing'),
39                  info: getCmd('info')
40              })}`
41          )
42          .setThumbnail(interaction.client.user.displayAvatarURL());
43  
44      interaction
45          .editReply({
46              embeds: [embed],
47              components: [
48                  new ActionRowBuilder().setComponents(
49                      interaction.client.langs.getButton(interaction, 'deleteMessage', {
50                          style: 'Danger',
51                          id: 'delete-message'
52                      })
53                  ) as ActionRowBuilder<ButtonBuilder>
54              ]
55          })
56          .catch(() => {});
57  });