Class JDAContext

java.lang.Object
com.github.kaktushose.jda.commands.internal.JDAContext

@Internal public final class JDAContext extends Object
Wrapper class for JDA and ShardManager. Use performTask(Consumer) when you need to do work with an JDA object.
  • Constructor Summary

    Constructors
    Constructor
    Description
    JDAContext(Object context)
    Constructs a new JDAContext.
  • Method Summary

    Modifier and Type
    Method
    Description
    net.dv8tion.jda.api.utils.cache.SnowflakeCacheView<net.dv8tion.jda.api.entities.Guild>
    SnowflakeCacheView of all cached Guilds.
    void
    performTask(Consumer<net.dv8tion.jda.api.JDA> consumer)
    Performs an operation on either the JDA object or on all shards.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • JDAContext

      public JDAContext(Object context)
      Constructs a new JDAContext.
      Parameters:
      context - the JDA or ShardManager object
  • Method Details

    • performTask

      public void performTask(Consumer<net.dv8tion.jda.api.JDA> consumer)
      Performs an operation on either the JDA object or on all shards.
      Parameters:
      consumer - the operation to perform
    • getGuildCache

      public net.dv8tion.jda.api.utils.cache.SnowflakeCacheView<net.dv8tion.jda.api.entities.Guild> getGuildCache()
      SnowflakeCacheView of all cached Guilds.
      Returns:
      SnowflakeCacheView