Interface DiscordApi
-
- All Superinterfaces:
GloballyAttachableListenerManager
public interface DiscordApi extends GloballyAttachableListenerManager
This class is the most important class for your bot, containing all important methods, like registering listener.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description default AccountUpdatercreateAccountUpdater()Creates an account updater for the current account.default StringcreateBotInvite()Creates an invite link for the this bot.default StringcreateBotInvite(Permissions permissions)Creates an invite link for the this bot.default ServerBuildercreateServerBuilder()Creates a server builder which can be used to create servers.voiddisconnect()Disconnects the bot.AccountTypegetAccountType()Gets the type of the current account.Optional<Activity>getActivity()Gets the activity which should be displayed.CompletableFuture<ApplicationInfo>getApplicationInfo()Gets the application info of the bot.Optional<Message>getCachedMessageById(long id)Gets a cached message by its id.default Optional<Message>getCachedMessageById(String id)Gets a cached message by its id.MessageSetgetCachedMessages()Gets a message set with all currently cached messages.default Optional<User>getCachedUserByDiscriminatedName(String discriminatedName)Gets a user by its discriminated name like e.default Optional<User>getCachedUserByDiscriminatedNameIgnoreCase(String discriminatedName)Gets a user by its discriminated name like e.Optional<User>getCachedUserById(long id)Gets a cached user by its id.default Optional<User>getCachedUserById(String id)Gets a cached user by its id.default Optional<User>getCachedUserByNameAndDiscriminator(String name, String discriminator)Gets a user by its name and discriminator.default Optional<User>getCachedUserByNameAndDiscriminatorIgnoreCase(String name, String discriminator)Gets a user by its name and discriminator.Collection<User>getCachedUsers()Gets a collection with all currently cached users.default Collection<User>getCachedUsersByDisplayName(String displayName, Server server)Gets a collection with all users with the given display name on the given server.default Collection<User>getCachedUsersByDisplayNameIgnoreCase(String displayName, Server server)Gets a collection with all users with the given display name on the given server.default Collection<User>getCachedUsersByName(String name)Gets a collection with all users with the given name.default Collection<User>getCachedUsersByNameIgnoreCase(String name)Gets a collection with all users with the given name.default Collection<User>getCachedUsersByNickname(String nickname, Server server)Gets a collection with all users with the given nickname on the given server.default Collection<User>getCachedUsersByNicknameIgnoreCase(String nickname, Server server)Gets a collection with all users with the given nickname on the given server.default Optional<Channel>getChannelById(long id)Gets a channel by its id.default Optional<Channel>getChannelById(String id)Gets a channel by its id.default Collection<ChannelCategory>getChannelCategories()Gets a collection with all channel categories of the bot.default Collection<ChannelCategory>getChannelCategoriesByName(String name)Gets a collection with all channel categories with the given name.default Collection<ChannelCategory>getChannelCategoriesByNameIgnoreCase(String name)Gets a collection with all channel categories with the given name.default Optional<ChannelCategory>getChannelCategoryById(long id)Gets a channel category by its id.default Optional<ChannelCategory>getChannelCategoryById(String id)Gets a channel category by its id.default Collection<Channel>getChannels()Gets a collection with all channels of the bot.default Collection<Channel>getChannelsByName(String name)Gets a collection with all channels with the given name.default Collection<Channel>getChannelsByNameIgnoreCase(String name)Gets a collection with all channels with the given name.longgetClientId()Gets the client id of the application.intgetCurrentShard()Gets the current shard of the bot, starting with0.default Optional<KnownCustomEmoji>getCustomEmojiById(long id)Gets a custom emoji in this server by its id.default Optional<KnownCustomEmoji>getCustomEmojiById(String id)Gets a custom emoji in this server by its id.Collection<KnownCustomEmoji>getCustomEmojis()Gets a collection with all known custom emojis.default Collection<KnownCustomEmoji>getCustomEmojisByName(String name)Gets a collection with all custom emojis with the given name in the server.default Collection<KnownCustomEmoji>getCustomEmojisByNameIgnoreCase(String name)Gets a collection with all custom emojis with the given name in the server.intgetDefaultMessageCacheCapacity()Gets the default message cache capacity which is applied for every newly created channel.intgetDefaultMessageCacheStorageTimeInSeconds()Gets the default maximum age of cached messages.default Optional<GroupChannel>getGroupChannelById(long id)Gets a group channel by its id.default Optional<GroupChannel>getGroupChannelById(String id)Gets a group channel by its id.Collection<GroupChannel>getGroupChannels()Gets a collection with all group channels of the bot.default Collection<GroupChannel>getGroupChannelsByName(String name)Gets a collection with all group channels with the given name.default Collection<GroupChannel>getGroupChannelsByNameIgnoreCase(String name)Gets a collection with all server channels with the given name.CompletableFuture<Invite>getInviteByCode(String code)Gets an invite by its code.CompletableFuture<Invite>getInviteWithMemberCountsByCode(String code)Gets an invite by its code while requesting additional information.default CompletableFuture<Message>getMessageById(long id, TextChannel channel)Gets a message by its id.default CompletableFuture<Message>getMessageById(String id, TextChannel channel)Gets a message by its id.default CompletableFuture<User>getOwner()Gets the owner of the application.longgetOwnerId()Gets the id of the application's owner.StringgetPrefixedToken()Gets the used token with theAccountType.getTokenPrefix(), that way it is usable directly in the authentication header for custom REST calls.default Optional<PrivateChannel>getPrivateChannelById(long id)Gets a private channel by its id.default Optional<PrivateChannel>getPrivateChannelById(String id)Gets a private channel by its id.default Collection<PrivateChannel>getPrivateChannels()Gets a collection with all private channels of the bot.intgetReconnectDelay(int attempt)Gets the reconnect delay for a given amount of attempts.default Optional<Role>getRoleById(long id)Gets a role by its id.default Optional<Role>getRoleById(String id)Gets a role by its id.default Collection<Role>getRoles()Gets a collection with all roles the bot knows.default Collection<Role>getRolesByName(String name)Gets a collection with all roles with the given name.default Collection<Role>getRolesByNameIgnoreCase(String name)Gets a collection with all roles with the given name.default Optional<Server>getServerById(long id)Gets a server by its id.default Optional<Server>getServerById(String id)Gets a server by its id.default Optional<ServerChannel>getServerChannelById(long id)Gets a server channel by its id.default Optional<ServerChannel>getServerChannelById(String id)Gets a server channel by its id.default Collection<ServerChannel>getServerChannels()Gets a collection with all server channels of the bot.default Collection<ServerChannel>getServerChannelsByName(String name)Gets a collection with all server channels with the given name.default Collection<ServerChannel>getServerChannelsByNameIgnoreCase(String name)Gets a collection with all server channels with the given name.Collection<Server>getServers()Gets a collection with all servers the bot is in.default Collection<Server>getServersByName(String name)Gets a collection with all servers with the given name.default Collection<Server>getServersByNameIgnoreCase(String name)Gets a collection with all servers with the given name.default Optional<ServerTextChannel>getServerTextChannelById(long id)Gets a server text channel by its id.default Optional<ServerTextChannel>getServerTextChannelById(String id)Gets a server text channel by its id.default Collection<ServerTextChannel>getServerTextChannels()Gets a collection with all server text channels of the bot.default Collection<ServerTextChannel>getServerTextChannelsByName(String name)Gets a collection with all server text channels with the given name.default Collection<ServerTextChannel>getServerTextChannelsByNameIgnoreCase(String name)Gets a collection with all server text channels with the given name.default Optional<ServerVoiceChannel>getServerVoiceChannelById(long id)Gets a server voice channel by its id.default Optional<ServerVoiceChannel>getServerVoiceChannelById(String id)Gets a server voice channel by its id.default Collection<ServerVoiceChannel>getServerVoiceChannels()Gets a collection with all server voice channels of the bot.default Collection<ServerVoiceChannel>getServerVoiceChannelsByName(String name)Gets a collection with all server voice channels with the given name.default Collection<ServerVoiceChannel>getServerVoiceChannelsByNameIgnoreCase(String name)Gets a collection with all server voice channels with the given name.UserStatusgetStatus()Gets the status which should be displayed for this bot.default Optional<TextChannel>getTextChannelById(long id)Gets a text channel by its id.default Optional<TextChannel>getTextChannelById(String id)Gets a text channel by its id.default Collection<TextChannel>getTextChannels()Gets a collection with all text channels of the bot.default Collection<TextChannel>getTextChannelsByName(String name)Gets a collection with all text channels with the given name.default Collection<TextChannel>getTextChannelsByNameIgnoreCase(String name)Gets a collection with all text channels with the given name.ThreadPoolgetThreadPool()Gets the thread pool which is internally used.StringgetToken()Gets the used token.intgetTotalShards()Gets the total amount of shards.Collection<Long>getUnavailableServers()Gets a collection with the ids of all unavailable servers.UncachedMessageUtilgetUncachedMessageUtil()Gets a utility class to interact with uncached messages.CompletableFuture<User>getUserById(long id)Gets a user by its id.default CompletableFuture<User>getUserById(String id)Gets a user by its id.default Optional<VoiceChannel>getVoiceChannelById(long id)Gets a voice channel by its id.default Optional<VoiceChannel>getVoiceChannelById(String id)Gets a voice channel by its id.default Collection<VoiceChannel>getVoiceChannels()Gets a collection with all voice channels of the bot.default Collection<VoiceChannel>getVoiceChannelsByName(String name)Gets a collection with all voice channels with the given name.default Collection<VoiceChannel>getVoiceChannelsByNameIgnoreCase(String name)Gets a collection with all voice channels with the given name.CompletableFuture<Webhook>getWebhookById(long id)Gets a webhook by its id.UsergetYourself()Gets a user of the connected account.booleanisDefaultAutomaticMessageCacheCleanupEnabled()Gets whether automatic message cache cleanup is enabled.booleanisWaitingForServersOnStartup()Checks if Javacord is waiting for all servers to become available on startup.voidsetAutomaticMessageCacheCleanupEnabled(boolean automaticMessageCacheCleanupEnabled)Sets whether automatic message cache cleanup is enabled for all existing message caches and all newly created ones.voidsetMessageCacheSize(int capacity, int storageTimeInSeconds)Sets the cache size of all caches.voidsetReconnectDelay(Function<Integer,Integer> reconnectDelayProvider)Sets a function which is used to get the delay between reconnects.voidunsetActivity()Unsets the activity of this bot.voidupdateActivity(String name)Updates the activity of this bot, represented as "Playing Half-Life 3" for example.voidupdateActivity(String name, String streamingUrl)Updates the activity of this bot with a streaming url, represented as "Streaming Half-Life 3" for example.voidupdateActivity(ActivityType type, String name)Updates the activity of this bot with any type.default CompletableFuture<Void>updateAvatar(byte[] avatar)Updates the avatar of the current account.default CompletableFuture<Void>updateAvatar(byte[] avatar, String fileType)Updates the avatar of the current account.default CompletableFuture<Void>updateAvatar(BufferedImage avatar)Updates the avatar of the current account.default CompletableFuture<Void>updateAvatar(BufferedImage avatar, String fileType)Updates the avatar of the current account.default CompletableFuture<Void>updateAvatar(File avatar)Updates the avatar of the current account.default CompletableFuture<Void>updateAvatar(InputStream avatar)Updates the avatar of the current account.default CompletableFuture<Void>updateAvatar(InputStream avatar, String fileType)Updates the avatar of the current account.default CompletableFuture<Void>updateAvatar(URL avatar)Updates the avatar of the current account.default CompletableFuture<Void>updateAvatar(Icon avatar)Updates the avatar of the current account.voidupdateStatus(UserStatus status)Updates the status of this bot.default CompletableFuture<Void>updateUsername(String username)Updates the username of the current account.-
Methods inherited from interface org.javacord.api.listener.GloballyAttachableListenerManager
addCachedMessagePinListener, addCachedMessageUnpinListener, addChannelPinsUpdateListener, addGroupChannelChangeNameListener, addGroupChannelCreateListener, addGroupChannelDeleteListener, addKnownCustomEmojiChangeNameListener, addKnownCustomEmojiChangeWhitelistedRolesListener, addKnownCustomEmojiCreateListener, addKnownCustomEmojiDeleteListener, addListener, addListener, 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, getListeners, getListeners, 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, removeListener, removeListener
-
-
-
-
Method Detail
-
getToken
String getToken()
Gets the used token.- Returns:
- The used token.
-
getPrefixedToken
String getPrefixedToken()
Gets the used token with theAccountType.getTokenPrefix(), that way it is usable directly in the authentication header for custom REST calls.- Returns:
- The prefixed, used token.
-
getThreadPool
ThreadPool getThreadPool()
Gets the thread pool which is internally used.- Returns:
- The internally used thread pool.
-
getUncachedMessageUtil
UncachedMessageUtil getUncachedMessageUtil()
Gets a utility class to interact with uncached messages.- Returns:
- A utility class to interact with uncached messages.
-
getAccountType
AccountType getAccountType()
Gets the type of the current account.- Returns:
- The type of the current account.
-
createBotInvite
default String createBotInvite()
Creates an invite link for the this bot. The method only works for bot accounts!- Returns:
- An invite link for this bot.
- Throws:
IllegalStateException- If the current account is notAccountType.BOT.
-
createBotInvite
default String createBotInvite(Permissions permissions)
Creates an invite link for the this bot. The method only works for bot accounts!- Parameters:
permissions- The permissions which should be granted to the bot.- Returns:
- An invite link for this bot.
- Throws:
IllegalStateException- If the current account is notAccountType.BOT.
-
setMessageCacheSize
void setMessageCacheSize(int capacity, int storageTimeInSeconds)Sets the cache size of all caches. This settings are applied on a per-channel basis. It overrides all previous settings, so it's recommended to directly set it after logging in, if you want to change some channel specific cache settings, too. Please notice that the cache is cleared only once every minute!- Parameters:
capacity- The capacity of the message cache.storageTimeInSeconds- The maximum age of cached messages.
-
getDefaultMessageCacheCapacity
int getDefaultMessageCacheCapacity()
Gets the default message cache capacity which is applied for every newly created channel.- Returns:
- The default message cache capacity which is applied for every newly created channel.
-
getDefaultMessageCacheStorageTimeInSeconds
int getDefaultMessageCacheStorageTimeInSeconds()
Gets the default maximum age of cached messages.- Returns:
- The default maximum age of cached messages.
-
setAutomaticMessageCacheCleanupEnabled
void setAutomaticMessageCacheCleanupEnabled(boolean automaticMessageCacheCleanupEnabled)
Sets whether automatic message cache cleanup is enabled for all existing message caches and all newly created ones.- Parameters:
automaticMessageCacheCleanupEnabled- Whether automatic message cache cleanup is enabled.
-
isDefaultAutomaticMessageCacheCleanupEnabled
boolean isDefaultAutomaticMessageCacheCleanupEnabled()
Gets whether automatic message cache cleanup is enabled.- Returns:
- Whether automatic message cache cleanup is enabled.
-
getCurrentShard
int getCurrentShard()
Gets the current shard of the bot, starting with0.- Returns:
- The current shard of the bot.
-
getTotalShards
int getTotalShards()
Gets the total amount of shards. If the total amount is0sharding is disabled.- Returns:
- The total amount of shards.
-
isWaitingForServersOnStartup
boolean isWaitingForServersOnStartup()
Checks if Javacord is waiting for all servers to become available on startup.- Returns:
- Whether Javacord is waiting for all servers to become available on startup or not.
-
updateStatus
void updateStatus(UserStatus status)
Updates the status of this bot. The update might not be visible immediately as it's through the websocket and only a limited amount of status changes is allowed per minute.- Parameters:
status- The status of this bot.
-
getStatus
UserStatus getStatus()
Gets the status which should be displayed for this bot. This might not be the status which is really displayed in the client, but it's the status which Javacord is trying to set for your bot, so it might change in the client a few seconds afterwards.- Returns:
- The status which should be displayed for this bot.
-
updateActivity
void updateActivity(String name)
Updates the activity of this bot, represented as "Playing Half-Life 3" for example.- Parameters:
name- The name of the activity.
-
updateActivity
void updateActivity(ActivityType type, String name)
Updates the activity of this bot with any type.- Parameters:
type- The type of the activity.name- The name of the activity.
-
updateActivity
void updateActivity(String name, String streamingUrl)
Updates the activity of this bot with a streaming url, represented as "Streaming Half-Life 3" for example. The update might not be visible immediately as it's through the websocket and only a limited amount of activity status changes is allowed per minute.- Parameters:
name- The name of the activity.streamingUrl- The streaming url of the activity.
-
unsetActivity
void unsetActivity()
Unsets the activity of this bot.
-
getActivity
Optional<Activity> getActivity()
Gets the activity which should be displayed. This might not be the activity which is really displayed in the client, but it's the activity which Javacord is trying to set for your bot, so it might change in the client a few seconds afterwards.- Returns:
- The activity which should be displayed.
-
getYourself
User getYourself()
Gets a user of the connected account. This may be a bot user (for normal bots), or a regular user (for client-bots).- Returns:
- The user of the connected account.
-
getOwnerId
long getOwnerId()
Gets the id of the application's owner.- Returns:
- The id of the application's owner.
- Throws:
IllegalStateException- If the current account is notAccountType.BOT.
-
getOwner
default CompletableFuture<User> getOwner()
Gets the owner of the application.- Returns:
- The owner of the application.
- Throws:
IllegalStateException- If the current account is notAccountType.BOT.
-
getClientId
long getClientId()
Gets the client id of the application.- Returns:
- The client id of the application.
- Throws:
IllegalStateException- If the current account is notAccountType.BOT.
-
disconnect
void disconnect()
Disconnects the bot. After disconnecting you should NOT use this instance again.
-
setReconnectDelay
void setReconnectDelay(Function<Integer,Integer> reconnectDelayProvider)
Sets a function which is used to get the delay between reconnects.- Parameters:
reconnectDelayProvider- A function which get's the amount of reconnects (starting with1) as the parameter and should return the delay in seconds to wait for the next reconnect attempt. By default the function reconnect delay is calculated using the following equation:f(x): (x^1.5-(1/(1/(0.1*x)+1))*x^1.5)+(currentShard*6). This would result in a delay which looks like this for a bot with 1 shard:
Too many reconnect attempts may cause a token reset (usually 1000 per day), so you should always make sure to not provide a function which might exceed this limit. You should also make sure to take into account the amount of shards!Attempt Delay 1 1 2 2 3 4 4 6 5 7 ... ... 10 16 15 23 20 30 ... ... 50 59 100 91 150 115 ... ...
-
getReconnectDelay
int getReconnectDelay(int attempt)
Gets the reconnect delay for a given amount of attempts.- Parameters:
attempt- The amount of attempts (starting with1)- Returns:
- The reconnect delay in seconds.
-
getApplicationInfo
CompletableFuture<ApplicationInfo> getApplicationInfo()
Gets the application info of the bot. The method only works for bot accounts.- Returns:
- The application info of the bot.
-
getWebhookById
CompletableFuture<Webhook> getWebhookById(long id)
Gets a webhook by its id.- Parameters:
id- The id of the webhook.- Returns:
- The webhook with the given id.
-
getUnavailableServers
Collection<Long> getUnavailableServers()
Gets a collection with the ids of all unavailable servers.- Returns:
- A collection with the ids of all unavailable servers.
-
getInviteByCode
CompletableFuture<Invite> getInviteByCode(String code)
Gets an invite by its code.- Parameters:
code- The code of the invite.- Returns:
- The invite with the given code.
-
getInviteWithMemberCountsByCode
CompletableFuture<Invite> getInviteWithMemberCountsByCode(String code)
Gets an invite by its code while requesting additional information.- Parameters:
code- The code of the invite.- Returns:
- The invite with the given code.
-
createServerBuilder
default ServerBuilder createServerBuilder()
Creates a server builder which can be used to create servers.- Returns:
- A server builder.
-
createAccountUpdater
default AccountUpdater createAccountUpdater()
Creates an account updater for the current account.- Returns:
- An account updater for the current account.
-
updateUsername
default CompletableFuture<Void> updateUsername(String username)
Updates the username of the current account.If you want to update several settings at once, it's recommended to use the
AccountUpdaterfromcreateAccountUpdater()()} which provides a better performance!- Parameters:
username- The new username.- Returns:
- A future to check if the update was successful.
-
updateAvatar
default CompletableFuture<Void> updateAvatar(BufferedImage avatar)
Updates the avatar of the current account. This method assumes the file type is "png"!If you want to update several settings at once, it's recommended to use the
AccountUpdaterfromcreateAccountUpdater()()} which provides a better performance!- Parameters:
avatar- The new avatar.- Returns:
- A future to check if the update was successful.
-
updateAvatar
default CompletableFuture<Void> updateAvatar(BufferedImage avatar, String fileType)
Updates the avatar of the current account.If you want to update several settings at once, it's recommended to use the
AccountUpdaterfromcreateAccountUpdater()()} which provides a better performance!- Parameters:
avatar- The new avatar.fileType- The type of the avatar, e.g. "png" or "jpg".- Returns:
- A future to check if the update was successful.
-
updateAvatar
default CompletableFuture<Void> updateAvatar(File avatar)
Updates the avatar of the current account.If you want to update several settings at once, it's recommended to use the
AccountUpdaterfromcreateAccountUpdater()()} which provides a better performance!- Parameters:
avatar- The new avatar.- Returns:
- A future to check if the update was successful.
-
updateAvatar
default CompletableFuture<Void> updateAvatar(Icon avatar)
Updates the avatar of the current account.If you want to update several settings at once, it's recommended to use the
AccountUpdaterfromcreateAccountUpdater()()} which provides a better performance!- Parameters:
avatar- The new avatar.- Returns:
- A future to check if the update was successful.
-
updateAvatar
default CompletableFuture<Void> updateAvatar(URL avatar)
Updates the avatar of the current account.If you want to update several settings at once, it's recommended to use the
AccountUpdaterfromcreateAccountUpdater()()} which provides a better performance!- Parameters:
avatar- The new avatar.- Returns:
- A future to check if the update was successful.
-
updateAvatar
default CompletableFuture<Void> updateAvatar(byte[] avatar)
Updates the avatar of the current account. This method assumes the file type is "png"!If you want to update several settings at once, it's recommended to use the
AccountUpdaterfromcreateAccountUpdater()()} which provides a better performance!- Parameters:
avatar- The new avatar.- Returns:
- A future to check if the update was successful.
-
updateAvatar
default CompletableFuture<Void> updateAvatar(byte[] avatar, String fileType)
Updates the avatar of the current account.If you want to update several settings at once, it's recommended to use the
AccountUpdaterfromcreateAccountUpdater()()} which provides a better performance!- Parameters:
avatar- The new avatar.fileType- The type of the avatar, e.g. "png" or "jpg".- Returns:
- A future to check if the update was successful.
-
updateAvatar
default CompletableFuture<Void> updateAvatar(InputStream avatar)
Updates the avatar of the current account. This method assumes the file type is "png"!If you want to update several settings at once, it's recommended to use the
AccountUpdaterfromcreateAccountUpdater()()} which provides a better performance!- Parameters:
avatar- The new avatar.- Returns:
- A future to check if the update was successful.
-
updateAvatar
default CompletableFuture<Void> updateAvatar(InputStream avatar, String fileType)
Updates the avatar of the current account.If you want to update several settings at once, it's recommended to use the
AccountUpdaterfromcreateAccountUpdater()()} which provides a better performance!- Parameters:
avatar- The new avatar.fileType- The type of the avatar, e.g. "png" or "jpg".- Returns:
- A future to check if the update was successful.
-
getCachedUsers
Collection<User> getCachedUsers()
Gets a collection with all currently cached users.- Returns:
- A collection with all currently cached users.
-
getCachedUserById
Optional<User> getCachedUserById(long id)
Gets a cached user by its id.- Parameters:
id- The id of the user.- Returns:
- The user with the given id.
-
getCachedUserById
default Optional<User> getCachedUserById(String id)
Gets a cached user by its id.- Parameters:
id- The id of the user.- Returns:
- The user with the given id.
-
getUserById
CompletableFuture<User> getUserById(long id)
Gets a user by its id.- Parameters:
id- The id of the user.- Returns:
- The user with the given id.
-
getUserById
default CompletableFuture<User> getUserById(String id)
Gets a user by its id.- Parameters:
id- The id of the user.- Returns:
- The user with the given id.
-
getCachedUserByDiscriminatedName
default Optional<User> getCachedUserByDiscriminatedName(String discriminatedName)
Gets a user by its discriminated name like e. g.Bastian#8222. This method is case sensitive!- Parameters:
discriminatedName- The discriminated name of the user.- Returns:
- The user with the given discriminated name.
-
getCachedUserByDiscriminatedNameIgnoreCase
default Optional<User> getCachedUserByDiscriminatedNameIgnoreCase(String discriminatedName)
Gets a user by its discriminated name like e. g.Bastian#8222. This method is case insensitive!- Parameters:
discriminatedName- The discriminated name of the user.- Returns:
- The user with the given discriminated name.
-
getCachedUserByNameAndDiscriminator
default Optional<User> getCachedUserByNameAndDiscriminator(String name, String discriminator)
Gets a user by its name and discriminator. This method is case sensitive!- Parameters:
name- The name of the user.discriminator- The discriminator of the user.- Returns:
- The user with the given name and discriminator.
-
getCachedUserByNameAndDiscriminatorIgnoreCase
default Optional<User> getCachedUserByNameAndDiscriminatorIgnoreCase(String name, String discriminator)
Gets a user by its name and discriminator. This method is case insensitive!- Parameters:
name- The name of the user.discriminator- The discriminator of the user.- Returns:
- The user with the given name and discriminator.
-
getCachedUsersByName
default Collection<User> getCachedUsersByName(String name)
Gets a collection with all users with the given name. This method is case sensitive!- Parameters:
name- The name of the users.- Returns:
- A collection with all users with the given name.
-
getCachedUsersByNameIgnoreCase
default Collection<User> getCachedUsersByNameIgnoreCase(String name)
Gets a collection with all users with the given name. This method is case insensitive!- Parameters:
name- The name of the users.- Returns:
- A collection with all users with the given name.
-
getCachedUsersByNickname
default Collection<User> getCachedUsersByNickname(String nickname, Server server)
Gets a collection with all users with the given nickname on the given server. This method is case sensitive!- Parameters:
nickname- The nickname of the users.server- The server where to lookup the nickname.- Returns:
- A collection with all users with the given nickname on the given server.
-
getCachedUsersByNicknameIgnoreCase
default Collection<User> getCachedUsersByNicknameIgnoreCase(String nickname, Server server)
Gets a collection with all users with the given nickname on the given server. This method is case insensitive!- Parameters:
nickname- The nickname of the users.server- The server where to lookup the nickname.- Returns:
- A collection with all users with the given nickname on the given server.
-
getCachedUsersByDisplayName
default Collection<User> getCachedUsersByDisplayName(String displayName, Server server)
Gets a collection with all users with the given display name on the given server. This method is case sensitive!- Parameters:
displayName- The display name of the users.server- The server where to lookup the display name.- Returns:
- A collection with all users with the given display name on the given server.
-
getCachedUsersByDisplayNameIgnoreCase
default Collection<User> getCachedUsersByDisplayNameIgnoreCase(String displayName, Server server)
Gets a collection with all users with the given display name on the given server. This method is case insensitive!- Parameters:
displayName- The display name of the users.server- The server where to lookup the display name.- Returns:
- A collection with all users with the given display name on the given server.
-
getCachedMessages
MessageSet getCachedMessages()
Gets a message set with all currently cached messages.- Returns:
- A message set with all currently cached messages.
-
getCachedMessageById
Optional<Message> getCachedMessageById(long id)
Gets a cached message by its id.- Parameters:
id- The id of the message.- Returns:
- The cached message.
-
getCachedMessageById
default Optional<Message> getCachedMessageById(String id)
Gets a cached message by its id.- Parameters:
id- The id of the message.- Returns:
- The cached message.
-
getMessageById
default CompletableFuture<Message> getMessageById(long id, TextChannel channel)
Gets a message by its id.- Parameters:
id- The id of the message.channel- The channel of the message.- Returns:
- The message with the given id.
- See Also:
TextChannel.getMessageById(long)
-
getMessageById
default CompletableFuture<Message> getMessageById(String id, TextChannel channel)
Gets a message by its id.- Parameters:
id- The id of the message.channel- The channel of the message.- Returns:
- The message with the given id.
- See Also:
TextChannel.getMessageById(String)
-
getServers
Collection<Server> getServers()
Gets a collection with all servers the bot is in.- Returns:
- A collection with all servers the bot is in.
-
getServerById
default Optional<Server> getServerById(long id)
Gets a server by its id.- Parameters:
id- The id of the server.- Returns:
- The server with the given id.
-
getServerById
default Optional<Server> getServerById(String id)
Gets a server by its id.- Parameters:
id- The id of the server.- Returns:
- The server with the given id.
-
getServersByName
default Collection<Server> getServersByName(String name)
Gets a collection with all servers with the given name. This method is case sensitive!- Parameters:
name- The name of the servers.- Returns:
- A collection with all servers with the given name.
-
getServersByNameIgnoreCase
default Collection<Server> getServersByNameIgnoreCase(String name)
Gets a collection with all servers with the given name. This method is case insensitive!- Parameters:
name- The name of the servers.- Returns:
- A collection with all servers with the given name.
-
getCustomEmojis
Collection<KnownCustomEmoji> getCustomEmojis()
Gets a collection with all known custom emojis.- Returns:
- A collection with all known custom emojis.
-
getCustomEmojiById
default Optional<KnownCustomEmoji> getCustomEmojiById(long id)
Gets a custom emoji in this server by its id.- Parameters:
id- The id of the emoji.- Returns:
- The emoji with the given id.
-
getCustomEmojiById
default Optional<KnownCustomEmoji> getCustomEmojiById(String id)
Gets a custom emoji in this server by its id.- Parameters:
id- The id of the emoji.- Returns:
- The emoji with the given id.
-
getCustomEmojisByName
default Collection<KnownCustomEmoji> getCustomEmojisByName(String name)
Gets a collection with all custom emojis with the given name in the server. This method is case sensitive!- Parameters:
name- The name of the custom emojis.- Returns:
- A collection with all custom emojis with the given name in this server.
-
getCustomEmojisByNameIgnoreCase
default Collection<KnownCustomEmoji> getCustomEmojisByNameIgnoreCase(String name)
Gets a collection with all custom emojis with the given name in the server. This method is case insensitive!- Parameters:
name- The name of the custom emojis.- Returns:
- A collection with all custom emojis with the given name in this server.
-
getRoles
default Collection<Role> getRoles()
Gets a collection with all roles the bot knows.- Returns:
- A collection with all roles the bot knows.
-
getRoleById
default Optional<Role> getRoleById(long id)
Gets a role by its id.- Parameters:
id- The id of the role.- Returns:
- The role with the given id.
-
getRoleById
default Optional<Role> getRoleById(String id)
Gets a role by its id.- Parameters:
id- The id of the role.- Returns:
- The role with the given id.
-
getRolesByName
default Collection<Role> getRolesByName(String name)
Gets a collection with all roles with the given name. This method is case sensitive!- Parameters:
name- The name of the roles.- Returns:
- A collection with all roles with the given name.
-
getRolesByNameIgnoreCase
default Collection<Role> getRolesByNameIgnoreCase(String name)
Gets a collection with all roles with the given name. This method is case insensitive!- Parameters:
name- The name of the roles.- Returns:
- A collection with all roles with the given name.
-
getChannels
default Collection<Channel> getChannels()
Gets a collection with all channels of the bot.- Returns:
- A collection with all channels of the bot.
-
getGroupChannels
Collection<GroupChannel> getGroupChannels()
Gets a collection with all group channels of the bot.- Returns:
- A collection with all group channels of the bot.
-
getPrivateChannels
default Collection<PrivateChannel> getPrivateChannels()
Gets a collection with all private channels of the bot.- Returns:
- A collection with all private channels of the bot.
-
getServerChannels
default Collection<ServerChannel> getServerChannels()
Gets a collection with all server channels of the bot.- Returns:
- A collection with all server channels of the bot.
-
getChannelCategories
default Collection<ChannelCategory> getChannelCategories()
Gets a collection with all channel categories of the bot.- Returns:
- A collection with all channel categories of the bot.
-
getServerTextChannels
default Collection<ServerTextChannel> getServerTextChannels()
Gets a collection with all server text channels of the bot.- Returns:
- A collection with all server text channels of the bot.
-
getServerVoiceChannels
default Collection<ServerVoiceChannel> getServerVoiceChannels()
Gets a collection with all server voice channels of the bot.- Returns:
- A collection with all server voice channels of the bot.
-
getTextChannels
default Collection<TextChannel> getTextChannels()
Gets a collection with all text channels of the bot.- Returns:
- A collection with all text channels of the bot.
-
getVoiceChannels
default Collection<VoiceChannel> getVoiceChannels()
Gets a collection with all voice channels of the bot.- Returns:
- A collection with all voice channels of the bot.
-
getChannelById
default Optional<Channel> getChannelById(long id)
Gets a channel by its id.- Parameters:
id- The id of the channel.- Returns:
- The channel with the given id.
-
getChannelById
default Optional<Channel> getChannelById(String id)
Gets a channel by its id.- Parameters:
id- The id of the channel.- Returns:
- The channel with the given id.
-
getChannelsByName
default Collection<Channel> getChannelsByName(String name)
Gets a collection with all channels with the given name. This method is case sensitive!- Parameters:
name- The name of the channels. Can benullto search for group channels without name.- Returns:
- A collection with all channels with the given name.
-
getChannelsByNameIgnoreCase
default Collection<Channel> getChannelsByNameIgnoreCase(String name)
Gets a collection with all channels with the given name. This method is case insensitive!- Parameters:
name- The name of the channels. Can benullto search for group channels without name.- Returns:
- A collection with all channels with the given name.
-
getTextChannelById
default Optional<TextChannel> getTextChannelById(long id)
Gets a text channel by its id.- Parameters:
id- The id of the text channel.- Returns:
- The text channel with the given id.
-
getTextChannelById
default Optional<TextChannel> getTextChannelById(String id)
Gets a text channel by its id.- Parameters:
id- The id of the text channel.- Returns:
- The text channel with the given id.
-
getTextChannelsByName
default Collection<TextChannel> getTextChannelsByName(String name)
Gets a collection with all text channels with the given name. This method is case sensitive!- Parameters:
name- The name of the text channels. Can benullto search for group channels without name.- Returns:
- A collection with all text channels with the given name.
-
getTextChannelsByNameIgnoreCase
default Collection<TextChannel> getTextChannelsByNameIgnoreCase(String name)
Gets a collection with all text channels with the given name. This method is case insensitive!- Parameters:
name- The name of the text channels. Can benullto search for group channels without name.- Returns:
- A collection with all text channels with the given name.
-
getVoiceChannelById
default Optional<VoiceChannel> getVoiceChannelById(long id)
Gets a voice channel by its id.- Parameters:
id- The id of the voice channel.- Returns:
- The voice channel with the given id.
-
getVoiceChannelById
default Optional<VoiceChannel> getVoiceChannelById(String id)
Gets a voice channel by its id.- Parameters:
id- The id of the voice channel.- Returns:
- The voice channel with the given id.
-
getVoiceChannelsByName
default Collection<VoiceChannel> getVoiceChannelsByName(String name)
Gets a collection with all voice channels with the given name. This method is case sensitive!- Parameters:
name- The name of the voice channels. Can benullto search for group channels without name.- Returns:
- A collection with all voice channels with the given name.
-
getVoiceChannelsByNameIgnoreCase
default Collection<VoiceChannel> getVoiceChannelsByNameIgnoreCase(String name)
Gets a collection with all voice channels with the given name. This method is case insensitive!- Parameters:
name- The name of the voice channels. Can benullto search for group channels without name.- Returns:
- A collection with all voice channels with the given name.
-
getServerChannelById
default Optional<ServerChannel> getServerChannelById(long id)
Gets a server channel by its id.- Parameters:
id- The id of the server channel.- Returns:
- The server channel with the given id.
-
getServerChannelById
default Optional<ServerChannel> getServerChannelById(String id)
Gets a server channel by its id.- Parameters:
id- The id of the server channel.- Returns:
- The server channel with the given id.
-
getServerChannelsByName
default Collection<ServerChannel> getServerChannelsByName(String name)
Gets a collection with all server channels with the given name. This method is case sensitive!- Parameters:
name- The name of the server channels.- Returns:
- A collection with all server channels with the given name.
-
getServerChannelsByNameIgnoreCase
default Collection<ServerChannel> getServerChannelsByNameIgnoreCase(String name)
Gets a collection with all server channels with the given name. This method is case insensitive!- Parameters:
name- The name of the server channels.- Returns:
- A collection with all server channels with the given name.
-
getChannelCategoryById
default Optional<ChannelCategory> getChannelCategoryById(long id)
Gets a channel category by its id.- Parameters:
id- The id of the channel category.- Returns:
- The channel category with the given id.
-
getChannelCategoryById
default Optional<ChannelCategory> getChannelCategoryById(String id)
Gets a channel category by its id.- Parameters:
id- The id of the channel category.- Returns:
- The channel category with the given id.
-
getChannelCategoriesByName
default Collection<ChannelCategory> getChannelCategoriesByName(String name)
Gets a collection with all channel categories with the given name. This method is case sensitive!- Parameters:
name- The name of the channel categories.- Returns:
- A collection with all channel categories with the given name.
-
getChannelCategoriesByNameIgnoreCase
default Collection<ChannelCategory> getChannelCategoriesByNameIgnoreCase(String name)
Gets a collection with all channel categories with the given name. This method is case insensitive!- Parameters:
name- The name of the channel categories.- Returns:
- A collection with all channel categories with the given name.
-
getServerTextChannelById
default Optional<ServerTextChannel> getServerTextChannelById(long id)
Gets a server text channel by its id.- Parameters:
id- The id of the server text channel.- Returns:
- The server text channel with the given id.
-
getServerTextChannelById
default Optional<ServerTextChannel> getServerTextChannelById(String id)
Gets a server text channel by its id.- Parameters:
id- The id of the server text channel.- Returns:
- The server text channel with the given id.
-
getServerTextChannelsByName
default Collection<ServerTextChannel> getServerTextChannelsByName(String name)
Gets a collection with all server text channels with the given name. This method is case sensitive!- Parameters:
name- The name of the server text channels.- Returns:
- A collection with all server text channels with the given name.
-
getServerTextChannelsByNameIgnoreCase
default Collection<ServerTextChannel> getServerTextChannelsByNameIgnoreCase(String name)
Gets a collection with all server text channels with the given name. This method is case insensitive!- Parameters:
name- The name of the server text channels.- Returns:
- A collection with all server text channels with the given name.
-
getServerVoiceChannelById
default Optional<ServerVoiceChannel> getServerVoiceChannelById(long id)
Gets a server voice channel by its id.- Parameters:
id- The id of the server voice channel.- Returns:
- The server voice channel with the given id.
-
getServerVoiceChannelById
default Optional<ServerVoiceChannel> getServerVoiceChannelById(String id)
Gets a server voice channel by its id.- Parameters:
id- The id of the server voice channel.- Returns:
- The server voice channel with the given id.
-
getServerVoiceChannelsByName
default Collection<ServerVoiceChannel> getServerVoiceChannelsByName(String name)
Gets a collection with all server voice channels with the given name. This method is case sensitive!- Parameters:
name- The name of the server voice channels.- Returns:
- A collection with all server voice channels with the given name.
-
getServerVoiceChannelsByNameIgnoreCase
default Collection<ServerVoiceChannel> getServerVoiceChannelsByNameIgnoreCase(String name)
Gets a collection with all server voice channels with the given name. This method is case insensitive!- Parameters:
name- The name of the server voice channels.- Returns:
- A collection with all server voice channels with the given name.
-
getPrivateChannelById
default Optional<PrivateChannel> getPrivateChannelById(long id)
Gets a private channel by its id.- Parameters:
id- The id of the private channel.- Returns:
- The private channel with the given id.
-
getPrivateChannelById
default Optional<PrivateChannel> getPrivateChannelById(String id)
Gets a private channel by its id.- Parameters:
id- The id of the private channel.- Returns:
- The private channel with the given id.
-
getGroupChannelById
default Optional<GroupChannel> getGroupChannelById(long id)
Gets a group channel by its id.- Parameters:
id- The id of the group channel.- Returns:
- The group channel with the given id.
-
getGroupChannelById
default Optional<GroupChannel> getGroupChannelById(String id)
Gets a group channel by its id.- Parameters:
id- The id of the group channel.- Returns:
- The group channel with the given id.
-
getGroupChannelsByName
default Collection<GroupChannel> getGroupChannelsByName(String name)
Gets a collection with all group channels with the given name. This method is case sensitive!- Parameters:
name- The name of the group channels. Can benullto search for group channels without name.- Returns:
- A collection with all group channels with the given name.
-
getGroupChannelsByNameIgnoreCase
default Collection<GroupChannel> getGroupChannelsByNameIgnoreCase(String name)
Gets a collection with all server channels with the given name. This method is case insensitive!- Parameters:
name- The name of the group channels. Can benullto search for group channels without name.- Returns:
- A collection with all group channels with the given name.
-
-