SIGMA-L / PlayerRoleChecker

MinecraftアカウントとDiscordアカウントを連携する為のプラグインです。
https://prc-mc.net
GNU General Public License v3.0
5 stars 2 forks source link

[bug] 通常のテキストチャンネル以外のチャンネルにメッセージが送信されるとエラーが発生する問題 #11

Closed wacch closed 1 year ago

wacch commented 1 year ago

PlayerRoleChecker Release4.21にてDiscordの非テキストチャンネル(アナウンスチャンネル・スレッド・フォーラム)にメッセージが送信されるとExceptionが出力されます。通常のテキストチャンネルの場合はこのエラーは出力されません。 このエラーの発生は認証システムの動作に支障をきたさないため、放置しても問題はありませんが、チャットが送信される度にExceptionが発生するので、ログが悲惨なことになります。また、問題となる対象の非テキストチャンネルは認証処理に用いることができないことが推測されます。

環境 Minecraft: Purpur1.19.2 git-1858 Plugins: PlayerRoleChecker4.21-no-mysql PlayerRoleCheckerConnector4.21-no-mysql DiscordVersion: Stable 174875 (1079875), Host 1.0.9010 (29128)

出力(メッセージ送信先がスレッドやフォーラムの場合)

[00:19:52 WARN]: Exception in thread "Thread-16" java.lang.IllegalStateException: Cannot convert channel of type ThreadChannel to TextChannel!

全文

[00:19:52 WARN]: Exception in thread "Thread-16" java.lang.IllegalStateException: Cannot convert channel of type ThreadChannel to TextChannel!
[00:19:52 WARN]:        at PlayerRoleChecker-4.21-no-mysql.jar//net.dv8tion.jda.internal.utils.Helpers.safeChannelCast(Helpers.java:56)
[00:19:52 WARN]:        at PlayerRoleChecker-4.21-no-mysql.jar//net.dv8tion.jda.internal.entities.AbstractChannelImpl.asTextChannel(AbstractChannelImpl.java:79)
[00:19:52 WARN]:        at PlayerRoleChecker-4.21-no-mysql.jar//net.klnetwork.playerrolechecker.api.discord.data.CommandData.getTextChannel(CommandData.java:45)
[00:19:52 WARN]:        at PlayerRoleChecker-4.21-no-mysql.jar//net.klnetwork.playerrolechecker.api.discord.data.Command.isWorkCommand(Command.java:50)
[00:19:52 WARN]:        at PlayerRoleChecker-4.21-no-mysql.jar//net.klnetwork.playerrolechecker.api.discord.CommandManager.lambda$onMessageReceived$1(CommandManager.java:53)
[00:19:52 WARN]:        at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:178)
[00:19:52 WARN]:        at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
[00:19:52 WARN]:        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
[00:19:52 WARN]:        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
[00:19:52 WARN]:        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
[00:19:52 WARN]:        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
[00:19:52 WARN]:        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
[00:19:52 WARN]:        at PlayerRoleChecker-4.21-no-mysql.jar//net.klnetwork.playerrolechecker.api.discord.CommandManager.lambda$onMessageReceived$3(CommandManager.java:55)
[00:19:52 WARN]:        at java.base/java.lang.Thread.run(Thread.java:833)
[00:20:04 WARN]: Exception in thread "Thread-17" java.lang.IllegalStateException: Cannot convert channel of type ThreadChannel to TextChannel!
[00:20:04 WARN]:        at PlayerRoleChecker-4.21-no-mysql.jar//net.dv8tion.jda.internal.utils.Helpers.safeChannelCast(Helpers.java:56)
[00:20:04 WARN]:        at PlayerRoleChecker-4.21-no-mysql.jar//net.dv8tion.jda.internal.entities.AbstractChannelImpl.asTextChannel(AbstractChannelImpl.java:79)
[00:20:04 WARN]:        at PlayerRoleChecker-4.21-no-mysql.jar//net.klnetwork.playerrolechecker.api.discord.data.CommandData.getTextChannel(CommandData.java:45)
[00:20:04 WARN]:        at PlayerRoleChecker-4.21-no-mysql.jar//net.klnetwork.playerrolechecker.api.discord.data.Command.isWorkCommand(Command.java:50)
[00:20:04 WARN]:        at PlayerRoleChecker-4.21-no-mysql.jar//net.klnetwork.playerrolechecker.api.discord.CommandManager.lambda$onMessageReceived$1(CommandManager.java:53)
[00:20:04 WARN]:        at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:178)
[00:20:04 WARN]:        at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
[00:20:04 WARN]:        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
[00:20:04 WARN]:        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
[00:20:04 WARN]:        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
[00:20:04 WARN]:        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
[00:20:04 WARN]:        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
[00:20:04 WARN]:        at PlayerRoleChecker-4.21-no-mysql.jar//net.klnetwork.playerrolechecker.api.discord.CommandManager.lambda$onMessageReceived$3(CommandManager.java:55)
[00:20:04 WARN]:        at java.base/java.lang.Thread.run(Thread.java:833)

出力(メッセージ送信先がアナウンスチャンネルの場合)

[00:00:51 WARN]: Exception in thread "Thread-23" java.lang.IllegalStateException: Cannot convert channel of type NewsChannel to TextChannel!

全文

[00:00:51 WARN]: Exception in thread "Thread-23" java.lang.IllegalStateException: Cannot convert channel of type NewsChannel to TextChannel!
[00:00:51 WARN]:        at PlayerRoleChecker-4.21-no-mysql.jar//net.dv8tion.jda.internal.utils.Helpers.safeChannelCast(Helpers.java:56)
[00:00:51 WARN]:        at PlayerRoleChecker-4.21-no-mysql.jar//net.dv8tion.jda.internal.entities.AbstractChannelImpl.asTextChannel(AbstractChannelImpl.java:79)
[00:00:51 WARN]:        at PlayerRoleChecker-4.21-no-mysql.jar//net.klnetwork.playerrolechecker.api.discord.data.CommandData.getTextChannel(CommandData.java:45)
[00:00:51 WARN]:        at PlayerRoleChecker-4.21-no-mysql.jar//net.klnetwork.playerrolechecker.api.discord.data.Command.isWorkCommand(Command.java:50)
[00:00:51 WARN]:        at PlayerRoleChecker-4.21-no-mysql.jar//net.klnetwork.playerrolechecker.api.discord.CommandManager.lambda$onMessageReceived$1(CommandManager.java:53)
[00:00:51 WARN]:        at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:178)
[00:00:51 WARN]:        at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
[00:00:51 WARN]:        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
[00:00:51 WARN]:        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
[00:00:51 WARN]:        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
[00:00:51 WARN]:        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
[00:00:51 WARN]:        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
[00:00:51 WARN]:        at PlayerRoleChecker-4.21-no-mysql.jar//net.klnetwork.playerrolechecker.api.discord.CommandManager.lambda$onMessageReceived$3(CommandManager.java:55)
[00:00:51 WARN]:        at java.base/java.lang.Thread.run(Thread.java:833)
[00:01:57 WARN]: Exception in thread "Thread-24" java.lang.IllegalStateException: Cannot convert channel of type NewsChannel to TextChannel!
[00:01:57 WARN]:        at PlayerRoleChecker-4.21-no-mysql.jar//net.dv8tion.jda.internal.utils.Helpers.safeChannelCast(Helpers.java:56)
[00:01:57 WARN]:        at PlayerRoleChecker-4.21-no-mysql.jar//net.dv8tion.jda.internal.entities.AbstractChannelImpl.asTextChannel(AbstractChannelImpl.java:79)
[00:01:57 WARN]:        at PlayerRoleChecker-4.21-no-mysql.jar//net.klnetwork.playerrolechecker.api.discord.data.CommandData.getTextChannel(CommandData.java:45)
[00:01:57 WARN]:        at PlayerRoleChecker-4.21-no-mysql.jar//net.klnetwork.playerrolechecker.api.discord.data.Command.isWorkCommand(Command.java:50)
[00:01:57 WARN]:        at PlayerRoleChecker-4.21-no-mysql.jar//net.klnetwork.playerrolechecker.api.discord.CommandManager.lambda$onMessageReceived$1(CommandManager.java:53)
[00:01:57 WARN]:        at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:178)
[00:01:57 WARN]:        at java.base/java.util.ArrayList$ArrayListSpliterator.forEachRemaining(ArrayList.java:1625)
[00:01:57 WARN]:        at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:509)
[00:01:57 WARN]:        at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:499)
[00:01:57 WARN]:        at java.base/java.util.stream.ReduceOps$ReduceOp.evaluateSequential(ReduceOps.java:921)
[00:01:57 WARN]:        at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
[00:01:57 WARN]:        at java.base/java.util.stream.ReferencePipeline.collect(ReferencePipeline.java:682)
[00:01:57 WARN]:        at PlayerRoleChecker-4.21-no-mysql.jar//net.klnetwork.playerrolechecker.api.discord.CommandManager.lambda$onMessageReceived$3(CommandManager.java:55)
[00:01:57 WARN]:        at java.base/java.lang.Thread.run(Thread.java:833)