Interface IGuildChannelContainer<C extends Channel>
- All Known Subinterfaces:
Guild,JDA,ShardManager
- All Known Implementing Classes:
DefaultShardManager
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 Summary
Modifier and TypeMethodDescriptionGets allCategoriesin the cache.getCategoriesByName(String name, boolean ignoreCase) Gets a list of allCategoriesin this Guild that have the same name as the one provided.default CategorygetCategoryById(long id) Gets aCategorythat has the same id as the one provided.default CategoryGets aCategorythat has the same id as the one provided.SortedSnowflakeCacheViewofCategory.default <T extends C>
TgetChannelById(Class<T> type, long id) Get a channel of the specified type by id.default <T extends C>
TgetChannelById(Class<T> type, String id) Get a channel of the specified type by id.Unified cache of all channels associated with this shard or guild.default ForumChannelgetForumChannelById(long id) Gets aForumChannelthat has the same id as the one provided.default ForumChannelGets aForumChannelthat has the same id as the one provided.default @Unmodifiable List<ForumChannel>Gets allForumChannelin the cache.default @Unmodifiable List<ForumChannel>getForumChannelsByName(String name, boolean ignoreCase) Gets a list of allForumChannelsin this Guild that have the same name as the one provided.default GuildChannelgetGuildChannelById(long id) GetGuildChannelfor the provided ID.default GuildChannelGetGuildChannelfor the provided ID.default GuildChannelgetGuildChannelById(ChannelType type, long id) GetGuildChannelfor the provided ID.default GuildChannelgetGuildChannelById(ChannelType type, String id) GetGuildChannelfor the provided ID.default MediaChannelgetMediaChannelById(long id) Gets aMediaChannelthat has the same id as the one provided.default MediaChannelGets aMediaChannelthat has the same id as the one provided.default @Unmodifiable List<MediaChannel>Gets allMediaChannelin the cache.default @Unmodifiable List<MediaChannel>getMediaChannelsByName(String name, boolean ignoreCase) Gets a list of allMediaChannelsin this Guild that have the same name as the one provided.default NewsChannelgetNewsChannelById(long id) Gets aNewsChannelthat has the same id as the one provided.default NewsChannelGets aNewsChannelthat has the same id as the one provided.SortedSnowflakeCacheViewofNewsChannel.default @Unmodifiable List<NewsChannel>Gets allNewsChannelsin the cache.default @Unmodifiable List<NewsChannel>getNewsChannelsByName(String name, boolean ignoreCase) Gets a list of allNewsChannelsin this Guild that have the same name as the one provided.default StageChannelgetStageChannelById(long id) Gets aStageChannelthat has the same id as the one provided.default StageChannelGets aStageChannelthat has the same id as the one provided.SortedSnowflakeCacheViewofStageChannel.default @Unmodifiable List<StageChannel>Gets allStageChannelsin the cache.default @Unmodifiable List<StageChannel>getStageChannelsByName(String name, boolean ignoreCase) Gets a list of allStageChannelsin this Guild that have the same name as the one provided.default TextChannelgetTextChannelById(long id) Gets aTextChannelthat has the same id as the one provided.default TextChannelGets aTextChannelthat has the same id as the one provided.SortedSnowflakeCacheViewofTextChannel.default @Unmodifiable List<TextChannel>Gets allTextChannelsin the cache.default @Unmodifiable List<TextChannel>getTextChannelsByName(String name, boolean ignoreCase) Gets a list of allTextChannelsin this Guild that have the same name as the one provided.default ThreadChannelgetThreadChannelById(long id) Gets aThreadChannelthat has the same id as the one provided.default ThreadChannelGets aThreadChannelthat has the same id as the one provided.default @Unmodifiable List<ThreadChannel>Gets allThreadChannelin the cache.default @Unmodifiable List<ThreadChannel>getThreadChannelsByName(String name, boolean ignoreCase) Gets a list of allThreadChannelsin this Guild that have the same name as the one provided.default VoiceChannelgetVoiceChannelById(long id) Gets aVoiceChannelthat has the same id as the one provided.default VoiceChannelGets aVoiceChannelthat has the same id as the one provided.SortedSnowflakeCacheViewofVoiceChannel.default @Unmodifiable List<VoiceChannel>Gets allVoiceChannelsin the cache.default @Unmodifiable List<VoiceChannel>getVoiceChannelsByName(String name, boolean ignoreCase) Gets a list of allVoiceChannelsin this Guild that have the same name as the one provided.
-
Method Details
-
getChannelCache
Unified cache of all channels associated with this shard or guild.This
ChannelCacheViewstores all channels in individually typed maps based onChannelType. You can useChannelCacheView.getElementById(ChannelType, long)orChannelCacheView.ofType(Class)to filter out more specific types.- Returns:
ChannelCacheView
-
getChannelById
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-Classof a channel typeid- 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
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-Classof a channel typeid- 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
GetGuildChannelfor the provided ID.This getter exists on any instance of
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.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 nullNumberFormatException- If the provided ID is not a snowflake
-
getGuildChannelById
GetGuildChannelfor the provided ID.This getter exists on any instance of
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.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
GetGuildChannelfor the provided ID.This getter exists on any instance of
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().
This is meant for systems that use a dynamicChannelTypeand 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- TheChannelTypeid- The ID of the channel- Returns:
- The GuildChannel or null
- Throws:
IllegalArgumentException- If the provided ID is nullNumberFormatException- If the provided ID is not a snowflake
-
getGuildChannelById
GetGuildChannelfor the provided ID.This getter exists on any instance of
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().
This is meant for systems that use a dynamicChannelTypeand 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- TheChannelTypeid- The ID of the channel- Returns:
- The GuildChannel or null
-
getStageChannelCache
SortedSnowflakeCacheViewofStageChannel.
InGuildcache, channels are sorted according to their position and id.This getter exists on any instance of
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Returns:
SortedSnowflakeCacheView
-
getStageChannelsByName
@Nonnull default @Unmodifiable List<StageChannel> getStageChannelsByName(@Nonnull String name, boolean ignoreCase) Gets a list of allStageChannelsin 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
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Parameters:
name- The name used to filter the returnedStageChannels.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
Gets aStageChannelthat has the same id as the one provided.
If there is no channel with an id that matches the provided one, then this returnsnull.This getter exists on any instance of
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Parameters:
id- The id of theStageChannel.- Returns:
- Possibly-null
StageChannelwith matching id. - Throws:
NumberFormatException- If the providedidcannot be parsed byLong.parseLong(String)
-
getStageChannelById
Gets aStageChannelthat has the same id as the one provided.
If there is no channel with an id that matches the provided one, then this returnsnull.This getter exists on any instance of
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Parameters:
id- The id of theStageChannel.- Returns:
- Possibly-null
StageChannelwith matching id.
-
getStageChannels
Gets allStageChannelsin the cache.
InGuildcache, 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
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Returns:
- An immutable List of
StageChannels.
-
getThreadChannelCache
SnowflakeCacheViewofThreadChannel.These threads can also represent posts in
ForumChannels.This getter exists on any instance of
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Returns:
SnowflakeCacheView
-
getThreadChannelsByName
@Nonnull default @Unmodifiable List<ThreadChannel> getThreadChannelsByName(@Nonnull String name, boolean ignoreCase) Gets a list of allThreadChannelsin 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
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Parameters:
name- The name used to filter the returnedThreadChannels.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
Gets aThreadChannelthat has the same id as the one provided.
If there is no channel with an id that matches the provided one, then this returnsnull.These threads can also represent posts in
ForumChannels.This getter exists on any instance of
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Parameters:
id- The id of theThreadChannel.- Returns:
- Possibly-null
ThreadChannelwith matching id. - Throws:
NumberFormatException- If the providedidcannot be parsed byLong.parseLong(String)
-
getThreadChannelById
Gets aThreadChannelthat has the same id as the one provided.
If there is no channel with an id that matches the provided one, then this returnsnull.These threads can also represent posts in
ForumChannels.This getter exists on any instance of
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Parameters:
id- The id of theThreadChannel.- Returns:
- Possibly-null
ThreadChannelwith matching id.
-
getThreadChannels
Gets allThreadChannelin 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
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Returns:
- An immutable List of
ThreadChannels.
-
getCategoryCache
SortedSnowflakeCacheViewofCategory.
InGuildcache, channels are sorted according to their position and id.This getter exists on any instance of
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Returns:
SortedSnowflakeCacheView
-
getCategoriesByName
@Nonnull default @Unmodifiable List<Category> getCategoriesByName(@Nonnull String name, boolean ignoreCase) Gets a list of allCategoriesin 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
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Parameters:
name- The name to checkignoreCase- Whether to ignore case on name checking- Returns:
- Immutable list of all categories matching the provided name
- Throws:
IllegalArgumentException- If the provided name isnull
-
getCategoryById
Gets aCategorythat has the same id as the one provided.
If there is no channel with an id that matches the provided one, then this returnsnull.This getter exists on any instance of
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Parameters:
id- The snowflake ID of the wanted Category- Returns:
- Possibly-null
Categoryfor the provided ID. - Throws:
IllegalArgumentException- If the provided ID is not a validlong
-
getCategoryById
Gets aCategorythat has the same id as the one provided.
If there is no channel with an id that matches the provided one, then this returnsnull.This getter exists on any instance of
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Parameters:
id- The snowflake ID of the wanted Category- Returns:
- Possibly-null
Categoryfor the provided ID.
-
getCategories
Gets allCategoriesin the cache.
InGuildcache, 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
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Returns:
- An immutable list of all
Categoriesin this Guild.
-
getTextChannelCache
SortedSnowflakeCacheViewofTextChannel.
InGuildcache, channels are sorted according to their position and id.This getter exists on any instance of
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Returns:
SortedSnowflakeCacheView
-
getTextChannelsByName
@Nonnull default @Unmodifiable List<TextChannel> getTextChannelsByName(@Nonnull String name, boolean ignoreCase) Gets a list of allTextChannelsin 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
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Parameters:
name- The name used to filter the returnedTextChannels.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
Gets aTextChannelthat has the same id as the one provided.
If there is no channel with an id that matches the provided one, then this returnsnull.This getter exists on any instance of
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Parameters:
id- The id of theTextChannel.- Returns:
- Possibly-null
TextChannelwith matching id. - Throws:
NumberFormatException- If the providedidcannot be parsed byLong.parseLong(String)
-
getTextChannelById
Gets aTextChannelthat has the same id as the one provided.
If there is no channel with an id that matches the provided one, then this returnsnull.This getter exists on any instance of
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Parameters:
id- The id of theTextChannel.- Returns:
- Possibly-null
TextChannelwith matching id.
-
getTextChannels
Gets allTextChannelsin the cache.
InGuildcache, 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
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Returns:
- An immutable List of all
TextChannelsin this Guild.
-
getNewsChannelCache
SortedSnowflakeCacheViewofNewsChannel.
InGuildcache, channels are sorted according to their position and id.This getter exists on any instance of
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Returns:
SortedSnowflakeCacheView
-
getNewsChannelsByName
@Nonnull default @Unmodifiable List<NewsChannel> getNewsChannelsByName(@Nonnull String name, boolean ignoreCase) Gets a list of allNewsChannelsin 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
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Parameters:
name- The name used to filter the returnedNewsChannels.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
Gets aNewsChannelthat has the same id as the one provided.
If there is no channel with an id that matches the provided one, then this returnsnull.This getter exists on any instance of
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Parameters:
id- The id of theNewsChannel.- Returns:
- Possibly-null
NewsChannelwith matching id. - Throws:
NumberFormatException- If the providedidcannot be parsed byLong.parseLong(String)
-
getNewsChannelById
Gets aNewsChannelthat has the same id as the one provided.
If there is no channel with an id that matches the provided one, then this returnsnull.This getter exists on any instance of
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Parameters:
id- The id of theNewsChannel.- Returns:
- Possibly-null
NewsChannelwith matching id.
-
getNewsChannels
Gets allNewsChannelsin the cache.
InGuildcache, 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
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Returns:
- An immutable List of all
NewsChannelsin this Guild.
-
getVoiceChannelCache
SortedSnowflakeCacheViewofVoiceChannel.
InGuildcache, channels are sorted according to their position and id.This getter exists on any instance of
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Returns:
SortedSnowflakeCacheView
-
getVoiceChannelsByName
@Nonnull default @Unmodifiable List<VoiceChannel> getVoiceChannelsByName(@Nonnull String name, boolean ignoreCase) Gets a list of allVoiceChannelsin 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
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Parameters:
name- The name used to filter the returnedVoiceChannels.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
Gets aVoiceChannelthat has the same id as the one provided.
If there is no channel with an id that matches the provided one, then this returnsnull.This getter exists on any instance of
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Parameters:
id- The id of theVoiceChannel.- Returns:
- Possibly-null
VoiceChannelwith matching id. - Throws:
NumberFormatException- If the providedidcannot be parsed byLong.parseLong(String)
-
getVoiceChannelById
Gets aVoiceChannelthat has the same id as the one provided.
If there is no channel with an id that matches the provided one, then this returnsnull.This getter exists on any instance of
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Parameters:
id- The id of theVoiceChannel.- Returns:
- Possibly-null
VoiceChannelwith matching id.
-
getVoiceChannels
Gets allVoiceChannelsin the cache.
InGuildcache, 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
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Returns:
- An immutable List of
VoiceChannels.
-
getForumChannelCache
SnowflakeCacheViewofForumChannel.This getter exists on any instance of
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Returns:
SnowflakeCacheView
-
getForumChannelsByName
@Nonnull default @Unmodifiable List<ForumChannel> getForumChannelsByName(@Nonnull String name, boolean ignoreCase) Gets a list of allForumChannelsin 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
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Parameters:
name- The name used to filter the returnedForumChannels.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
Gets aForumChannelthat has the same id as the one provided.
If there is no channel with an id that matches the provided one, then this returnsnull.This getter exists on any instance of
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Parameters:
id- The id of theForumChannel.- Returns:
- Possibly-null
ForumChannelwith matching id. - Throws:
NumberFormatException- If the providedidcannot be parsed byLong.parseLong(String)
-
getForumChannelById
Gets aForumChannelthat has the same id as the one provided.
If there is no channel with an id that matches the provided one, then this returnsnull.This getter exists on any instance of
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Parameters:
id- The id of theForumChannel.- Returns:
- Possibly-null
ForumChannelwith matching id.
-
getForumChannels
Gets allForumChannelin 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
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Returns:
- An immutable List of
ForumChannel.
-
getMediaChannelCache
SnowflakeCacheViewofMediaChannel.This getter exists on any instance of
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Returns:
SnowflakeCacheView
-
getMediaChannelsByName
@Nonnull default @Unmodifiable List<MediaChannel> getMediaChannelsByName(@Nonnull String name, boolean ignoreCase) Gets a list of allMediaChannelsin 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
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Parameters:
name- The name used to filter the returnedMediaChannels.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
Gets aMediaChannelthat has the same id as the one provided.
If there is no channel with an id that matches the provided one, then this returnsnull.This getter exists on any instance of
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Parameters:
id- The id of theMediaChannel.- Returns:
- Possibly-null
MediaChannelwith matching id. - Throws:
NumberFormatException- If the providedidcannot be parsed byLong.parseLong(String)
-
getMediaChannelById
Gets aMediaChannelthat has the same id as the one provided.
If there is no channel with an id that matches the provided one, then this returnsnull.This getter exists on any instance of
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Parameters:
id- The id of theMediaChannel.- Returns:
- Possibly-null
MediaChannelwith matching id.
-
getMediaChannels
Gets allMediaChannelin 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
IGuildChannelContainerand only checks the caches with the relevant scoping. ForGuild,JDA, orShardManager, 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 onJDAorShardManager, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDAinstance, you can useJDA.awaitReady().- Returns:
- An immutable List of
MediaChannel.
-