Interface IGuildChannelContainer
-
- All Known Subinterfaces:
Guild,JDA,ShardManager
- All Known Implementing Classes:
DefaultShardManager
public interface IGuildChannelContainerProvides various channel cache getters for Guild channels.These getters only check the caches with the relevant scoping of the implementing type. For example,
Guildreturns channels that exist within the guild, whereasJDAorShardManagerreturns any channels that exist within the shard.
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().For the most efficient usage, it is recommended to use
CacheViewgetters such asgetTextChannelCache(). List getters usually require making a snapshot copy of the underlying cache view, which may introduce an undesirable performance hit.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default List<Category>getCategories()Gets allCategoriesin the cache.default List<Category>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 CategorygetCategoryById(String id)Gets aCategorythat has the same id as the one provided.SnowflakeCacheView<Category>getCategoryCache()SortedSnowflakeCacheViewofCategory.default <T extends Channel>
TgetChannelById(Class<T> type, long id)Get a channel of the specified type by id.default <T extends Channel>
TgetChannelById(Class<T> type, String id)Get a channel of the specified type by id.default GuildChannelgetGuildChannelById(long id)GetGuildChannelfor the provided ID.default GuildChannelgetGuildChannelById(String id)GetGuildChannelfor the provided ID.default GuildChannelgetGuildChannelById(ChannelType type, long id)GetGuildChannelfor the provided ID.default GuildChannelgetGuildChannelById(ChannelType type, String id)GetGuildChannelfor the provided ID.default NewsChannelgetNewsChannelById(long id)Gets aNewsChannelthat has the same id as the one provided.default NewsChannelgetNewsChannelById(String id)Gets aNewsChannelthat has the same id as the one provided.SnowflakeCacheView<NewsChannel>getNewsChannelCache()SortedSnowflakeCacheViewofNewsChannel.default List<NewsChannel>getNewsChannels()Gets allNewsChannelsin the cache.default 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 StageChannelgetStageChannelById(String id)Gets aStageChannelthat has the same id as the one provided.SnowflakeCacheView<StageChannel>getStageChannelCache()SortedSnowflakeCacheViewofStageChannel.default List<StageChannel>getStageChannels()Gets allStageChannelsin the cache.default 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 TextChannelgetTextChannelById(String id)Gets aTextChannelthat has the same id as the one provided.SnowflakeCacheView<TextChannel>getTextChannelCache()SortedSnowflakeCacheViewofTextChannel.default List<TextChannel>getTextChannels()Gets allTextChannelsin the cache.default 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 ThreadChannelgetThreadChannelById(String id)Gets aThreadChannelthat has the same id as the one provided.SnowflakeCacheView<ThreadChannel>getThreadChannelCache()default List<ThreadChannel>getThreadChannels()Gets allThreadChannelin the cache.default 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 VoiceChannelgetVoiceChannelById(String id)Gets aVoiceChannelthat has the same id as the one provided.SnowflakeCacheView<VoiceChannel>getVoiceChannelCache()SortedSnowflakeCacheViewofVoiceChannel.default List<VoiceChannel>getVoiceChannels()Gets allVoiceChannelsin the cache.default List<VoiceChannel>getVoiceChannelsByName(String name, boolean ignoreCase)Gets a list of allVoiceChannelsin this Guild that have the same name as the one provided.
-
-
-
Method Detail
-
getChannelById
@Nullable default <T extends Channel> T getChannelById(@Nonnull Class<T> type, @Nonnull String id)
Get a channel of the specified type by id.This will automatically check for all channel types and cast to the specified class. If a channel with the specified id does not exist, or exists but is not an instance of the provided class, this returns null.
- Type Parameters:
T- The type argument for the class- Parameters:
type-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
@Nullable default <T extends Channel> T getChannelById(@Nonnull Class<T> type, long id)
Get a channel of the specified type by id.This will automatically check for all channel types and cast to the specified class. If a channel with the specified id does not exist, or exists but is not an instance of the provided class, this returns null.
- Type Parameters:
T- The type argument for the class- Parameters:
type-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
@Nullable default GuildChannel getGuildChannelById(@Nonnull String id)
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
@Nullable default GuildChannel getGuildChannelById(long id)
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
@Nullable default GuildChannel getGuildChannelById(@Nonnull ChannelType type, @Nonnull String id)
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
@Nullable default GuildChannel getGuildChannelById(@Nonnull ChannelType type, long id)
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
@Nonnull SnowflakeCacheView<StageChannel> 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 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
@Nullable default StageChannel getStageChannelById(@Nonnull String id)
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
@Nullable default StageChannel getStageChannelById(long id)
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
@Nonnull default List<StageChannel> 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
@Nonnull SnowflakeCacheView<ThreadChannel> getThreadChannelCache()
SnowflakeCacheViewofThreadChannel.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 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.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
@Nullable default ThreadChannel getThreadChannelById(@Nonnull String id)
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.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
@Nullable default ThreadChannel getThreadChannelById(long id)
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.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
@Nonnull default List<ThreadChannel> getThreadChannels()
Gets allThreadChannelin the cache.This copies the backing store into a list. This means every call creates a new list with O(n) complexity. It is recommended to store this into a local variable or use
getThreadChannelCache()and use its more efficient versions of handling these values.This getter exists on any instance of
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
@Nonnull SnowflakeCacheView<Category> 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 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
@Nullable default Category getCategoryById(@Nonnull String id)
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
@Nullable default Category getCategoryById(long id)
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
@Nonnull default List<Category> 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
@Nonnull SnowflakeCacheView<TextChannel> 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 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
@Nullable default TextChannel getTextChannelById(@Nonnull String id)
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
@Nullable default TextChannel getTextChannelById(long id)
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
@Nonnull default List<TextChannel> 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
@Nonnull SnowflakeCacheView<NewsChannel> 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 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
@Nullable default NewsChannel getNewsChannelById(@Nonnull String id)
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
@Nullable default NewsChannel getNewsChannelById(long id)
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
@Nonnull default List<NewsChannel> 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
@Nonnull SnowflakeCacheView<VoiceChannel> 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 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
@Nullable default VoiceChannel getVoiceChannelById(@Nonnull String id)
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
@Nullable default VoiceChannel getVoiceChannelById(long id)
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
@Nonnull default List<VoiceChannel> 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.
-
-