Interface IGuildChannelContainer

  • All Known Subinterfaces:
    Guild, JDA, ShardManager
    All Known Implementing Classes:
    DefaultShardManager

    public interface IGuildChannelContainer
    Provides various channel cache getters for Guild channels.

    These getters only check the caches with the relevant scoping of the implementing type. For example, Guild returns channels that exist within the guild, whereas JDA or ShardManager returns any channels that exist within the shard.
    If this is called on JDA or ShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building your JDA instance, you can use JDA.awaitReady().

    For the most efficient usage, it is recommended to use CacheView getters such as getTextChannelCache(). List getters usually require making a snapshot copy of the underlying cache view, which may introduce an undesirable performance hit.

    • Method Detail

      • getChannelById

        @Nullable
        default <T extends Channel> T getChannelById​(@Nonnull
                                                     Class<T> type,
                                                     @Nonnull
                                                     String id)
        Get a channel of the specified type by id.

        This will automatically check for all channel types and cast to the specified class. If a channel with the specified id does not exist, or exists but is not an instance of the provided class, this returns null.

        Type Parameters:
        T - The type argument for the class
        Parameters:
        type - Class of a channel type
        id - The snowflake id of the channel
        Returns:
        The casted channel, if it exists and is assignable to the provided class, or null
        Throws:
        IllegalArgumentException - If null is provided, or the id is not a valid snowflake
      • getChannelById

        @Nullable
        default <T extends Channel> T getChannelById​(@Nonnull
                                                     Class<T> type,
                                                     long id)
        Get a channel of the specified type by id.

        This will automatically check for all channel types and cast to the specified class. If a channel with the specified id does not exist, or exists but is not an instance of the provided class, this returns null.

        Type Parameters:
        T - The type argument for the class
        Parameters:
        type - Class of a channel type
        id - The snowflake id of the channel
        Returns:
        The casted channel, if it exists and is assignable to the provided class, or null
        Throws:
        IllegalArgumentException - If null is provided
      • getStageChannelsByName

        @Nonnull
        default List<StageChannel> getStageChannelsByName​(@Nonnull
                                                          String name,
                                                          boolean ignoreCase)
        Gets a list of all StageChannels in this Guild that have the same name as the one provided.
        If there are no channels with the provided name, then this returns an empty list.

        This getter exists on any instance of IGuildChannelContainer and only checks the caches with the relevant scoping. For Guild, JDA, or ShardManager, this returns the relevant channel with respect to the cache within each of those objects. For a guild, this would mean it only returns channels within the same guild.
        If this is called on JDA or ShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building your JDA instance, you can use JDA.awaitReady().

        Parameters:
        name - The name used to filter the returned StageChannels.
        ignoreCase - Determines if the comparison ignores case when comparing. True - case insensitive.
        Returns:
        Possibly-empty immutable list of all StageChannel names that match the provided name.
      • getStageChannelById

        @Nullable
        default StageChannel getStageChannelById​(@Nonnull
                                                 String id)
        Gets a StageChannel that has the same id as the one provided.
        If there is no channel with an id that matches the provided one, then this returns null.

        This getter exists on any instance of IGuildChannelContainer and only checks the caches with the relevant scoping. For Guild, JDA, or ShardManager, this returns the relevant channel with respect to the cache within each of those objects. For a guild, this would mean it only returns channels within the same guild.
        If this is called on JDA or ShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building your JDA instance, you can use JDA.awaitReady().

        Parameters:
        id - The id of the StageChannel.
        Returns:
        Possibly-null StageChannel with matching id.
        Throws:
        NumberFormatException - If the provided id cannot be parsed by Long.parseLong(String)
      • getStageChannelById

        @Nullable
        default StageChannel getStageChannelById​(long id)
        Gets a StageChannel that has the same id as the one provided.
        If there is no channel with an id that matches the provided one, then this returns null.

        This getter exists on any instance of IGuildChannelContainer and only checks the caches with the relevant scoping. For Guild, JDA, or ShardManager, this returns the relevant channel with respect to the cache within each of those objects. For a guild, this would mean it only returns channels within the same guild.
        If this is called on JDA or ShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building your JDA instance, you can use JDA.awaitReady().

        Parameters:
        id - The id of the StageChannel.
        Returns:
        Possibly-null StageChannel with matching id.
      • getStageChannels

        @Nonnull
        default List<StageChannel> getStageChannels()
        Gets all StageChannels in the cache.
        In Guild cache, channels are sorted according to their position and id.

        This copies the backing store into a list. This means every call creates a new list with O(n) complexity. It is recommended to store this into a local variable or use getStageChannelCache() and use its more efficient versions of handling these values.

        This getter exists on any instance of IGuildChannelContainer and only checks the caches with the relevant scoping. For Guild, JDA, or ShardManager, this returns the relevant channel with respect to the cache within each of those objects. For a guild, this would mean it only returns channels within the same guild.
        If this is called on JDA or ShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building your JDA instance, you can use JDA.awaitReady().

        Returns:
        An immutable List of StageChannels.
      • getThreadChannelsByName

        @Nonnull
        default List<ThreadChannel> getThreadChannelsByName​(@Nonnull
                                                            String name,
                                                            boolean ignoreCase)
        Gets a list of all ThreadChannels in this Guild that have the same name as the one provided.
        If there are no channels with the provided name, then this returns an empty list.

        This getter exists on any instance of IGuildChannelContainer and only checks the caches with the relevant scoping. For Guild, JDA, or ShardManager, this returns the relevant channel with respect to the cache within each of those objects. For a guild, this would mean it only returns channels within the same guild.
        If this is called on JDA or ShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building your JDA instance, you can use JDA.awaitReady().

        Parameters:
        name - The name used to filter the returned ThreadChannels.
        ignoreCase - Determines if the comparison ignores case when comparing. True - case insensitive.
        Returns:
        Possibly-empty immutable list of all ThreadChannel names that match the provided name.
      • getThreadChannelById

        @Nullable
        default ThreadChannel getThreadChannelById​(@Nonnull
                                                   String id)
        Gets a ThreadChannel that has the same id as the one provided.
        If there is no channel with an id that matches the provided one, then this returns null.

        This getter exists on any instance of IGuildChannelContainer and only checks the caches with the relevant scoping. For Guild, JDA, or ShardManager, this returns the relevant channel with respect to the cache within each of those objects. For a guild, this would mean it only returns channels within the same guild.
        If this is called on JDA or ShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building your JDA instance, you can use JDA.awaitReady().

        Parameters:
        id - The id of the ThreadChannel.
        Returns:
        Possibly-null ThreadChannel with matching id.
        Throws:
        NumberFormatException - If the provided id cannot be parsed by Long.parseLong(String)
      • getThreadChannelById

        @Nullable
        default ThreadChannel getThreadChannelById​(long id)
        Gets a ThreadChannel that has the same id as the one provided.
        If there is no channel with an id that matches the provided one, then this returns null.

        This getter exists on any instance of IGuildChannelContainer and only checks the caches with the relevant scoping. For Guild, JDA, or ShardManager, this returns the relevant channel with respect to the cache within each of those objects. For a guild, this would mean it only returns channels within the same guild.
        If this is called on JDA or ShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building your JDA instance, you can use JDA.awaitReady().

        Parameters:
        id - The id of the ThreadChannel.
        Returns:
        Possibly-null ThreadChannel with matching id.
      • getThreadChannels

        @Nonnull
        default List<ThreadChannel> getThreadChannels()
        Gets all ThreadChannel in the cache.

        This copies the backing store into a list. This means every call creates a new list with O(n) complexity. It is recommended to store this into a local variable or use getThreadChannelCache() and use its more efficient versions of handling these values.

        This getter exists on any instance of IGuildChannelContainer and only checks the caches with the relevant scoping. For Guild, JDA, or ShardManager, this returns the relevant channel with respect to the cache within each of those objects. For a guild, this would mean it only returns channels within the same guild.
        If this is called on JDA or ShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building your JDA instance, you can use JDA.awaitReady().

        Returns:
        An immutable List of ThreadChannels.
      • getCategoriesByName

        @Nonnull
        default List<Category> getCategoriesByName​(@Nonnull
                                                   String name,
                                                   boolean ignoreCase)
        Gets a list of all Categories in this Guild that have the same name as the one provided.
        If there are no channels with the provided name, then this returns an empty list.

        This getter exists on any instance of IGuildChannelContainer and only checks the caches with the relevant scoping. For Guild, JDA, or ShardManager, this returns the relevant channel with respect to the cache within each of those objects. For a guild, this would mean it only returns channels within the same guild.
        If this is called on JDA or ShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building your JDA instance, you can use JDA.awaitReady().

        Parameters:
        name - The name to check
        ignoreCase - Whether to ignore case on name checking
        Returns:
        Immutable list of all categories matching the provided name
        Throws:
        IllegalArgumentException - If the provided name is null
      • getCategoryById

        @Nullable
        default Category getCategoryById​(@Nonnull
                                         String id)
        Gets a Category that has the same id as the one provided.
        If there is no channel with an id that matches the provided one, then this returns null.

        This getter exists on any instance of IGuildChannelContainer and only checks the caches with the relevant scoping. For Guild, JDA, or ShardManager, this returns the relevant channel with respect to the cache within each of those objects. For a guild, this would mean it only returns channels within the same guild.
        If this is called on JDA or ShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building your JDA instance, you can use JDA.awaitReady().

        Parameters:
        id - The snowflake ID of the wanted Category
        Returns:
        Possibly-null Category for the provided ID.
        Throws:
        IllegalArgumentException - If the provided ID is not a valid long
      • getCategoryById

        @Nullable
        default Category getCategoryById​(long id)
        Gets a Category that has the same id as the one provided.
        If there is no channel with an id that matches the provided one, then this returns null.

        This getter exists on any instance of IGuildChannelContainer and only checks the caches with the relevant scoping. For Guild, JDA, or ShardManager, this returns the relevant channel with respect to the cache within each of those objects. For a guild, this would mean it only returns channels within the same guild.
        If this is called on JDA or ShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building your JDA instance, you can use JDA.awaitReady().

        Parameters:
        id - The snowflake ID of the wanted Category
        Returns:
        Possibly-null Category for the provided ID.
      • getCategories

        @Nonnull
        default List<Category> getCategories()
        Gets all Categories in the cache.
        In Guild cache, channels are sorted according to their position and id.

        This copies the backing store into a list. This means every call creates a new list with O(n) complexity. It is recommended to store this into a local variable or use getCategoryCache() and use its more efficient versions of handling these values.

        This getter exists on any instance of IGuildChannelContainer and only checks the caches with the relevant scoping. For Guild, JDA, or ShardManager, this returns the relevant channel with respect to the cache within each of those objects. For a guild, this would mean it only returns channels within the same guild.
        If this is called on JDA or ShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building your JDA instance, you can use JDA.awaitReady().

        Returns:
        An immutable list of all Categories in this Guild.
      • getStoreChannelsByName

        @Nonnull
        default List<StoreChannel> getStoreChannelsByName​(@Nonnull
                                                          String name,
                                                          boolean ignoreCase)
        Gets a list of all StoreChannels in this Guild that have the same name as the one provided.
        If there are no channels with the provided name, then this returns an empty list.

        This getter exists on any instance of IGuildChannelContainer and only checks the caches with the relevant scoping. For Guild, JDA, or ShardManager, this returns the relevant channel with respect to the cache within each of those objects. For a guild, this would mean it only returns channels within the same guild.
        If this is called on JDA or ShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building your JDA instance, you can use JDA.awaitReady().

        Parameters:
        name - The name used to filter the returned StoreChannels.
        ignoreCase - Determines if the comparison ignores case when comparing. True - case insensitive.
        Returns:
        Possibly-empty immutable list of all StoreChannels with names that match the provided name.
        Since:
        4.0.0
      • getStoreChannelById

        @Nullable
        default StoreChannel getStoreChannelById​(@Nonnull
                                                 String id)
        Gets a StoreChannel that has the same id as the one provided.
        If there is no channel with an id that matches the provided one, then this returns null.

        This getter exists on any instance of IGuildChannelContainer and only checks the caches with the relevant scoping. For Guild, JDA, or ShardManager, this returns the relevant channel with respect to the cache within each of those objects. For a guild, this would mean it only returns channels within the same guild.
        If this is called on JDA or ShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building your JDA instance, you can use JDA.awaitReady().

        Parameters:
        id - The id of the StoreChannel.
        Returns:
        Possibly-null StoreChannel with matching id.
        Throws:
        NumberFormatException - If the provided id cannot be parsed by Long.parseLong(String)
        Since:
        4.0.0
      • getStoreChannelById

        @Nullable
        default StoreChannel getStoreChannelById​(long id)
        Gets a StoreChannel that has the same id as the one provided.
        If there is no channel with an id that matches the provided one, then this returns null.

        This getter exists on any instance of IGuildChannelContainer and only checks the caches with the relevant scoping. For Guild, JDA, or ShardManager, this returns the relevant channel with respect to the cache within each of those objects. For a guild, this would mean it only returns channels within the same guild.
        If this is called on JDA or ShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building your JDA instance, you can use JDA.awaitReady().

        Parameters:
        id - The id of the StoreChannel.
        Returns:
        Possibly-null StoreChannel with matching id.
        Since:
        4.0.0
      • getStoreChannels

        @Nonnull
        default List<StoreChannel> getStoreChannels()
        Gets all StoreChannel in the cache.
        In Guild cache, channels are sorted according to their position and id.

        This copies the backing store into a list. This means every call creates a new list with O(n) complexity. It is recommended to store this into a local variable or use getStoreChannelCache() and use its more efficient versions of handling these values.

        This getter exists on any instance of IGuildChannelContainer and only checks the caches with the relevant scoping. For Guild, JDA, or ShardManager, this returns the relevant channel with respect to the cache within each of those objects. For a guild, this would mean it only returns channels within the same guild.
        If this is called on JDA or ShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building your JDA instance, you can use JDA.awaitReady().

        Returns:
        An immutable List of all StoreChannel in this Guild.
        Since:
        4.0.0
      • getTextChannelsByName

        @Nonnull
        default List<TextChannel> getTextChannelsByName​(@Nonnull
                                                        String name,
                                                        boolean ignoreCase)
        Gets a list of all TextChannels in this Guild that have the same name as the one provided.
        If there are no channels with the provided name, then this returns an empty list.

        This getter exists on any instance of IGuildChannelContainer and only checks the caches with the relevant scoping. For Guild, JDA, or ShardManager, this returns the relevant channel with respect to the cache within each of those objects. For a guild, this would mean it only returns channels within the same guild.
        If this is called on JDA or ShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building your JDA instance, you can use JDA.awaitReady().

        Parameters:
        name - The name used to filter the returned TextChannels.
        ignoreCase - Determines if the comparison ignores case when comparing. True - case insensitive.
        Returns:
        Possibly-empty immutable list of all TextChannels names that match the provided name.
      • getTextChannelById

        @Nullable
        default TextChannel getTextChannelById​(@Nonnull
                                               String id)
        Gets a TextChannel that has the same id as the one provided.
        If there is no channel with an id that matches the provided one, then this returns null.

        This getter exists on any instance of IGuildChannelContainer and only checks the caches with the relevant scoping. For Guild, JDA, or ShardManager, this returns the relevant channel with respect to the cache within each of those objects. For a guild, this would mean it only returns channels within the same guild.
        If this is called on JDA or ShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building your JDA instance, you can use JDA.awaitReady().

        Parameters:
        id - The id of the TextChannel.
        Returns:
        Possibly-null TextChannel with matching id.
        Throws:
        NumberFormatException - If the provided id cannot be parsed by Long.parseLong(String)
      • getTextChannelById

        @Nullable
        default TextChannel getTextChannelById​(long id)
        Gets a TextChannel that has the same id as the one provided.
        If there is no channel with an id that matches the provided one, then this returns null.

        This getter exists on any instance of IGuildChannelContainer and only checks the caches with the relevant scoping. For Guild, JDA, or ShardManager, this returns the relevant channel with respect to the cache within each of those objects. For a guild, this would mean it only returns channels within the same guild.
        If this is called on JDA or ShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building your JDA instance, you can use JDA.awaitReady().

        Parameters:
        id - The id of the TextChannel.
        Returns:
        Possibly-null TextChannel with matching id.
      • getTextChannels

        @Nonnull
        default List<TextChannel> getTextChannels()
        Gets all TextChannels in the cache.
        In Guild cache, channels are sorted according to their position and id.

        This copies the backing store into a list. This means every call creates a new list with O(n) complexity. It is recommended to store this into a local variable or use getTextChannelCache() and use its more efficient versions of handling these values.

        This getter exists on any instance of IGuildChannelContainer and only checks the caches with the relevant scoping. For Guild, JDA, or ShardManager, this returns the relevant channel with respect to the cache within each of those objects. For a guild, this would mean it only returns channels within the same guild.
        If this is called on JDA or ShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building your JDA instance, you can use JDA.awaitReady().

        Returns:
        An immutable List of all TextChannels in this Guild.
      • getNewsChannelsByName

        @Nonnull
        default List<NewsChannel> getNewsChannelsByName​(@Nonnull
                                                        String name,
                                                        boolean ignoreCase)
        Gets a list of all NewsChannels in this Guild that have the same name as the one provided.
        If there are no channels with the provided name, then this returns an empty list.

        This getter exists on any instance of IGuildChannelContainer and only checks the caches with the relevant scoping. For Guild, JDA, or ShardManager, this returns the relevant channel with respect to the cache within each of those objects. For a guild, this would mean it only returns channels within the same guild.
        If this is called on JDA or ShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building your JDA instance, you can use JDA.awaitReady().

        Parameters:
        name - The name used to filter the returned NewsChannels.
        ignoreCase - Determines if the comparison ignores case when comparing. True - case insensitive.
        Returns:
        Possibly-empty immutable list of all NewsChannels names that match the provided name.
      • getNewsChannelById

        @Nullable
        default NewsChannel getNewsChannelById​(@Nonnull
                                               String id)
        Gets a NewsChannel that has the same id as the one provided.
        If there is no channel with an id that matches the provided one, then this returns null.

        This getter exists on any instance of IGuildChannelContainer and only checks the caches with the relevant scoping. For Guild, JDA, or ShardManager, this returns the relevant channel with respect to the cache within each of those objects. For a guild, this would mean it only returns channels within the same guild.
        If this is called on JDA or ShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building your JDA instance, you can use JDA.awaitReady().

        Parameters:
        id - The id of the NewsChannel.
        Returns:
        Possibly-null NewsChannel with matching id.
        Throws:
        NumberFormatException - If the provided id cannot be parsed by Long.parseLong(String)
      • getNewsChannelById

        @Nullable
        default NewsChannel getNewsChannelById​(long id)
        Gets a NewsChannel that has the same id as the one provided.
        If there is no channel with an id that matches the provided one, then this returns null.

        This getter exists on any instance of IGuildChannelContainer and only checks the caches with the relevant scoping. For Guild, JDA, or ShardManager, this returns the relevant channel with respect to the cache within each of those objects. For a guild, this would mean it only returns channels within the same guild.
        If this is called on JDA or ShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building your JDA instance, you can use JDA.awaitReady().

        Parameters:
        id - The id of the NewsChannel.
        Returns:
        Possibly-null NewsChannel with matching id.
      • getNewsChannels

        @Nonnull
        default List<NewsChannel> getNewsChannels()
        Gets all NewsChannels in the cache.
        In Guild cache, channels are sorted according to their position and id.

        This copies the backing store into a list. This means every call creates a new list with O(n) complexity. It is recommended to store this into a local variable or use getNewsChannelCache() and use its more efficient versions of handling these values.

        This getter exists on any instance of IGuildChannelContainer and only checks the caches with the relevant scoping. For Guild, JDA, or ShardManager, this returns the relevant channel with respect to the cache within each of those objects. For a guild, this would mean it only returns channels within the same guild.
        If this is called on JDA or ShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building your JDA instance, you can use JDA.awaitReady().

        Returns:
        An immutable List of all NewsChannels in this Guild.
      • getVoiceChannelsByName

        @Nonnull
        default List<VoiceChannel> getVoiceChannelsByName​(@Nonnull
                                                          String name,
                                                          boolean ignoreCase)
        Gets a list of all VoiceChannels in this Guild that have the same name as the one provided.
        If there are no channels with the provided name, then this returns an empty list.

        This getter exists on any instance of IGuildChannelContainer and only checks the caches with the relevant scoping. For Guild, JDA, or ShardManager, this returns the relevant channel with respect to the cache within each of those objects. For a guild, this would mean it only returns channels within the same guild.
        If this is called on JDA or ShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building your JDA instance, you can use JDA.awaitReady().

        Parameters:
        name - The name used to filter the returned VoiceChannels.
        ignoreCase - Determines if the comparison ignores case when comparing. True - case insensitive.
        Returns:
        Possibly-empty immutable list of all VoiceChannel names that match the provided name.
      • getVoiceChannelById

        @Nullable
        default VoiceChannel getVoiceChannelById​(@Nonnull
                                                 String id)
        Gets a VoiceChannel that has the same id as the one provided.
        If there is no channel with an id that matches the provided one, then this returns null.

        This getter exists on any instance of IGuildChannelContainer and only checks the caches with the relevant scoping. For Guild, JDA, or ShardManager, this returns the relevant channel with respect to the cache within each of those objects. For a guild, this would mean it only returns channels within the same guild.
        If this is called on JDA or ShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building your JDA instance, you can use JDA.awaitReady().

        Parameters:
        id - The id of the VoiceChannel.
        Returns:
        Possibly-null VoiceChannel with matching id.
        Throws:
        NumberFormatException - If the provided id cannot be parsed by Long.parseLong(String)
      • getVoiceChannelById

        @Nullable
        default VoiceChannel getVoiceChannelById​(long id)
        Gets a VoiceChannel that has the same id as the one provided.
        If there is no channel with an id that matches the provided one, then this returns null.

        This getter exists on any instance of IGuildChannelContainer and only checks the caches with the relevant scoping. For Guild, JDA, or ShardManager, this returns the relevant channel with respect to the cache within each of those objects. For a guild, this would mean it only returns channels within the same guild.
        If this is called on JDA or ShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building your JDA instance, you can use JDA.awaitReady().

        Parameters:
        id - The id of the VoiceChannel.
        Returns:
        Possibly-null VoiceChannel with matching id.
      • getVoiceChannels

        @Nonnull
        default List<VoiceChannel> getVoiceChannels()
        Gets all VoiceChannels in the cache.
        In Guild cache, channels are sorted according to their position and id.

        This copies the backing store into a list. This means every call creates a new list with O(n) complexity. It is recommended to store this into a local variable or use getVoiceChannelCache() and use its more efficient versions of handling these values.

        This getter exists on any instance of IGuildChannelContainer and only checks the caches with the relevant scoping. For Guild, JDA, or ShardManager, this returns the relevant channel with respect to the cache within each of those objects. For a guild, this would mean it only returns channels within the same guild.
        If this is called on JDA or ShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building your JDA instance, you can use JDA.awaitReady().

        Returns:
        An immutable List of VoiceChannels.