Interface VoiceManager


public interface VoiceManager
Manager for voice connections and audio handling.

Plugins can use this interface to join/leave voice channels and manage audio.

DAVE Requirement: Starting March 1st, 2026, all voice connections require DAVE (Discord Audio/Voice Encryption). Plugins MUST provide a DAVEProvider when connecting to voice channels.

Example Usage:

VoiceManager voiceManager = context.getVoiceManager();

// Check DAVE availability before connecting
if (!voiceManager.isDAVEAvailable(guildId)) {
    context.log("error", "DAVE implementation required for voice");
    return;
}

// Connect to voice channel
voiceManager.connect(guildId, voiceChannelId)
    .thenAccept(status -> {
        if (status == VoiceConnectionStatus.CONNECTED) {
            context.log("info", "Connected to voice!");
        }
    });
  • Method Details

    • connect

      CompletableFuture<VoiceConnectionStatus> connect(long guildId, long voiceChannelId)
      Connect to a voice channel.

      This requires a DAVE implementation to be registered for the guild.

      Parameters:
      guildId - the guild ID
      voiceChannelId - the voice channel ID
      Returns:
      a future containing the connection status
    • disconnect

      CompletableFuture<Void> disconnect(long guildId)
      Disconnect from a voice channel in a guild.
      Parameters:
      guildId - the guild ID
      Returns:
      a future that completes when disconnected
    • getConnectionStatus

      VoiceConnectionStatus getConnectionStatus(long guildId)
      Get the current connection status for a guild.
      Parameters:
      guildId - the guild ID
      Returns:
      the current connection status
    • isConnected

      boolean isConnected(long guildId)
      Check if the bot is connected to a voice channel in a guild.
      Parameters:
      guildId - the guild ID
      Returns:
      true if connected
    • getConnectedChannelId

      Long getConnectedChannelId(long guildId)
      Get the voice channel ID the bot is connected to in a guild.
      Parameters:
      guildId - the guild ID
      Returns:
      the voice channel ID, or null if not connected
    • setAudioProvider

      void setAudioProvider(long guildId, AudioProvider provider)
      Set the audio provider for a guild. The provider will supply audio data to be played in the voice channel.
      Parameters:
      guildId - the guild ID
      provider - the audio provider, or null to clear
    • getAudioProvider

      AudioProvider getAudioProvider(long guildId)
      Get the current audio provider for a guild.
      Parameters:
      guildId - the guild ID
      Returns:
      the audio provider, or null if none set
    • setAudioReceiver

      void setAudioReceiver(long guildId, AudioReceiver receiver)
      Set the audio receiver for a guild. The receiver will receive audio data from users in the voice channel.
      Parameters:
      guildId - the guild ID
      receiver - the audio receiver, or null to clear
    • getAudioReceiver

      AudioReceiver getAudioReceiver(long guildId)
      Get the current audio receiver for a guild.
      Parameters:
      guildId - the guild ID
      Returns:
      the audio receiver, or null if none set
    • isDAVEAvailable

      boolean isDAVEAvailable(long guildId)
      Check if a DAVE implementation is available for use.

      This checks if any DAVE provider has been registered and is ready.

      Parameters:
      guildId - the guild ID (for future per-guild DAVE support)
      Returns:
      true if DAVE is available
    • isJavaVersionCompatible

      boolean isJavaVersionCompatible()
      Check if the current Java version is compatible with DAVE.
      Returns:
      true if Java version meets minimum requirements
    • getDAVEDeadline

      default String getDAVEDeadline()
      Get the DAVE deadline date.
      Returns:
      the deadline date string "March 1st, 2026"
    • registerDAVEProvider

      void registerDAVEProvider(String pluginName, DAVEProvider provider)
      Register a DAVE provider for a plugin. Plugins providing DAVE implementations should call this.
      Parameters:
      pluginName - the name of the plugin providing DAVE
      provider - the DAVE provider implementation
    • unregisterDAVEProvider

      void unregisterDAVEProvider(String pluginName)
      Unregister a DAVE provider.
      Parameters:
      pluginName - the name of the plugin
    • getActiveDAVEProvider

      DAVEProvider getActiveDAVEProvider()
      Get the currently active DAVE provider.
      Returns:
      the active DAVE provider, or null if none
    • setSelfMuted

      void setSelfMuted(long guildId, boolean muted)
      Set whether the bot is self-muted in a guild.
      Parameters:
      guildId - the guild ID
      muted - true to mute
    • isSelfMuted

      boolean isSelfMuted(long guildId)
      Check if the bot is self-muted in a guild.
      Parameters:
      guildId - the guild ID
      Returns:
      true if self-muted
    • setSelfDeafened

      void setSelfDeafened(long guildId, boolean deafened)
      Set whether the bot is self-deafened in a guild.
      Parameters:
      guildId - the guild ID
      deafened - true to deafen
    • isSelfDeafened

      boolean isSelfDeafened(long guildId)
      Check if the bot is self-deafened in a guild.
      Parameters:
      guildId - the guild ID
      Returns:
      true if self-deafened