-
-
Notifications
You must be signed in to change notification settings - Fork 728
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
Move requestToSpeak to StageChannel #1978
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -37,7 +37,6 @@ | |
import net.dv8tion.jda.api.requests.restaction.order.ChannelOrderAction; | ||
import net.dv8tion.jda.api.requests.restaction.order.RoleOrderAction; | ||
import net.dv8tion.jda.api.requests.restaction.pagination.AuditLogPaginationAction; | ||
import net.dv8tion.jda.api.utils.TimeUtil; | ||
import net.dv8tion.jda.api.utils.cache.*; | ||
import net.dv8tion.jda.api.utils.concurrent.Task; | ||
import net.dv8tion.jda.api.utils.data.DataArray; | ||
|
@@ -936,11 +935,13 @@ public synchronized Task<Void> cancelRequestToSpeak() | |
} | ||
|
||
AudioChannel channel = getSelfMember().getVoiceState().getChannel(); | ||
StageInstance instance = channel instanceof StageChannel ? ((StageChannel) channel).getStageInstance() : null; | ||
if (instance == null) | ||
return new GatewayTask<>(CompletableFuture.completedFuture(null), () -> {}); | ||
CompletableFuture<Void> future = instance.cancelRequestToSpeak().submit(); | ||
return new GatewayTask<>(future, () -> future.cancel(false)); | ||
if (channel instanceof StageChannel) | ||
{ | ||
CompletableFuture<Void> future = ((StageChannel) channel).cancelRequestToSpeak().submit(); | ||
return new GatewayTask<>(future, () -> future.cancel(false)); | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are these There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Is it just so that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Symmetry and my hopes that this will in the future be a request you can do through the gateway |
||
} | ||
|
||
return new GatewayTask<>(CompletableFuture.completedFuture(null), () -> {}); | ||
} | ||
|
||
@Nonnull | ||
|
@@ -1785,14 +1786,19 @@ public synchronized void updateRequestToSpeak() | |
if (!(connectedChannel instanceof StageChannel)) | ||
return; | ||
StageChannel stage = (StageChannel) connectedChannel; | ||
StageInstance instance = stage.getStageInstance(); | ||
if (instance == null) | ||
return; | ||
|
||
CompletableFuture<Void> future = pendingRequestToSpeak; | ||
pendingRequestToSpeak = null; | ||
|
||
instance.requestToSpeak().queue((v) -> future.complete(null), future::completeExceptionally); | ||
try | ||
{ | ||
stage.requestToSpeak().queue((v) -> future.complete(null), future::completeExceptionally); | ||
} | ||
catch (Throwable ex) | ||
{ | ||
future.completeExceptionally(ex); | ||
if (ex instanceof Error) | ||
throw ex; | ||
} | ||
} | ||
|
||
// ---- Setters ----- | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I wonder if they'll kill off the entire "privacy level" concept