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 listener)
Adds an Object to the event-listeners that will be used to handle events.
|
JDABot |
asBot() |
JDAClient |
asClient() |
AccountType |
getAccountType() |
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)
|
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. |
SelfInfo |
getSelfInfo()
Returns the currently logged in account represented by
SelfInfo .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 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 |
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.
|
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 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.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
.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
.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
.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.void installAuxiliaryCable(int port) throws java.lang.UnsupportedOperationException
port
- the portjava.lang.UnsupportedOperationException
AccountType getAccountType()
JDAClient asClient()
JDABot asBot()
JDA.ShardInfo getShardInfo()