Skip to content

Commit

Permalink
fix(MessageCommandHandler): editReply, choices
Browse files Browse the repository at this point in the history
  • Loading branch information
xhyrom committed Feb 14, 2022
1 parent aa1746c commit e246342
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/handlers/MessageCommandHandler.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { Client, Collection, CommandInteractionOptionResolver, Guild, Message, MessageAttachment, SelectMenuInteraction, TextChannel, User } from 'discord.js';
import { Client, Collection, CommandInteractionOptionResolver, Guild, InteractionReplyOptions, Message, MessageAttachment, MessagePayload, ReplyMessageOptions, SelectMenuInteraction, TextChannel, User } from 'discord.js';
import type { GClient } from '../lib/GClient';
import { CommandContext } from '../lib/structures/contexts/CommandContext';
import { CommandType } from '../lib/structures/Command';
Expand All @@ -15,7 +15,7 @@ const cooldowns = new Collection<string, Collection<string, number>>();
const checkValidation = async(arg: MessageArgumentTypes, content: string | MessageAttachment, client: Client, guild: Guild, argument: Argument, channel: TextChannel, user: User) => {
if (!content) {
const text = (await Util.getResponse('ARGUMENT_REQUIRED', { client })).replace('{user}', user.toString()).replace('{name}', argument.name).replace('{type}', Util.toPascalCase(ArgumentType[argument.type.toString()]));
if (argument.type === ArgumentType.STRING && argument.choices?.length !== 0) {
if (argument.type === ArgumentType.STRING && argument.choices && argument.choices.length !== 0) {
const message = await channel.send({
content: text,
components: [
Expand Down Expand Up @@ -138,7 +138,12 @@ export async function MessageCommandHandler(
return replied;
},
followUp: message.reply.bind(message),
reply: message.reply.bind(message),
// @ts-expect-error This will not be fixed (typings for interaction are more important)
reply: async(options: string | MessagePayload | ReplyMessageOptions | InteractionReplyOptions) => {
const msg = await message.reply(options);
replied = msg;
return msg;
},
});

if (!(await command.inhibit(ctx))) return;
Expand Down

0 comments on commit e246342

Please sign in to comment.