Commit 87fa081
committed
hotfix(DynamicVoiceChat): delay deleting
By letting the JDA asynchornously retrieve the voice channel history and
figure out if we are going to delete the channel in question without
making sure one finishes before the other gets executed, we receive this:
RestAction queue returned failure: [ErrorResponseException] 10003:
Unknown Channel net.dv8tion.jda.api.exceptions.ContextException
at net.dv8tion.jda.api.exceptions.ContextException.here(ContextException.java:54)
at net.dv8tion.jda.api.requests.Request.<init>(Request.java:78)
at net.dv8tion.jda.internal.requests.RestActionImpl.queue(RestActionImpl.java:203)
at net.dv8tion.jda.api.requests.RestAction.queue(RestAction.java:577)
at org.togetherjava.tjbot.features.voicechat.DynamicVoiceChat.handleVoiceChannelLeave(DynamicVoiceChat.java:84)
at org.togetherjava.tjbot.features.voicechat.DynamicVoiceChat.onVoiceUpdate(DynamicVoiceChat.java:68)
at org.togetherjava.tjbot.features.system.BotCore.lambda$onGuildVoiceUpdate$1(BotCore.java:306)
at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:186)
at java.base/java.util.stream.ReferencePipeline$3$1.accept(ReferencePipeline.java:214)
Delay deleting `channelLeft` channel by 500ms and use
`RestAction#onSuccess` to make sure that the channel history request is
done _first_ and completely, before we move on to deleting the channel.
Signed-off-by: Chris Sdogkos <work@chris-sdogkos.com>channelLeft on history fetch1 parent 0309044 commit 87fa081
File tree
1 file changed
+6
-3
lines changed- application/src/main/java/org/togetherjava/tjbot/features/voicechat
1 file changed
+6
-3
lines changedLines changed: 6 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
20 | 20 | | |
21 | 21 | | |
22 | 22 | | |
| 23 | + | |
23 | 24 | | |
24 | 25 | | |
25 | 26 | | |
| |||
30 | 31 | | |
31 | 32 | | |
32 | 33 | | |
| 34 | + | |
33 | 35 | | |
34 | 36 | | |
35 | 37 | | |
| |||
87 | 89 | | |
88 | 90 | | |
89 | 91 | | |
90 | | - | |
| 92 | + | |
91 | 93 | | |
92 | 94 | | |
93 | 95 | | |
94 | | - | |
| 96 | + | |
| 97 | + | |
95 | 98 | | |
96 | | - | |
| 99 | + | |
97 | 100 | | |
98 | 101 | | |
99 | 102 | | |
| |||
0 commit comments