-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Reworked /report command, now it gives a link to issues or discussions. Removed modal handling. Command //setPrefix now accepts prefix with length of two characters. Added wiki page for Commands. Command audiodebug available only for overpowered user.
- Loading branch information
1 parent
48612b0
commit 64f77ac
Showing
23 changed files
with
204 additions
and
107 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,58 +1,42 @@ | ||
import { ICommand } from '../../CommandTypes.js'; | ||
import { | ||
ActionRowBuilder, | ||
ChatInputCommandInteraction, | ||
Message, | ||
ModalActionRowComponentBuilder, | ||
ModalBuilder, | ||
PermissionsBitField, | ||
SlashCommandBuilder, | ||
TextInputBuilder, | ||
TextInputStyle | ||
SlashCommandBuilder | ||
} from 'discord.js'; | ||
import { GroupInfo } from './InfoTypes.js'; | ||
import i18next from 'i18next'; | ||
import { generateSimpleEmbed } from '../../utilities/generateSimpleEmbed.js'; | ||
|
||
export default function (): ICommand { | ||
return { | ||
text_data: { | ||
name: 'report', | ||
description: i18next.t('commands:report_desc'), | ||
execute: async (message: Message) => { | ||
await message.reply(i18next.t('commands:report_text_error') as string); | ||
await message.reply({ embeds: [generateReportEmbed()] }); | ||
} | ||
}, | ||
slash_data: { | ||
slash_builder: new SlashCommandBuilder() | ||
.setName('report') | ||
.setDescription(i18next.t('commands:report_desc')), | ||
execute: async (interaction: ChatInputCommandInteraction) => { | ||
await interaction.showModal(generateModalWindow()); | ||
await interaction.reply({ embeds: [generateReportEmbed()], ephemeral: true }); | ||
} | ||
}, | ||
group: GroupInfo, | ||
bot_permissions: [PermissionsBitField.Flags.SendMessages] | ||
}; | ||
} | ||
|
||
function generateModalWindow() { | ||
const modal = new ModalBuilder() | ||
.setCustomId('reportModal') | ||
.setTitle(i18next.t('commands:report_modal_title')); | ||
|
||
const reportInput = new TextInputBuilder() | ||
.setCustomId('reportInput') | ||
.setLabel(i18next.t('commands:report_modal_text_label')) | ||
.setStyle(TextInputStyle.Paragraph) | ||
.setMinLength(20) | ||
.setPlaceholder(i18next.t('commands:report_modal_text_placeholder')) | ||
.setRequired(true); | ||
|
||
const firstActionRow = new ActionRowBuilder<ModalActionRowComponentBuilder>().addComponents( | ||
reportInput | ||
function generateReportEmbed() { | ||
return generateSimpleEmbed( | ||
i18next.t('commands:report_message', { | ||
issueLink: 'https://github.com/AlexInCube/AlCoTest/issues/new/choose', | ||
discussionLink: 'https://github.com/AlexInCube/AlCoTest/discussions/new?category=q-a', | ||
interpolation: { escapeValue: false } | ||
}) | ||
); | ||
|
||
modal.addComponents(firstActionRow); | ||
|
||
return modal; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
import { ENV } from '../EnvironmentVariables.js'; | ||
|
||
export function isOverpoweredUser(userId: string): boolean { | ||
return userId === ENV.BOT_DISCORD_OVERPOWERED_ID; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.