public interface JDA
Modifier and Type | Interface and Description |
---|---|
static class |
JDA.ShardInfo
Represents the information used to create this shard.
|
static class |
JDA.Status
The current status of the JDA instance.
|
Modifier and Type | Method and Description |
---|---|
void |
addEventListener(java.lang.Object... listeners)
Adds all provided listeners to the event-listeners that will be used to handle events.
|
JDABot |
asBot() |
JDAClient |
asClient() |
AccountType |
getAccountType() |
Emote |
getEmoteById(java.lang.String id)
Retrieves an emote matching the specified
id if one is available in our cache. |
java.util.List<Emote> |
getEmotes()
A collection of all to us known emotes (managed/restricted included)
Hint: To check whether you can use an Emote you can use
PermissionUtil#canInteract(Member, Emote) . |
java.util.List<Emote> |
getEmotesByName(java.lang.String name,
boolean ignoreCase)
|
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,
boolean ignoreCase)
|
Presence |
getPresence()
The
Presence of the current session |
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 . |
java.util.List<java.lang.Object> |
getRegisteredListeners()
Returns an unmodifiable List of Objects that have been registered as EventListeners.
|
long |
getResponseTotal()
This value is the total amount of JSON responses that discord has sent.
This value resets every time the websocket has to reconnect. |
SelfUser |
getSelfUser()
Returns the currently logged in account represented by
SelfUser .Account settings cannot be modified using this object. |
JDA.ShardInfo |
getShardInfo() |
JDA.Status |
getStatus()
Gets the current
Status of the JDA instance. |
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,
boolean ignoreCase)
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. |
java.lang.String |
getToken()
The login token that is currently being used for Discord authentication.
|
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,
boolean ignoreCase)
|
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,
boolean ignoreCase)
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. |
void |
installAuxiliaryCable(int port)
Installs an auxiliary cable into your system.
|
boolean |
isAudioEnabled()
Used to determine whether the instance of JDA supports audio and has it enabled.
|
boolean |
isAutoReconnect()
Returns whether or not autoReconnect is enabled for JDA.
|
boolean |
isBulkDeleteSplittingEnabled()
Used to determine if JDA will process MESSAGE_DELETE_BULK messages received from Discord as a single
MessageBulkDeleteEvent or split
the deleted messages up and fire multiple MessageDeleteEvents ,
one for each deleted message. |
void |
removeEventListener(java.lang.Object... listeners)
Removes all provided listeners 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 |
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.
|
java.util.List<net.dv8tion.jda.core.requests.ratelimit.IBucket> |
shutdownNow(boolean free) |
JDA.Status getStatus()
Status
of the JDA instance.void setEventManager(IEventManager manager)
InterfacedEventListener
.
There is also an AnnotatedEventManager
available.manager
- The new EventManager to usevoid addEventListener(java.lang.Object... listeners)
InterfacedEventListener
by default.
To switch to the AnnotatedEventManager
, use setEventManager(IEventManager)
.
Note: when using the InterfacedEventListener
(default),
given listener must be instance of EventListener
!listeners
- The listenervoid removeEventListener(java.lang.Object... listeners)
listeners
- The listener to be removed.java.util.List<java.lang.Object> getRegisteredListeners()
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, boolean ignoreCase)
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, boolean ignoreCase)
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, boolean ignoreCase)
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
.ignoreCase
- Whether to ignore case or not.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, boolean ignoreCase)
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
.ignoreCase
- Whether to ignore case or not.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.java.util.List<Emote> getEmotes()
Emote
you can use
PermissionUtil#canInteract(Member, Emote)
.java.util.List<Emote> getEmotesByName(java.lang.String name, boolean ignoreCase)
Emotes
that have the same name as the one provided.Emotes
with the provided name, then this returns an empty list.name
- The name of the requested Emotes
.ignoreCase
- Whether to ignore case or not.Emotes
that all have the
same name as the provided name.Emote getEmoteById(java.lang.String id)
id
if one is available in our cache.id
- The emote id to look forEmote
represented by this id or null if none is found in our cacheSelfUser getSelfUser()
SelfUser
.java.lang.String getToken()
long getResponseTotal()
org.apache.http.HttpHost getGlobalProxy()
Proxy.NO_PROXY
is returned.void setAutoReconnect(boolean reconnect)
reconnect
- If true - enables autoReconnectboolean isAutoReconnect()
boolean isAudioEnabled()
boolean isBulkDeleteSplittingEnabled()
MessageBulkDeleteEvent
or split
the deleted messages up and fire multiple MessageDeleteEvents
,
one for each deleted message.
By default, JDA will separate the bulk delete event into individual delete events, but this isn't as efficient as
handling a single event would be. It is recommended that BulkDelete Splitting be disabled and that the developer
should instead handle the MessageBulkDeleteEvent
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.java.util.List<net.dv8tion.jda.core.requests.ratelimit.IBucket> shutdownNow(boolean free)
void installAuxiliaryCable(int port) throws java.lang.UnsupportedOperationException
port
- the portjava.lang.UnsupportedOperationException
AccountType getAccountType()
JDAClient asClient()
JDABot asBot()
JDA.ShardInfo getShardInfo()