Interface IGuildChannelContainer<C extends Channel>

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

public interface IGuildChannelContainer<C extends Channel>
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 Details

    • getChannelCache

      @Nonnull ChannelCacheView<C> getChannelCache()
      Unified cache of all channels associated with this shard or guild.

      This ChannelCacheView stores all channels in individually typed maps based on ChannelType. You can use ChannelCacheView.getElementById(ChannelType, long) or ChannelCacheView.ofType(Class) to filter out more specific types.

      Returns:
      ChannelCacheView
    • getChannelById

      @Nullable default <T extends C> 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 C> 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
    • getGuildChannelById

      @Nullable default GuildChannel getGuildChannelById(@Nonnull String id)
      Get GuildChannel for the provided ID.

      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().

      To get more specific channel types you can use one of the following:

      Parameters:
      id - The ID of the channel
      Returns:
      The GuildChannel or null
      Throws:
      IllegalArgumentException - If the provided ID is null
      NumberFormatException - If the provided ID is not a snowflake
    • getGuildChannelById

      @Nullable default GuildChannel getGuildChannelById(long id)
      Get GuildChannel for the provided ID.

      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().

      To get more specific channel types you can use one of the following:

      Parameters:
      id - The ID of the channel
      Returns:
      The GuildChannel or null
    • getGuildChannelById

      @Nullable default GuildChannel getGuildChannelById(@Nonnull ChannelType type, @Nonnull String id)
      Get GuildChannel for the provided ID.

      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().
      This is meant for systems that use a dynamic ChannelType and can profit from a simple function to get the channel instance.

      To get more specific channel types you can use one of the following:

      Parameters:
      type - The ChannelType
      id - The ID of the channel
      Returns:
      The GuildChannel or null
      Throws:
      IllegalArgumentException - If the provided ID is null
      NumberFormatException - If the provided ID is not a snowflake
    • getGuildChannelById

      @Nullable default GuildChannel getGuildChannelById(@Nonnull ChannelType type, long id)
      Get GuildChannel for the provided ID.

      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().
      This is meant for systems that use a dynamic ChannelType and can profit from a simple function to get the channel instance.

      To get more specific channel types you can use one of the following:

      Parameters:
      type - The ChannelType
      id - The ID of the channel
      Returns:
      The GuildChannel or null
    • getStageChannelCache

      @Nonnull SnowflakeCacheView<StageChannel> getStageChannelCache()
      Sorted SnowflakeCacheView of StageChannel.
      In Guild cache, channels are sorted according to their position and id.

      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:
      SortedSnowflakeCacheView
    • getStageChannelsByName

      @Nonnull default @Unmodifiable 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 @Unmodifiable 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.
    • getThreadChannelCache

      @Nonnull SnowflakeCacheView<ThreadChannel> getThreadChannelCache()
      SnowflakeCacheView of ThreadChannel.

      These threads can also represent posts in ForumChannels.

      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:
      SnowflakeCacheView
    • getThreadChannelsByName

      @Nonnull default @Unmodifiable 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.

      These threads can also represent posts in ForumChannels.

      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.

      These threads can also represent posts in ForumChannels.

      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.

      These threads can also represent posts in ForumChannels.

      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 @Unmodifiable List<ThreadChannel> getThreadChannels()
      Gets all ThreadChannel in the cache.

      These threads can also represent posts in ForumChannels.

      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.
    • getCategoryCache

      @Nonnull SnowflakeCacheView<Category> getCategoryCache()
      Sorted SnowflakeCacheView of Category.
      In Guild cache, channels are sorted according to their position and id.

      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:
      SortedSnowflakeCacheView
    • getCategoriesByName

      @Nonnull default @Unmodifiable 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 @Unmodifiable 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.
    • getTextChannelCache

      @Nonnull SnowflakeCacheView<TextChannel> getTextChannelCache()
      Sorted SnowflakeCacheView of TextChannel.
      In Guild cache, channels are sorted according to their position and id.

      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:
      SortedSnowflakeCacheView
    • getTextChannelsByName

      @Nonnull default @Unmodifiable 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 @Unmodifiable 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.
    • getNewsChannelCache

      @Nonnull SnowflakeCacheView<NewsChannel> getNewsChannelCache()
      Sorted SnowflakeCacheView of NewsChannel.
      In Guild cache, channels are sorted according to their position and id.

      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:
      SortedSnowflakeCacheView
    • getNewsChannelsByName

      @Nonnull default @Unmodifiable 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 @Unmodifiable 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.
    • getVoiceChannelCache

      @Nonnull SnowflakeCacheView<VoiceChannel> getVoiceChannelCache()
      Sorted SnowflakeCacheView of VoiceChannel.
      In Guild cache, channels are sorted according to their position and id.

      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:
      SortedSnowflakeCacheView
    • getVoiceChannelsByName

      @Nonnull default @Unmodifiable 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 @Unmodifiable 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.
    • getForumChannelCache

      @Nonnull SnowflakeCacheView<ForumChannel> getForumChannelCache()
      SnowflakeCacheView of ForumChannel.

      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:
      SnowflakeCacheView
    • getForumChannelsByName

      @Nonnull default @Unmodifiable List<ForumChannel> getForumChannelsByName(@Nonnull String name, boolean ignoreCase)
      Gets a list of all ForumChannels 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 ForumChannels.
      ignoreCase - Determines if the comparison ignores case when comparing. True - case insensitive.
      Returns:
      Possibly-empty immutable list of all ForumChannel names that match the provided name.
    • getForumChannelById

      @Nullable default ForumChannel getForumChannelById(@Nonnull String id)
      Gets a ForumChannel 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 ForumChannel.
      Returns:
      Possibly-null ForumChannel with matching id.
      Throws:
      NumberFormatException - If the provided id cannot be parsed by Long.parseLong(String)
    • getForumChannelById

      @Nullable default ForumChannel getForumChannelById(long id)
      Gets a ForumChannel 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 ForumChannel.
      Returns:
      Possibly-null ForumChannel with matching id.
    • getForumChannels

      @Nonnull default @Unmodifiable List<ForumChannel> getForumChannels()
      Gets all ForumChannel 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 getForumChannelCache() 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 ForumChannel.
    • getMediaChannelCache

      @Nonnull SnowflakeCacheView<MediaChannel> getMediaChannelCache()
      SnowflakeCacheView of MediaChannel.

      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:
      SnowflakeCacheView
    • getMediaChannelsByName

      @Nonnull default @Unmodifiable List<MediaChannel> getMediaChannelsByName(@Nonnull String name, boolean ignoreCase)
      Gets a list of all MediaChannels 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 MediaChannels.
      ignoreCase - Determines if the comparison ignores case when comparing. True - case insensitive.
      Returns:
      Possibly-empty immutable list of all ForumChannel names that match the provided name.
    • getMediaChannelById

      @Nullable default MediaChannel getMediaChannelById(@Nonnull String id)
      Gets a MediaChannel 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 MediaChannel.
      Returns:
      Possibly-null MediaChannel with matching id.
      Throws:
      NumberFormatException - If the provided id cannot be parsed by Long.parseLong(String)
    • getMediaChannelById

      @Nullable default MediaChannel getMediaChannelById(long id)
      Gets a MediaChannel 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 MediaChannel.
      Returns:
      Possibly-null MediaChannel with matching id.
    • getMediaChannels

      @Nonnull default @Unmodifiable List<MediaChannel> getMediaChannels()
      Gets all MediaChannel 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 getForumChannelCache() 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 MediaChannel.