Skip to content

Commit

Permalink
Merge pull request #549 from Joshix-1/patch-6
Browse files Browse the repository at this point in the history
Add MessageAuthor#getConnectedVoiceChannel()
  • Loading branch information
Bastian committed May 4, 2020
2 parents a34f15a + 8869a3b commit 6c78cc9
Showing 1 changed file with 11 additions and 0 deletions.
Expand Up @@ -6,6 +6,7 @@
import org.javacord.api.entity.Icon;
import org.javacord.api.entity.Nameable;
import org.javacord.api.entity.channel.Categorizable;
import org.javacord.api.entity.channel.ServerVoiceChannel;
import org.javacord.api.entity.server.Server;
import org.javacord.api.entity.user.User;
import org.javacord.api.entity.webhook.Webhook;
Expand Down Expand Up @@ -66,6 +67,16 @@ default String getDiscriminatedName() {
*/
Icon getAvatar();

/**
* Gets the voice channel this MessageAuthor (if it is an User)
* is connected to on the server where the message has been sent.
*
* @return The server voice channel the MessageAuthor is connected to.
*/
default Optional<ServerVoiceChannel> getConnectedVoiceChannel() {
return getMessage().getServer().flatMap(server -> server.getConnectedVoiceChannel(getId()));
}

/**
* Checks if the author of the message is a user.
*
Expand Down

0 comments on commit 6c78cc9

Please sign in to comment.