Skip to content

Commit

Permalink
fix: use enum
Browse files Browse the repository at this point in the history
  • Loading branch information
xhyrom committed Feb 13, 2022
1 parent 9060f66 commit ff09917
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 7 deletions.
7 changes: 2 additions & 5 deletions src/handlers/MessageCommandHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,11 +48,8 @@ const checkValidation = async(arg: MessageArgumentTypes, content: string | Messa
} else {
channel.send(text);
const message = await channel.awaitMessages({ filter: (m) => m.author.id === user.id && m.channelId === channel.id, time: 60000, max: 1 });

/**
* TODO: Use ArgumentType.ATTACHMENT | Need wait for https://github.com/Garlic-Team/gcommands/pull/314 to be merged (:
* @ts-expect-error */
if (argument.type == 11) {

if (argument.type == ArgumentType.ATTACHMENT) {
const attachments = [...message.values()]?.[0]?.attachments;
content = attachments ? [...attachments.values()][0] : null;
}
Expand Down
3 changes: 1 addition & 2 deletions src/lib/structures/arguments/base.ts
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,7 @@ export class MessageArgumentTypeBase {
const { UserType } = await import('./User');
return new UserType(guild);
}
// @ts-expect-error TODO: Use ArgumentType.ATTACHMENT | Need wait for https://github.com/Garlic-Team/gcommands/pull/314 to be merged (:
case 11: {
case ArgumentType.ATTACHMENT: {
const { AttachmentType } = await import('./Attachment');
return new AttachmentType();
}
Expand Down

0 comments on commit ff09917

Please sign in to comment.