Class JDAContext
java.lang.Object
io.github.kaktushose.jdac.internal.JDAContext
Wrapper class for
JDA and ShardManager. Use performTask(Consumer, boolean) when you need to do work with an JDA object.-
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionJDAContext(net.dv8tion.jda.api.JDA jda) Constructs a new JDAContext.JDAContext(net.dv8tion.jda.api.sharding.ShardManager shardManager) Constructs a new JDAContext. -
Method Summary
Modifier and TypeMethodDescriptionList<net.dv8tion.jda.api.entities.emoji.ApplicationEmoji> net.dv8tion.jda.api.utils.cache.SnowflakeCacheView<net.dv8tion.jda.api.entities.Guild> SnowflakeCacheViewof all cachedGuilds.voidperformTask(Consumer<net.dv8tion.jda.api.JDA> consumer, boolean onlyFirstShard) Performs an operation on either theJDAobject or on all shards.voidshutdown()Shutdown the underlyingJDAorShardManagerinstance
-
Field Details
-
log
public static final org.slf4j.Logger log
-
-
Constructor Details
-
JDAContext
public JDAContext(net.dv8tion.jda.api.sharding.ShardManager shardManager) Constructs a new JDAContext.- Parameters:
shardManager- theShardManagerobject
-
JDAContext
public JDAContext(net.dv8tion.jda.api.JDA jda) Constructs a new JDAContext.- Parameters:
jda- theJDAobject
-
-
Method Details
-
performTask
Performs an operation on either theJDAobject or on all shards.- Parameters:
consumer- the operation to performonlyFirstShard- whether this task should only be executed on the first shard if aShardManageris used
-
getGuildCache
public net.dv8tion.jda.api.utils.cache.SnowflakeCacheView<net.dv8tion.jda.api.entities.Guild> getGuildCache()SnowflakeCacheViewof all cachedGuilds.- Returns:
- the
SnowflakeCacheView
-
applicationEmojis
-
shutdown
public void shutdown()Shutdown the underlyingJDAorShardManagerinstance
-