Skip to content

Commit ee731ee

Browse files
authored
fixed thread transfers (#976)
* fixed thread transfers * fixed import * used getChannelById
1 parent 90647f8 commit ee731ee

File tree

1 file changed

+2
-6
lines changed

1 file changed

+2
-6
lines changed

application/src/main/java/org/togetherjava/tjbot/features/moderation/TransferQuestionCommand.java

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
import net.dv8tion.jda.api.entities.MessageEmbed;
88
import net.dv8tion.jda.api.entities.User;
99
import net.dv8tion.jda.api.entities.channel.concrete.ForumChannel;
10-
import net.dv8tion.jda.api.entities.channel.concrete.TextChannel;
1110
import net.dv8tion.jda.api.entities.channel.forums.ForumPost;
1211
import net.dv8tion.jda.api.entities.channel.forums.ForumTag;
1312
import net.dv8tion.jda.api.entities.channel.forums.ForumTagSnowflake;
13+
import net.dv8tion.jda.api.entities.channel.middleman.MessageChannel;
1414
import net.dv8tion.jda.api.entities.channel.unions.MessageChannelUnion;
1515
import net.dv8tion.jda.api.events.interaction.ModalInteractionEvent;
1616
import net.dv8tion.jda.api.events.interaction.command.MessageContextInteractionEvent;
@@ -36,7 +36,6 @@
3636

3737
import java.awt.Color;
3838
import java.util.List;
39-
import java.util.Objects;
4039
import java.util.Optional;
4140
import java.util.function.Consumer;
4241
import java.util.function.Function;
@@ -252,10 +251,7 @@ private RestAction<Message> dmUser(MessageChannelUnion sourceChannel,
252251
}
253252

254253
private RestAction<Void> deleteOriginalMessage(JDA jda, String channelId, String messageId) {
255-
TextChannel sourceChannel = Objects.requireNonNull(jda.getTextChannelById(channelId),
256-
"Source channel could not be found for transfer-question feature");
257-
258-
return sourceChannel.deleteMessageById(messageId);
254+
return jda.getChannelById(MessageChannel.class, channelId).deleteMessageById(messageId);
259255
}
260256

261257
private ForumChannel getHelperForum(JDA jda) {

0 commit comments

Comments
 (0)