Interface IGuildChannelContainer
-
- All Known Subinterfaces:
Guild
,JDA
,ShardManager
- All Known Implementing Classes:
DefaultShardManager
public interface IGuildChannelContainer
Provides various channel cache getters for Guild channels.These getters only check the caches with the relevant scoping of the implementing type. For example,
Guild
returns channels that exist within the guild, whereasJDA
orShardManager
returns any channels that exist within the shard.
If this is called onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, you can useJDA.awaitReady()
.For the most efficient usage, it is recommended to use
CacheView
getters 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 allCategories
in the cache.default List<Category>
getCategoriesByName(String name, boolean ignoreCase)
Gets a list of allCategories
in this Guild that have the same name as the one provided.default Category
getCategoryById(long id)
Gets aCategory
that has the same id as the one provided.default Category
getCategoryById(String id)
Gets aCategory
that has the same id as the one provided.SnowflakeCacheView<Category>
getCategoryCache()
SortedSnowflakeCacheView
ofCategory
.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 GuildChannel
getGuildChannelById(long id)
GetGuildChannel
for the provided ID.default GuildChannel
getGuildChannelById(String id)
GetGuildChannel
for the provided ID.default GuildChannel
getGuildChannelById(ChannelType type, long id)
GetGuildChannel
for the provided ID.default GuildChannel
getGuildChannelById(ChannelType type, String id)
GetGuildChannel
for the provided ID.default NewsChannel
getNewsChannelById(long id)
Gets aNewsChannel
that has the same id as the one provided.default NewsChannel
getNewsChannelById(String id)
Gets aNewsChannel
that has the same id as the one provided.SnowflakeCacheView<NewsChannel>
getNewsChannelCache()
SortedSnowflakeCacheView
ofNewsChannel
.default List<NewsChannel>
getNewsChannels()
Gets allNewsChannels
in the cache.default List<NewsChannel>
getNewsChannelsByName(String name, boolean ignoreCase)
Gets a list of allNewsChannels
in this Guild that have the same name as the one provided.default StageChannel
getStageChannelById(long id)
Gets aStageChannel
that has the same id as the one provided.default StageChannel
getStageChannelById(String id)
Gets aStageChannel
that has the same id as the one provided.SnowflakeCacheView<StageChannel>
getStageChannelCache()
SortedSnowflakeCacheView
ofStageChannel
.default List<StageChannel>
getStageChannels()
Gets allStageChannels
in the cache.default List<StageChannel>
getStageChannelsByName(String name, boolean ignoreCase)
Gets a list of allStageChannels
in this Guild that have the same name as the one provided.default TextChannel
getTextChannelById(long id)
Gets aTextChannel
that has the same id as the one provided.default TextChannel
getTextChannelById(String id)
Gets aTextChannel
that has the same id as the one provided.SnowflakeCacheView<TextChannel>
getTextChannelCache()
SortedSnowflakeCacheView
ofTextChannel
.default List<TextChannel>
getTextChannels()
Gets allTextChannels
in the cache.default List<TextChannel>
getTextChannelsByName(String name, boolean ignoreCase)
Gets a list of allTextChannels
in this Guild that have the same name as the one provided.default ThreadChannel
getThreadChannelById(long id)
Gets aThreadChannel
that has the same id as the one provided.default ThreadChannel
getThreadChannelById(String id)
Gets aThreadChannel
that has the same id as the one provided.SnowflakeCacheView<ThreadChannel>
getThreadChannelCache()
default List<ThreadChannel>
getThreadChannels()
Gets allThreadChannel
in the cache.default List<ThreadChannel>
getThreadChannelsByName(String name, boolean ignoreCase)
Gets a list of allThreadChannels
in this Guild that have the same name as the one provided.default VoiceChannel
getVoiceChannelById(long id)
Gets aVoiceChannel
that has the same id as the one provided.default VoiceChannel
getVoiceChannelById(String id)
Gets aVoiceChannel
that has the same id as the one provided.SnowflakeCacheView<VoiceChannel>
getVoiceChannelCache()
SortedSnowflakeCacheView
ofVoiceChannel
.default List<VoiceChannel>
getVoiceChannels()
Gets allVoiceChannels
in the cache.default List<VoiceChannel>
getVoiceChannelsByName(String name, boolean ignoreCase)
Gets a list of allVoiceChannels
in 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
-Class
of 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
-Class
of 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)
GetGuildChannel
for the provided ID.This getter exists on any instance of
IGuildChannelContainer
and 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 onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, 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)
GetGuildChannel
for the provided ID.This getter exists on any instance of
IGuildChannelContainer
and 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 onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, 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)
GetGuildChannel
for the provided ID.This getter exists on any instance of
IGuildChannelContainer
and 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 onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, you can useJDA.awaitReady()
.
This is meant for systems that use a dynamicChannelType
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
- TheChannelType
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(@Nonnull ChannelType type, long id)
GetGuildChannel
for the provided ID.This getter exists on any instance of
IGuildChannelContainer
and 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 onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, you can useJDA.awaitReady()
.
This is meant for systems that use a dynamicChannelType
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
- TheChannelType
id
- The ID of the channel- Returns:
- The GuildChannel or null
-
getStageChannelCache
@Nonnull SnowflakeCacheView<StageChannel> getStageChannelCache()
SortedSnowflakeCacheView
ofStageChannel
.
InGuild
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. 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 onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, you can useJDA.awaitReady()
.- Returns:
SortedSnowflakeCacheView
-
getStageChannelsByName
@Nonnull default List<StageChannel> getStageChannelsByName(@Nonnull String name, boolean ignoreCase)
Gets a list of allStageChannels
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. 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 onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, 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 aStageChannel
that 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
IGuildChannelContainer
and 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 onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, you can useJDA.awaitReady()
.- Parameters:
id
- The id of theStageChannel
.- Returns:
- Possibly-null
StageChannel
with matching id. - Throws:
NumberFormatException
- If the providedid
cannot be parsed byLong.parseLong(String)
-
getStageChannelById
@Nullable default StageChannel getStageChannelById(long id)
Gets aStageChannel
that 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
IGuildChannelContainer
and 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 onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, you can useJDA.awaitReady()
.- Parameters:
id
- The id of theStageChannel
.- Returns:
- Possibly-null
StageChannel
with matching id.
-
getStageChannels
@Nonnull default List<StageChannel> getStageChannels()
Gets allStageChannels
in the cache.
InGuild
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. 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 onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, you can useJDA.awaitReady()
.- Returns:
- An immutable List of
StageChannels
.
-
getThreadChannelCache
@Nonnull SnowflakeCacheView<ThreadChannel> getThreadChannelCache()
SnowflakeCacheView
ofThreadChannel
.This getter exists on any instance of
IGuildChannelContainer
and 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 onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, you can useJDA.awaitReady()
.- Returns:
SnowflakeCacheView
-
getThreadChannelsByName
@Nonnull default List<ThreadChannel> getThreadChannelsByName(@Nonnull String name, boolean ignoreCase)
Gets a list of allThreadChannels
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. 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 onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, 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 aThreadChannel
that 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
IGuildChannelContainer
and 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 onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, you can useJDA.awaitReady()
.- Parameters:
id
- The id of theThreadChannel
.- Returns:
- Possibly-null
ThreadChannel
with matching id. - Throws:
NumberFormatException
- If the providedid
cannot be parsed byLong.parseLong(String)
-
getThreadChannelById
@Nullable default ThreadChannel getThreadChannelById(long id)
Gets aThreadChannel
that 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
IGuildChannelContainer
and 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 onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, you can useJDA.awaitReady()
.- Parameters:
id
- The id of theThreadChannel
.- Returns:
- Possibly-null
ThreadChannel
with matching id.
-
getThreadChannels
@Nonnull default List<ThreadChannel> getThreadChannels()
Gets allThreadChannel
in the cache.This copies the backing store into a list. This means every call creates a new list with O(n) complexity. It is recommended to store this into a local variable or use
getThreadChannelCache()
and use its more efficient versions of handling these values.This getter exists on any instance of
IGuildChannelContainer
and only checks the caches with the relevant scoping. 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 onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, you can useJDA.awaitReady()
.- Returns:
- An immutable List of
ThreadChannels
.
-
getCategoryCache
@Nonnull SnowflakeCacheView<Category> getCategoryCache()
SortedSnowflakeCacheView
ofCategory
.
InGuild
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. 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 onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, you can useJDA.awaitReady()
.- Returns:
SortedSnowflakeCacheView
-
getCategoriesByName
@Nonnull default List<Category> getCategoriesByName(@Nonnull String name, boolean ignoreCase)
Gets a list of allCategories
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. 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 onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, 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 aCategory
that 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
IGuildChannelContainer
and 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 onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, you can useJDA.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 validlong
-
getCategoryById
@Nullable default Category getCategoryById(long id)
Gets aCategory
that 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
IGuildChannelContainer
and 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 onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, you can useJDA.awaitReady()
.- Parameters:
id
- The snowflake ID of the wanted Category- Returns:
- Possibly-null
Category
for the provided ID.
-
getCategories
@Nonnull default List<Category> getCategories()
Gets allCategories
in the cache.
InGuild
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. 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 onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, you can useJDA.awaitReady()
.- Returns:
- An immutable list of all
Categories
in this Guild.
-
getTextChannelCache
@Nonnull SnowflakeCacheView<TextChannel> getTextChannelCache()
SortedSnowflakeCacheView
ofTextChannel
.
InGuild
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. 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 onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, you can useJDA.awaitReady()
.- Returns:
SortedSnowflakeCacheView
-
getTextChannelsByName
@Nonnull default List<TextChannel> getTextChannelsByName(@Nonnull String name, boolean ignoreCase)
Gets a list of allTextChannels
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. 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 onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, 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 aTextChannel
that 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
IGuildChannelContainer
and 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 onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, you can useJDA.awaitReady()
.- Parameters:
id
- The id of theTextChannel
.- Returns:
- Possibly-null
TextChannel
with matching id. - Throws:
NumberFormatException
- If the providedid
cannot be parsed byLong.parseLong(String)
-
getTextChannelById
@Nullable default TextChannel getTextChannelById(long id)
Gets aTextChannel
that 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
IGuildChannelContainer
and 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 onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, you can useJDA.awaitReady()
.- Parameters:
id
- The id of theTextChannel
.- Returns:
- Possibly-null
TextChannel
with matching id.
-
getTextChannels
@Nonnull default List<TextChannel> getTextChannels()
Gets allTextChannels
in the cache.
InGuild
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. 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 onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, you can useJDA.awaitReady()
.- Returns:
- An immutable List of all
TextChannels
in this Guild.
-
getNewsChannelCache
@Nonnull SnowflakeCacheView<NewsChannel> getNewsChannelCache()
SortedSnowflakeCacheView
ofNewsChannel
.
InGuild
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. 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 onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, you can useJDA.awaitReady()
.- Returns:
SortedSnowflakeCacheView
-
getNewsChannelsByName
@Nonnull default List<NewsChannel> getNewsChannelsByName(@Nonnull String name, boolean ignoreCase)
Gets a list of allNewsChannels
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. 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 onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, 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 aNewsChannel
that 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
IGuildChannelContainer
and 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 onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, you can useJDA.awaitReady()
.- Parameters:
id
- The id of theNewsChannel
.- Returns:
- Possibly-null
NewsChannel
with matching id. - Throws:
NumberFormatException
- If the providedid
cannot be parsed byLong.parseLong(String)
-
getNewsChannelById
@Nullable default NewsChannel getNewsChannelById(long id)
Gets aNewsChannel
that 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
IGuildChannelContainer
and 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 onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, you can useJDA.awaitReady()
.- Parameters:
id
- The id of theNewsChannel
.- Returns:
- Possibly-null
NewsChannel
with matching id.
-
getNewsChannels
@Nonnull default List<NewsChannel> getNewsChannels()
Gets allNewsChannels
in the cache.
InGuild
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. 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 onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, you can useJDA.awaitReady()
.- Returns:
- An immutable List of all
NewsChannels
in this Guild.
-
getVoiceChannelCache
@Nonnull SnowflakeCacheView<VoiceChannel> getVoiceChannelCache()
SortedSnowflakeCacheView
ofVoiceChannel
.
InGuild
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. 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 onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, you can useJDA.awaitReady()
.- Returns:
SortedSnowflakeCacheView
-
getVoiceChannelsByName
@Nonnull default List<VoiceChannel> getVoiceChannelsByName(@Nonnull String name, boolean ignoreCase)
Gets a list of allVoiceChannels
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. 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 onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, 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 aVoiceChannel
that 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
IGuildChannelContainer
and 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 onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, you can useJDA.awaitReady()
.- Parameters:
id
- The id of theVoiceChannel
.- Returns:
- Possibly-null
VoiceChannel
with matching id. - Throws:
NumberFormatException
- If the providedid
cannot be parsed byLong.parseLong(String)
-
getVoiceChannelById
@Nullable default VoiceChannel getVoiceChannelById(long id)
Gets aVoiceChannel
that 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
IGuildChannelContainer
and 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 onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, you can useJDA.awaitReady()
.- Parameters:
id
- The id of theVoiceChannel
.- Returns:
- Possibly-null
VoiceChannel
with matching id.
-
getVoiceChannels
@Nonnull default List<VoiceChannel> getVoiceChannels()
Gets allVoiceChannels
in the cache.
InGuild
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. 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 onJDA
orShardManager
, this may return null immediately after building, because the cache isn't initialized yet. To make sure the cache is initialized after building yourJDA
instance, you can useJDA.awaitReady()
.- Returns:
- An immutable List of
VoiceChannels
.
-
-