Package org.javacord.core
Class DiscordApiImpl
- java.lang.Object
-
- org.javacord.core.DiscordApiImpl
-
- All Implemented Interfaces:
DiscordApi
,GloballyAttachableListenerManager
,DispatchQueueSelector
public class DiscordApiImpl extends Object implements DiscordApi, DispatchQueueSelector
The implementation ofDiscordApi
.
-
-
Constructor Summary
Constructors Constructor Description DiscordApiImpl(String token, ProxySelector proxySelector, Proxy proxy, Authenticator proxyAuthenticator, boolean trustAllCertificates)
Creates a new discord api instance that can be used for auto-ratelimited REST calls, but does not connect to the Discord WebSocket.DiscordApiImpl(AccountType accountType, String token, int currentShard, int totalShards, boolean waitForServersOnStartup, ProxySelector proxySelector, Proxy proxy, Authenticator proxyAuthenticator, boolean trustAllCertificates, CompletableFuture<DiscordApi> ready)
Creates a new discord api instance.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
addGroupChannelToCache(GroupChannel channel)
Adds a group channel to the cache.<T extends GloballyAttachableListener>
ListenerManager<T>addListener(Class<T> listenerClass, T listener)
Collection<ListenerManager<? extends GloballyAttachableListener>>
addListener(GloballyAttachableListener listener)
void
addMessageToCache(Message message)
Adds a message to the cache.<T extends ObjectAttachableListener>
ListenerManager<T>addObjectListener(Class<?> objectClass, long objectId, Class<T> listenerClass, T listener)
Adds an object listener.void
addServerToCache(ServerImpl server)
Adds the given server to the cache.void
addUnavailableServerToCache(long serverId)
Adds a server id to the list with unavailable servers.void
addUserToCache(User user)
Adds the given user to the cache.void
disconnect()
protected void
finalize()
AccountType
getAccountType()
Optional<Activity>
getActivity()
Collection<Server>
getAllServers()
Gets a collection with all servers, including ready and not ready ones.CompletableFuture<ApplicationInfo>
getApplicationInfo()
Optional<Message>
getCachedMessageById(long id)
MessageSet
getCachedMessages()
Optional<User>
getCachedUserById(long id)
Collection<User>
getCachedUsers()
long
getClientId()
int
getCurrentShard()
Optional<KnownCustomEmoji>
getCustomEmojiById(long id)
Collection<KnownCustomEmoji>
getCustomEmojis()
int
getDefaultMessageCacheCapacity()
int
getDefaultMessageCacheStorageTimeInSeconds()
EventDispatcher
getEventDispatcher()
Gets the event dispatcher which is used to dispatch events.Optional<GroupChannel>
getGroupChannelById(long id)
Collection<GroupChannel>
getGroupChannels()
okhttp3.OkHttpClient
getHttpClient()
Gets the usedhttp client
for this api instance.CompletableFuture<Invite>
getInviteByCode(String code)
CompletableFuture<Invite>
getInviteWithMemberCountsByCode(String code)
CustomEmoji
getKnownCustomEmojiOrCreateCustomEmoji(long id, String name, boolean animated)
Gets a known custom emoji or creates a new (unknown) custom emoji object.CustomEmoji
getKnownCustomEmojiOrCreateCustomEmoji(com.fasterxml.jackson.databind.JsonNode data)
Gets a known custom emoji or creates a new (unknown) custom emoji object.<T extends GloballyAttachableListener>
Map<T,List<Class<T>>>getListeners()
<T extends GloballyAttachableListener>
List<T>getListeners(Class<T> listenerClass)
<T extends ObjectAttachableListener>
Map<T,List<Class<T>>>getObjectListeners(Class<?> objectClass, long objectId)
Gets a map with all registered listeners that implement one or moreObjectAttachableListener
s and their assigned listener classes they listen to.<T extends ObjectAttachableListener>
List<T>getObjectListeners(Class<?> objectClass, long objectId, Class<T> listenerClass)
Gets all object listeners of the given class.com.fasterxml.jackson.databind.ObjectMapper
getObjectMapper()
Gets the object mapper used by this api instance.KnownCustomEmoji
getOrCreateKnownCustomEmoji(Server server, com.fasterxml.jackson.databind.JsonNode data)
Gets or creates a new known custom emoji object.Message
getOrCreateMessage(TextChannel channel, com.fasterxml.jackson.databind.JsonNode data)
Gets or creates a new message object.User
getOrCreateUser(com.fasterxml.jackson.databind.JsonNode data)
Gets a user or creates a new one from the given data.long
getOwnerId()
Optional<Server>
getPossiblyUnreadyServerById(long id)
Gets a server by it's id, including ready and not ready ones.String
getPrefixedToken()
Optional<Proxy>
getProxy()
The proxy which should be used to connect to the Discord REST API and websocket.Optional<Authenticator>
getProxyAuthenticator()
The authenticator that should be used to authenticate against proxies that require it.Optional<ProxySelector>
getProxySelector()
The proxy selector which should be used to determine the proxies that should be used to connect to the Discord REST API and websocket.RatelimitManager
getRatelimitManager()
Gets the ratelimit manager for this bot.int
getReconnectDelay(int attempt)
Optional<Server>
getServerById(long id)
Collection<Server>
getServers()
UserStatus
getStatus()
ThreadPool
getThreadPool()
Long
getTimeOffset()
Gets the time offset between the Discord time and our local time.String
getToken()
int
getTotalShards()
Collection<Long>
getUnavailableServers()
UncachedMessageUtil
getUncachedMessageUtil()
CompletableFuture<User>
getUserById(long id)
CompletableFuture<Webhook>
getWebhookById(long id)
DiscordWebSocketAdapter
getWebSocketAdapter()
Gets the websocket adapter which is used to connect to Discord.User
getYourself()
boolean
isDefaultAutomaticMessageCacheCleanupEnabled()
boolean
isTrustAllCertificates()
Whether to trust all SSL certificates.boolean
isWaitingForServersOnStartup()
void
purgeCache()
Purges all cached entities.void
removeCustomEmoji(KnownCustomEmoji emoji)
Removes a known custom emoji object.void
removeGroupChannelFromCache(long channelId)
Removes a group channel from the cache.<T extends GloballyAttachableListener>
voidremoveListener(Class<T> listenerClass, T listener)
void
removeListener(GloballyAttachableListener listener)
void
removeMessageFromCache(long messageId)
Removes a message from the cache.<T extends ObjectAttachableListener>
voidremoveObjectListener(Class<?> objectClass, long objectId, Class<T> listenerClass, T listener)
Removes an object listener.void
removeObjectListeners(Class<?> objectClass, long objectId)
Remove all listeners attached to an object.void
removeServerFromCache(long serverId)
Removes the given server from the cache.void
setAutomaticMessageCacheCleanupEnabled(boolean automaticMessageCacheCleanupEnabled)
void
setMessageCacheSize(int capacity, int storageTimeInSeconds)
void
setReconnectDelay(Function<Integer,Integer> reconnectDelayProvider)
void
setTimeOffset(Long timeOffset)
Sets the time offset between the Discord time and our local time.void
setYourself(User yourself)
Sets the user of the connected account.void
unsetActivity()
void
updateActivity(String name)
void
updateActivity(String name, String streamingUrl)
void
updateActivity(ActivityType type, String name)
void
updateStatus(UserStatus status)
-
Methods inherited from interface org.javacord.api.DiscordApi
createAccountUpdater, createBotInvite, createBotInvite, createServerBuilder, getCachedMessageById, getCachedUserByDiscriminatedName, getCachedUserByDiscriminatedNameIgnoreCase, getCachedUserById, getCachedUserByNameAndDiscriminator, getCachedUserByNameAndDiscriminatorIgnoreCase, getCachedUsersByDisplayName, getCachedUsersByDisplayNameIgnoreCase, getCachedUsersByName, getCachedUsersByNameIgnoreCase, getCachedUsersByNickname, getCachedUsersByNicknameIgnoreCase, getChannelById, getChannelById, getChannelCategories, getChannelCategoriesByName, getChannelCategoriesByNameIgnoreCase, getChannelCategoryById, getChannelCategoryById, getChannels, getChannelsByName, getChannelsByNameIgnoreCase, getCustomEmojiById, getCustomEmojisByName, getCustomEmojisByNameIgnoreCase, getGroupChannelById, getGroupChannelsByName, getGroupChannelsByNameIgnoreCase, getMessageById, getMessageById, getOwner, getPrivateChannelById, getPrivateChannelById, getPrivateChannels, getRoleById, getRoleById, getRoles, getRolesByName, getRolesByNameIgnoreCase, getServerById, getServerChannelById, getServerChannelById, getServerChannels, getServerChannelsByName, getServerChannelsByNameIgnoreCase, getServersByName, getServersByNameIgnoreCase, getServerTextChannelById, getServerTextChannelById, getServerTextChannels, getServerTextChannelsByName, getServerTextChannelsByNameIgnoreCase, getServerVoiceChannelById, getServerVoiceChannelById, getServerVoiceChannels, getServerVoiceChannelsByName, getServerVoiceChannelsByNameIgnoreCase, getTextChannelById, getTextChannelById, getTextChannels, getTextChannelsByName, getTextChannelsByNameIgnoreCase, getUserById, getVoiceChannelById, getVoiceChannelById, getVoiceChannels, getVoiceChannelsByName, getVoiceChannelsByNameIgnoreCase, updateAvatar, updateAvatar, updateAvatar, updateAvatar, updateAvatar, updateAvatar, updateAvatar, updateAvatar, updateAvatar, updateUsername
-
Methods inherited from interface org.javacord.api.listener.GloballyAttachableListenerManager
addCachedMessagePinListener, addCachedMessageUnpinListener, addChannelPinsUpdateListener, addGroupChannelChangeNameListener, addGroupChannelCreateListener, addGroupChannelDeleteListener, addKnownCustomEmojiChangeNameListener, addKnownCustomEmojiChangeWhitelistedRolesListener, addKnownCustomEmojiCreateListener, addKnownCustomEmojiDeleteListener, addLostConnectionListener, addMessageCreateListener, addMessageDeleteListener, addMessageEditListener, addPrivateChannelCreateListener, addPrivateChannelDeleteListener, addReactionAddListener, addReactionRemoveAllListener, addReactionRemoveListener, addReconnectListener, addResumeListener, addRoleChangeColorListener, addRoleChangeHoistListener, addRoleChangeMentionableListener, addRoleChangeNameListener, addRoleChangePermissionsListener, addRoleChangePositionListener, addRoleCreateListener, addRoleDeleteListener, addServerBecomesAvailableListener, addServerBecomesUnavailableListener, addServerChangeAfkChannelListener, addServerChangeAfkTimeoutListener, addServerChangeDefaultMessageNotificationLevelListener, addServerChangeExplicitContentFilterLevelListener, addServerChangeIconListener, addServerChangeMultiFactorAuthenticationLevelListener, addServerChangeNameListener, addServerChangeOwnerListener, addServerChangeRegionListener, addServerChangeSplashListener, addServerChangeSystemChannelListener, addServerChangeVerificationLevelListener, addServerChannelChangeNameListener, addServerChannelChangeNsfwFlagListener, addServerChannelChangeOverwrittenPermissionsListener, addServerChannelChangePositionListener, addServerChannelCreateListener, addServerChannelDeleteListener, addServerJoinListener, addServerLeaveListener, addServerMemberBanListener, addServerMemberJoinListener, addServerMemberLeaveListener, addServerMemberUnbanListener, addServerTextChannelChangeSlowmodeListener, addServerTextChannelChangeTopicListener, addServerVoiceChannelChangeBitrateListener, addServerVoiceChannelChangeUserLimitListener, addServerVoiceChannelMemberJoinListener, addServerVoiceChannelMemberLeaveListener, addUserChangeActivityListener, addUserChangeAvatarListener, addUserChangeDeafenedListener, addUserChangeDiscriminatorListener, addUserChangeMutedListener, addUserChangeNameListener, addUserChangeNicknameListener, addUserChangeSelfDeafenedListener, addUserChangeSelfMutedListener, addUserChangeStatusListener, addUserRoleAddListener, addUserRoleRemoveListener, addUserStartTypingListener, addWebhooksUpdateListener, getCachedMessagePinListeners, getCachedMessageUnpinListeners, getChannelPinsUpdateListeners, getGroupChannelChangeNameListeners, getGroupChannelCreateListeners, getGroupChannelDeleteListeners, getKnownCustomEmojiChangeNameListeners, getKnownCustomEmojiChangeWhitelistedRolesListeners, getKnownCustomEmojiCreateListeners, getKnownCustomEmojiDeleteListeners, getLostConnectionListeners, getMessageCreateListeners, getMessageDeleteListeners, getMessageEditListeners, getPrivateChannelCreateListeners, getPrivateChannelDeleteListeners, getReactionAddListeners, getReactionRemoveAllListeners, getReactionRemoveListeners, getReconnectListeners, getResumeListeners, getRoleChangeColorListeners, getRoleChangeHoistListeners, getRoleChangeMentionableListeners, getRoleChangeNameListeners, getRoleChangePermissionsListeners, getRoleChangePositionListeners, getRoleCreateListeners, getRoleDeleteListeners, getServerBecomesAvailableListeners, getServerBecomesUnavailableListeners, getServerChangeAfkChannelListeners, getServerChangeAfkTimeoutListeners, getServerChangeDefaultMessageNotificationLevelListeners, getServerChangeExplicitContentFilterLevelListeners, getServerChangeIconListeners, getServerChangeMultiFactorAuthenticationLevelListeners, getServerChangeNameListeners, getServerChangeOwnerListeners, getServerChangeRegionListeners, getServerChangeSplashListeners, getServerChangeSystemChannelListeners, getServerChangeVerificationLevelListeners, getServerChannelChangeNameListeners, getServerChannelChangeNsfwFlagListeners, getServerChannelChangeOverwrittenPermissionsListeners, getServerChannelChangePositionListeners, getServerChannelCreateListeners, getServerChannelDeleteListeners, getServerJoinListeners, getServerLeaveListeners, getServerMemberBanListeners, getServerMemberJoinListeners, getServerMemberLeaveListeners, getServerMemberUnbanListeners, getServerTextChannelChangeSlowmodeListeners, getServerTextChannelChangeTopicListeners, getServerVoiceChannelChangeBitrateListeners, getServerVoiceChannelChangeUserLimitListeners, getServerVoiceChannelMemberJoinListeners, getServerVoiceChannelMemberLeaveListeners, getUserChangeActivityListeners, getUserChangeAvatarListeners, getUserChangeDeafenedListeners, getUserChangeDiscriminatorListeners, getUserChangeMutedListeners, getUserChangeNameListeners, getUserChangeNicknameListeners, getUserChangeSelfDeafenedListeners, getUserChangeSelfMutedListeners, getUserChangeStatusListeners, getUserRoleAddListeners, getUserRoleRemoveListeners, getUserStartTypingListeners, getWebhooksUpdateListeners
-
-
-
-
Constructor Detail
-
DiscordApiImpl
public DiscordApiImpl(String token, ProxySelector proxySelector, Proxy proxy, Authenticator proxyAuthenticator, boolean trustAllCertificates)
Creates a new discord api instance that can be used for auto-ratelimited REST calls, but does not connect to the Discord WebSocket.- Parameters:
token
- The token used to connect without any account type specific prefix.proxySelector
- The proxy selector which should be used to determine the proxies that should be used to connect to the Discord REST API and websocket.proxy
- The proxy which should be used to connect to the Discord REST API and websocket.proxyAuthenticator
- The authenticator that should be used to authenticate against proxies that require it.trustAllCertificates
- Whether to trust all SSL certificates.
-
DiscordApiImpl
public DiscordApiImpl(AccountType accountType, String token, int currentShard, int totalShards, boolean waitForServersOnStartup, ProxySelector proxySelector, Proxy proxy, Authenticator proxyAuthenticator, boolean trustAllCertificates, CompletableFuture<DiscordApi> ready)
Creates a new discord api instance.- Parameters:
accountType
- The account type of the instance.token
- The token used to connect without any account type specific prefix.currentShard
- The current shard the bot should connect to.totalShards
- The total amount of shards.waitForServersOnStartup
- Whether Javacord should wait for all servers to become available on startup or not.proxySelector
- The proxy selector which should be used to determine the proxies that should be used to connect to the Discord REST API and websocket.proxy
- The proxy which should be used to connect to the Discord REST API and websocket.proxyAuthenticator
- The authenticator that should be used to authenticate against proxies that require it.trustAllCertificates
- Whether to trust all SSL certificates.ready
- The future which will be completed when the connection to Discord was successful.
-
-
Method Detail
-
getHttpClient
public okhttp3.OkHttpClient getHttpClient()
Gets the usedhttp client
for this api instance.- Returns:
- The used http client.
-
getEventDispatcher
public EventDispatcher getEventDispatcher()
Gets the event dispatcher which is used to dispatch events.- Returns:
- The used event dispatcher.
-
getRatelimitManager
public RatelimitManager getRatelimitManager()
Gets the ratelimit manager for this bot.- Returns:
- The ratelimit manager for this bot.
-
getObjectMapper
public com.fasterxml.jackson.databind.ObjectMapper getObjectMapper()
Gets the object mapper used by this api instance.- Returns:
- The object mapper used by this api instance.
-
purgeCache
public void purgeCache()
Purges all cached entities. This method is only meant to be called after receiving a READY packet.
-
getAllServers
public Collection<Server> getAllServers()
Gets a collection with all servers, including ready and not ready ones.- Returns:
- A collection with all servers.
-
getPossiblyUnreadyServerById
public Optional<Server> getPossiblyUnreadyServerById(long id)
Gets a server by it's id, including ready and not ready ones.- Parameters:
id
- The of the server.- Returns:
- The server with the given id.
-
addServerToCache
public void addServerToCache(ServerImpl server)
Adds the given server to the cache.- Parameters:
server
- The server to add.
-
removeServerFromCache
public void removeServerFromCache(long serverId)
Removes the given server from the cache.- Parameters:
serverId
- The id of the server to remove.
-
addUserToCache
public void addUserToCache(User user)
Adds the given user to the cache.- Parameters:
user
- The user to add.
-
addGroupChannelToCache
public void addGroupChannelToCache(GroupChannel channel)
Adds a group channel to the cache.- Parameters:
channel
- The channel to add.
-
removeGroupChannelFromCache
public void removeGroupChannelFromCache(long channelId)
Removes a group channel from the cache.- Parameters:
channelId
- The id of the channel to remove.
-
addUnavailableServerToCache
public void addUnavailableServerToCache(long serverId)
Adds a server id to the list with unavailable servers.- Parameters:
serverId
- The id of the server.
-
setYourself
public void setYourself(User yourself)
Sets the user of the connected account.- Parameters:
yourself
- The user of the connected account.
-
getTimeOffset
public Long getTimeOffset()
Gets the time offset between the Discord time and our local time. Might benull
if it hasn't been calculated yet.- Returns:
- The time offset between the Discord time and our local time.
-
setTimeOffset
public void setTimeOffset(Long timeOffset)
Sets the time offset between the Discord time and our local time.- Parameters:
timeOffset
- The time offset to set.
-
getOrCreateUser
public User getOrCreateUser(com.fasterxml.jackson.databind.JsonNode data)
Gets a user or creates a new one from the given data.- Parameters:
data
- The json data of the user.- Returns:
- The user.
-
getOrCreateKnownCustomEmoji
public KnownCustomEmoji getOrCreateKnownCustomEmoji(Server server, com.fasterxml.jackson.databind.JsonNode data)
Gets or creates a new known custom emoji object.- Parameters:
server
- The server of the emoji.data
- The data of the emoji.- Returns:
- The emoji for the given json object.
-
getKnownCustomEmojiOrCreateCustomEmoji
public CustomEmoji getKnownCustomEmojiOrCreateCustomEmoji(com.fasterxml.jackson.databind.JsonNode data)
Gets a known custom emoji or creates a new (unknown) custom emoji object.- Parameters:
data
- The data of the emoji.- Returns:
- The emoji for the given json object.
-
getKnownCustomEmojiOrCreateCustomEmoji
public CustomEmoji getKnownCustomEmojiOrCreateCustomEmoji(long id, String name, boolean animated)
Gets a known custom emoji or creates a new (unknown) custom emoji object.- Parameters:
id
- The id of the emoji.name
- The name of the emoji.animated
- Whether the emoji is animated or not.- Returns:
- The emoji for the given json object.
-
removeCustomEmoji
public void removeCustomEmoji(KnownCustomEmoji emoji)
Removes a known custom emoji object.- Parameters:
emoji
- The emoji to remove.
-
getOrCreateMessage
public Message getOrCreateMessage(TextChannel channel, com.fasterxml.jackson.databind.JsonNode data)
Gets or creates a new message object.- Parameters:
channel
- The channel of the message.data
- The data of the message.- Returns:
- The message for the given json object.
-
addMessageToCache
public void addMessageToCache(Message message)
Adds a message to the cache.- Parameters:
message
- The message to add.
-
removeMessageFromCache
public void removeMessageFromCache(long messageId)
Removes a message from the cache.- Parameters:
messageId
- The id of the message to remove.
-
addObjectListener
public <T extends ObjectAttachableListener> ListenerManager<T> addObjectListener(Class<?> objectClass, long objectId, Class<T> listenerClass, T listener)
Adds an object listener. Adding a listener multiple times to the same object will only add it once and return the same listener manager on each invocation. The order of invocation is according to first addition.- Type Parameters:
T
- The type of the listener.- Parameters:
objectClass
- The class of the object.objectId
- The id of the object.listenerClass
- The listener class.listener
- The listener to add.- Returns:
- The manager for the added listener.
-
removeObjectListener
public <T extends ObjectAttachableListener> void removeObjectListener(Class<?> objectClass, long objectId, Class<T> listenerClass, T listener)
Removes an object listener.- Type Parameters:
T
- The type of the listener.- Parameters:
objectClass
- The class of the object.objectId
- The id of the object.listenerClass
- The listener class.listener
- The listener to remove.
-
removeObjectListeners
public void removeObjectListeners(Class<?> objectClass, long objectId)
Remove all listeners attached to an object.- Parameters:
objectClass
- The class of the object.objectId
- The id of the object.
-
getObjectListeners
public <T extends ObjectAttachableListener> Map<T,List<Class<T>>> getObjectListeners(Class<?> objectClass, long objectId)
Gets a map with all registered listeners that implement one or moreObjectAttachableListener
s and their assigned listener classes they listen to.- Type Parameters:
T
- The type of the listeners.- Parameters:
objectClass
- The class of the object.objectId
- The id of the object.- Returns:
- A map with all registered listeners that implement one or more
ObjectAttachableListener
s and their assigned listener classes they listen to.
-
getObjectListeners
public <T extends ObjectAttachableListener> List<T> getObjectListeners(Class<?> objectClass, long objectId, Class<T> listenerClass)
Gets all object listeners of the given class.- Type Parameters:
T
- The type of the listener.- Parameters:
objectClass
- The class of the object.objectId
- The id of the object.listenerClass
- The listener class.- Returns:
- A list with all object listeners of the given type.
-
getListeners
public <T extends GloballyAttachableListener> Map<T,List<Class<T>>> getListeners()
- Specified by:
getListeners
in interfaceGloballyAttachableListenerManager
-
getListeners
public <T extends GloballyAttachableListener> List<T> getListeners(Class<T> listenerClass)
- Specified by:
getListeners
in interfaceGloballyAttachableListenerManager
-
getPrefixedToken
public String getPrefixedToken()
- Specified by:
getPrefixedToken
in interfaceDiscordApi
-
getToken
public String getToken()
- Specified by:
getToken
in interfaceDiscordApi
-
getThreadPool
public ThreadPool getThreadPool()
- Specified by:
getThreadPool
in interfaceDiscordApi
-
getUncachedMessageUtil
public UncachedMessageUtil getUncachedMessageUtil()
- Specified by:
getUncachedMessageUtil
in interfaceDiscordApi
-
getWebSocketAdapter
public DiscordWebSocketAdapter getWebSocketAdapter()
Gets the websocket adapter which is used to connect to Discord.- Returns:
- The websocket adapter.
-
getAccountType
public AccountType getAccountType()
- Specified by:
getAccountType
in interfaceDiscordApi
-
setMessageCacheSize
public void setMessageCacheSize(int capacity, int storageTimeInSeconds)
- Specified by:
setMessageCacheSize
in interfaceDiscordApi
-
getDefaultMessageCacheCapacity
public int getDefaultMessageCacheCapacity()
- Specified by:
getDefaultMessageCacheCapacity
in interfaceDiscordApi
-
getDefaultMessageCacheStorageTimeInSeconds
public int getDefaultMessageCacheStorageTimeInSeconds()
- Specified by:
getDefaultMessageCacheStorageTimeInSeconds
in interfaceDiscordApi
-
setAutomaticMessageCacheCleanupEnabled
public void setAutomaticMessageCacheCleanupEnabled(boolean automaticMessageCacheCleanupEnabled)
- Specified by:
setAutomaticMessageCacheCleanupEnabled
in interfaceDiscordApi
-
isDefaultAutomaticMessageCacheCleanupEnabled
public boolean isDefaultAutomaticMessageCacheCleanupEnabled()
- Specified by:
isDefaultAutomaticMessageCacheCleanupEnabled
in interfaceDiscordApi
-
getCurrentShard
public int getCurrentShard()
- Specified by:
getCurrentShard
in interfaceDiscordApi
-
getTotalShards
public int getTotalShards()
- Specified by:
getTotalShards
in interfaceDiscordApi
-
isWaitingForServersOnStartup
public boolean isWaitingForServersOnStartup()
- Specified by:
isWaitingForServersOnStartup
in interfaceDiscordApi
-
getProxySelector
public Optional<ProxySelector> getProxySelector()
The proxy selector which should be used to determine the proxies that should be used to connect to the Discord REST API and websocket.- Returns:
- the proxy selector which should be used to determine the proxies that should be used to connect to the Discord REST API and websocket.
-
getProxy
public Optional<Proxy> getProxy()
The proxy which should be used to connect to the Discord REST API and websocket.- Returns:
- the proxy which should be used to connect to the Discord REST API and websocket.
-
getProxyAuthenticator
public Optional<Authenticator> getProxyAuthenticator()
The authenticator that should be used to authenticate against proxies that require it.- Returns:
- the authenticator that should be used to authenticate against proxies that require it.
-
isTrustAllCertificates
public boolean isTrustAllCertificates()
Whether to trust all SSL certificates.- Returns:
- whether to trust all SSL certificates.
-
updateStatus
public void updateStatus(UserStatus status)
- Specified by:
updateStatus
in interfaceDiscordApi
-
getStatus
public UserStatus getStatus()
- Specified by:
getStatus
in interfaceDiscordApi
-
updateActivity
public void updateActivity(String name)
- Specified by:
updateActivity
in interfaceDiscordApi
-
updateActivity
public void updateActivity(ActivityType type, String name)
- Specified by:
updateActivity
in interfaceDiscordApi
-
updateActivity
public void updateActivity(String name, String streamingUrl)
- Specified by:
updateActivity
in interfaceDiscordApi
-
unsetActivity
public void unsetActivity()
- Specified by:
unsetActivity
in interfaceDiscordApi
-
getActivity
public Optional<Activity> getActivity()
- Specified by:
getActivity
in interfaceDiscordApi
-
getYourself
public User getYourself()
- Specified by:
getYourself
in interfaceDiscordApi
-
getOwnerId
public long getOwnerId()
- Specified by:
getOwnerId
in interfaceDiscordApi
-
getClientId
public long getClientId()
- Specified by:
getClientId
in interfaceDiscordApi
-
disconnect
public void disconnect()
- Specified by:
disconnect
in interfaceDiscordApi
-
setReconnectDelay
public void setReconnectDelay(Function<Integer,Integer> reconnectDelayProvider)
- Specified by:
setReconnectDelay
in interfaceDiscordApi
-
getReconnectDelay
public int getReconnectDelay(int attempt)
- Specified by:
getReconnectDelay
in interfaceDiscordApi
-
getApplicationInfo
public CompletableFuture<ApplicationInfo> getApplicationInfo()
- Specified by:
getApplicationInfo
in interfaceDiscordApi
-
getWebhookById
public CompletableFuture<Webhook> getWebhookById(long id)
- Specified by:
getWebhookById
in interfaceDiscordApi
-
getUnavailableServers
public Collection<Long> getUnavailableServers()
- Specified by:
getUnavailableServers
in interfaceDiscordApi
-
getInviteByCode
public CompletableFuture<Invite> getInviteByCode(String code)
- Specified by:
getInviteByCode
in interfaceDiscordApi
-
getInviteWithMemberCountsByCode
public CompletableFuture<Invite> getInviteWithMemberCountsByCode(String code)
- Specified by:
getInviteWithMemberCountsByCode
in interfaceDiscordApi
-
getCachedUsers
public Collection<User> getCachedUsers()
- Specified by:
getCachedUsers
in interfaceDiscordApi
-
getCachedUserById
public Optional<User> getCachedUserById(long id)
- Specified by:
getCachedUserById
in interfaceDiscordApi
-
getUserById
public CompletableFuture<User> getUserById(long id)
- Specified by:
getUserById
in interfaceDiscordApi
-
getCachedMessages
public MessageSet getCachedMessages()
- Specified by:
getCachedMessages
in interfaceDiscordApi
-
getCachedMessageById
public Optional<Message> getCachedMessageById(long id)
- Specified by:
getCachedMessageById
in interfaceDiscordApi
-
getServers
public Collection<Server> getServers()
- Specified by:
getServers
in interfaceDiscordApi
-
getServerById
public Optional<Server> getServerById(long id)
- Specified by:
getServerById
in interfaceDiscordApi
-
getCustomEmojis
public Collection<KnownCustomEmoji> getCustomEmojis()
- Specified by:
getCustomEmojis
in interfaceDiscordApi
-
getCustomEmojiById
public Optional<KnownCustomEmoji> getCustomEmojiById(long id)
- Specified by:
getCustomEmojiById
in interfaceDiscordApi
-
getGroupChannels
public Collection<GroupChannel> getGroupChannels()
- Specified by:
getGroupChannels
in interfaceDiscordApi
-
getGroupChannelById
public Optional<GroupChannel> getGroupChannelById(long id)
- Specified by:
getGroupChannelById
in interfaceDiscordApi
-
addListener
public Collection<ListenerManager<? extends GloballyAttachableListener>> addListener(GloballyAttachableListener listener)
- Specified by:
addListener
in interfaceGloballyAttachableListenerManager
-
addListener
public <T extends GloballyAttachableListener> ListenerManager<T> addListener(Class<T> listenerClass, T listener)
- Specified by:
addListener
in interfaceGloballyAttachableListenerManager
-
removeListener
public <T extends GloballyAttachableListener> void removeListener(Class<T> listenerClass, T listener)
- Specified by:
removeListener
in interfaceGloballyAttachableListenerManager
-
removeListener
public void removeListener(GloballyAttachableListener listener)
- Specified by:
removeListener
in interfaceGloballyAttachableListenerManager
-
-