diff --git a/backend/src/bot/commands/mod-anouncement.command.ts b/backend/src/bot/commands/mod-anouncement.command.ts index 10b7479..3255063 100644 --- a/backend/src/bot/commands/mod-anouncement.command.ts +++ b/backend/src/bot/commands/mod-anouncement.command.ts @@ -14,10 +14,21 @@ export class MumVoiceCommand { @Handler() async onMessage( @InteractionEvent() interaction: CommandInteraction, - @IA(SlashCommandPipe, ValidationPipe) message: ModAnouncementDto, + @IA(SlashCommandPipe, ValidationPipe) dto: ModAnouncementDto, ): Promise { try { - await interaction.channel.send(message.message); + if (dto.replyToMessage != '' || dto.replyToMessage != undefined) + await interaction.channel.send({ + content: dto.message, + reply: { + messageReference: dto.replyToMessage, + failIfNotExists: true, + }, + }); + else + await interaction.channel.send({ + content: dto.message, + }); interaction.reply({ content: 'Done!', ephemeral: true, @@ -25,7 +36,7 @@ export class MumVoiceCommand { } catch (err) { interaction.reply({ content: `Failed to send message in this channel with error: ${err} and message: - ${message.message}`, + ${dto.message}`, ephemeral: true, }); } diff --git a/backend/src/bot/dto/mod-anouncement.dto.ts b/backend/src/bot/dto/mod-anouncement.dto.ts index 53f103a..991f72e 100644 --- a/backend/src/bot/dto/mod-anouncement.dto.ts +++ b/backend/src/bot/dto/mod-anouncement.dto.ts @@ -13,4 +13,13 @@ export class ModAnouncementDto { }) @IsString() message: string; + + @Param({ + name: 'replyto', + description: 'Message ID to which the bot should reply(optional)', + type: ParamType.STRING, + required: false, + }) + @IsString() + replyToMessage: string; }