Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Made remindme command's implementation global to MessageChannel #422

Merged
merged 1 commit into from
May 3, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ private static void sendReminder(@NotNull JDA jda, long id, long channelId, long
private static RestAction<ReminderRoute> computeReminderRoute(@NotNull JDA jda, long channelId,
long authorId) {
// If guild channel can still be found, send there
TextChannel channel = jda.getTextChannelById(channelId);
MessageChannel channel = jda.getChannelById(MessageChannel.class, channelId);
if (channel != null) {
return createGuildReminderRoute(jda, authorId, channel);
}
Expand All @@ -81,7 +81,7 @@ private static RestAction<ReminderRoute> computeReminderRoute(@NotNull JDA jda,
}

private static @NotNull RestAction<ReminderRoute> createGuildReminderRoute(@NotNull JDA jda,
long authorId, @NotNull TextChannel channel) {
long authorId, @NotNull MessageChannel channel) {
return jda.retrieveUserById(authorId)
.onErrorMap(error -> null)
.map(author -> ReminderRoute.toPublic(channel, author));
Expand Down Expand Up @@ -128,7 +128,7 @@ Failed to send a reminder (id '{}'), skipping it. This can be due to a network i

private record ReminderRoute(@NotNull MessageChannel channel, @Nullable User target,
@Nullable String description) {
static ReminderRoute toPublic(@NotNull TextChannel channel, @Nullable User target) {
static ReminderRoute toPublic(@NotNull MessageChannel channel, @Nullable User target) {
return new ReminderRoute(channel, target,
target == null ? null : target.getAsMention());
}
Expand Down