public interface JDA
Modifier and Type | Method and Description |
---|---|
void |
addEventListener(java.lang.Object listener)
Adds an Object to the event-listeners that will be used to handle events.
|
void |
createGuildAsync(java.lang.String name,
Region region,
java.util.function.Consumer<GuildManager> callback)
Creates a new
Guild .This function will wait until the Guild was fully created by the Discord-Server (default channels,...), and then call the provided callback-function with the GuildManager-object. |
AccountManager |
getAccountManager()
Returns the
AccountManager for the currently logged in account.Account settings can only be modified using this object. |
AudioManager |
getAudioManager()
Returns the
AudioManager for this JDA
instance. |
java.lang.String |
getAuthToken()
The login token that is currently being used for Discord authentication.
|
org.apache.http.HttpHost |
getGlobalProxy()
The proxy settings used by all JDA instances.
|
Guild |
getGuildById(java.lang.String id)
This returns the
Guild which has the same id as the one provided.If there is no known guild with an id that matches the provided one, then this returns null . |
java.util.List<Guild> |
getGuilds()
|
java.util.List<Guild> |
getGuildsByName(java.lang.String name)
|
PrivateChannel |
getPrivateChannelById(java.lang.String id)
This returns the
PrivateChannel which has the same id as the one provided.If there is no known PrivateChannel with an id that matches the
provided one, then this returns null . |
java.util.List<PrivateChannel> |
getPrivateChannels()
An unmodifiable list of all known
PrivateChannels . |
int |
getResponseTotal()
This value is the total amount of JSON responses that discord has sent.
This value resets every time the websocket has to reconnect. |
SelfInfo |
getSelfInfo()
Returns the currently logged in account represented by
SelfInfo .Account settings cannot be modified using this object. |
TextChannel |
getTextChannelById(java.lang.String id)
This returns the
TextChannel which has the same id as the one provided.If there is no known TextChannel with an id that matches the provided
one, then this returns null . |
java.util.List<TextChannel> |
getTextChannels()
An unmodifiable list of all
TextChannels of all Guilds
that this account is a member of. |
java.util.List<TextChannel> |
getTextChannelsByName(java.lang.String name)
An unmodifiable list of all
TextChannels that have the same name as the one provided.If there are no TextChannels with the provided name, then this returns an empty list. |
User |
getUserById(java.lang.String id)
This returns the
User who has the same id as the one provided.If there is no known user with an id that matches the provided one, this this returns null . |
java.util.List<User> |
getUsers()
|
java.util.List<User> |
getUsersByName(java.lang.String name)
|
VoiceChannel |
getVoiceChannelById(java.lang.String id)
This returns the
VoiceChannel which has the same id as the one provided.If there is no known VoiceChannel with an id that matches the provided
one, then this returns null . |
java.util.List<VoiceChannel> |
getVoiceChannelByName(java.lang.String name)
An unmodifiable list of all
VoiceChannels that have the same name as the one provided.If there are no VoiceChannels with the provided name, then this returns an empty list. |
java.util.List<VoiceChannel> |
getVoiceChannels()
An unmodifiable list of all
VoiceChannels of all Guilds
that this account is a member of. |
boolean |
isAutoReconnect()
Returns whether or not autoReconnect is enabled for JDA
|
boolean |
isDebug()
Deprecated.
|
void |
removeEventListener(java.lang.Object listener)
Removes the provided Object from the event-listeners and no longer uses it to handle events.
|
void |
setAutoReconnect(boolean reconnect)
Sets whether or not JDA should try to reconnect, if a connection-error occured.
|
void |
setDebug(boolean enableDebug)
Deprecated.
|
void |
setEventManager(IEventManager manager)
Changes the internal EventManager.
|
void |
shutdown()
Shuts down JDA, closing all its connections.
|
void |
shutdown(boolean free)
Shuts down JDA, closing all its connections.
|
void setEventManager(IEventManager manager)
InterfacedEventListener
.
There is also an AnnotatedEventManager
available.manager
- The new EventManager to usevoid addEventListener(java.lang.Object listener)
InterfacedEventListener
by default.
To switch to the AnnotatedEventManager
, use setEventManager(IEventManager)
.
Note: when using the InterfacedEventListener
(default),
given listener must be instance of EventListener
!listener
- The listenervoid removeEventListener(java.lang.Object listener)
listener
- The listener to be removed.void createGuildAsync(java.lang.String name, Region region, java.util.function.Consumer<GuildManager> callback)
Guild
.NOTE: If you do not wish to interact with the created guild, the Consumer CAN BE NULL.
java.lang.String getAuthToken()
java.util.List<User> getUsers()
Users
.Users
that
JDA can currently see.Users
.User getUserById(java.lang.String id)
User
who has the same id as the one provided.null
.java.util.List<User> getUsersByName(java.lang.String name)
java.util.List<Guild> getGuilds()
Guilds
that this account is connected to.Guilds
, this will return
an empty list.Guilds
that this account is connected to.Guild getGuildById(java.lang.String id)
Guild
which has the same id as the one provided.null
.java.util.List<Guild> getGuildsByName(java.lang.String name)
java.util.List<TextChannel> getTextChannels()
TextChannels
of all Guilds
that this account is a member of.
Note: just because a TextChannel
is present in this list does
not mean that you will be able to send messages to it. Furthermore, if you log into this account on the discord
client, it is possible that you will see fewer channels than this returns. This is because the discord client
hides any TextChannel
that you don't have the
Permission.MESSAGE_READ
permission in.
TextChannels
.TextChannel getTextChannelById(java.lang.String id)
TextChannel
which has the same id as the one provided.TextChannel
with an id that matches the provided
one, then this returns null
.
Note: just because a TextChannel
is present does
not mean that you will be able to send messages to it. Furthermore, if you log into this account on the discord
client, it is you will not see the channel that this returns. This is because the discord client
hides any TextChannel
that you don't have the
Permission.MESSAGE_READ
permission in.
id
- The id of the TextChannel
.TextChannel
with matching id.java.util.List<TextChannel> getTextChannelsByName(java.lang.String name)
TextChannels
that have the same name as the one provided.TextChannels
with the provided name, then this returns an empty list.
Note: just because a TextChannel
is present in this list does
not mean that you will be able to send messages to it. Furthermore, if you log into this account on the discord
client, it is possible that you will see fewer channels than this returns. This is because the discord client
hides any TextChannel
that you don't have the
Permission.MESSAGE_READ
permission in.
name
- The name of the requested TextChannels
.TextChannels
that all have the
same name as the provided name.java.util.List<VoiceChannel> getVoiceChannels()
VoiceChannels
of all Guilds
that this account is a member of.VoiceChannels
.VoiceChannel getVoiceChannelById(java.lang.String id)
VoiceChannel
which has the same id as the one provided.VoiceChannel
with an id that matches the provided
one, then this returns null
.id
- The id of the VoiceChannel
.VoiceChannel
with matching id.java.util.List<VoiceChannel> getVoiceChannelByName(java.lang.String name)
VoiceChannels
that have the same name as the one provided.VoiceChannels
with the provided name, then this returns an empty list.name
- The name of the requested VoiceChannels
.VoiceChannels
that all have the
same name as the provided name.java.util.List<PrivateChannel> getPrivateChannels()
PrivateChannels
.PrivateChannels
.PrivateChannel getPrivateChannelById(java.lang.String id)
PrivateChannel
which has the same id as the one provided.PrivateChannel
with an id that matches the
provided one, then this returns null
.id
- The id of the PrivateChannel
.PrivateChannel
with matching id.SelfInfo getSelfInfo()
SelfInfo
.AccountManager getAccountManager()
AccountManager
for the currently logged in account.AudioManager getAudioManager()
AudioManager
for this JDA
instance. AudioManager deals with creating, managing and severing audio connections to
VoiceChannels
.int getResponseTotal()
org.apache.http.HttpHost getGlobalProxy()
Proxy.NO_PROXY
is returned.void setAutoReconnect(boolean reconnect)
reconnect
- If true - enables autoReconnectboolean isAutoReconnect()
@Deprecated void setDebug(boolean enableDebug)
SimpleLog
class.
Used to enable JDA debug output.
enableDebug
- If true - enables debug output.@Deprecated boolean isDebug()
SimpleLog
class.
Used to determine if JDA is currently in debug mode.
void shutdown()
shutdown(boolean)
instead.
To reconnect, just create a new JDA instance.void shutdown(boolean free)
free
- If true, shuts down JDA's rest system permanently.