Skip to content

Commit

Permalink
Fix mirroring support for non-text and thread channels
Browse files Browse the repository at this point in the history
  • Loading branch information
Vankka committed Sep 26, 2024
1 parent 0906ef6 commit b8f8b7d
Showing 1 changed file with 5 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -473,14 +473,12 @@ private MessageReference getReference(
boolean webhookMessage,
MirroringConfig config
) {
if (channel instanceof DiscordTextChannel) {
DiscordTextChannel textChannel = (DiscordTextChannel) channel;
return new MessageReference(textChannel, messageId, webhookMessage, config);
} else if (channel instanceof DiscordThreadChannel) {
if (channel instanceof DiscordThreadChannel) {
DiscordThreadChannel threadChannel = (DiscordThreadChannel) channel;
return new MessageReference(threadChannel, messageId, webhookMessage, config);
} else {
return new MessageReference(channel, messageId, webhookMessage, config);
}
throw new IllegalStateException("Unexpected channel type: " + channel.getClass().getName());
}

private static class MirrorOperation {
Expand Down Expand Up @@ -549,12 +547,12 @@ private static class MessageReference {
private final MirroringConfig config;

public MessageReference(
DiscordTextChannel textChannel,
DiscordMessageChannel messageChannel,
long messageId,
boolean webhookMessage,
MirroringConfig config
) {
this(textChannel.getId(), -1L, messageId, webhookMessage, config);
this(messageChannel.getId(), -1L, messageId, webhookMessage, config);
}

public MessageReference(
Expand Down

0 comments on commit b8f8b7d

Please sign in to comment.