Skip to content

Commit

Permalink
fix: ChannelArgument#CHANNEL_FOUND_FAILURE
Browse files Browse the repository at this point in the history
  • Loading branch information
huanmeng-qwq committed Aug 27, 2024
1 parent 0752eba commit d378413
Showing 1 changed file with 2 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,11 @@
import snw.jkook.HttpAPI;
import snw.jkook.command.CommandException;
import snw.jkook.command.CommandSender;
import snw.jkook.entity.User;
import snw.jkook.entity.channel.Channel;

public class ChannelArgument<T extends Channel> extends ArgumentResolver<CommandSender, T> {
public static final MessageKey<String> CHANNEL_NOT_FOUND = MessageKey.of("channel_not_found", "Channel not found");
public static final MessageKey<CommandException> EMOJI_FOUND_FAILURE = MessageKey.of("emoji_found_failure", "Emoji found failure");
public static final MessageKey<CommandException> CHANNEL_FOUND_FAILURE = MessageKey.of("channel_found_failure", "Channel found failure");

private final HttpAPI httpAPI;
private final MessageRegistry<CommandSender> messageRegistry;
Expand All @@ -61,7 +60,7 @@ protected ParseResult<T> parse(Invocation<CommandSender> invocation, Argument<T>
}
return ParseResult.success((T) channel);
} catch (final Exception e) {
return ParseResult.failure(messageRegistry.getInvoked(EMOJI_FOUND_FAILURE, invocation, new CommandException("Channel not found", e)));
return ParseResult.failure(messageRegistry.getInvoked(CHANNEL_FOUND_FAILURE, invocation, new CommandException("Channel not found", e)));
}
}

Expand Down

0 comments on commit d378413

Please sign in to comment.