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.
-
-
Field Summary
Fields Modifier and Type Field Description static PatternESCAPED_CHARACTER
-
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.default Optional<Message>getCachedMessageByLink(String link)Gets a cached message by its link.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.Optional<Channel>getChannelById(long id)Gets a channel by its id.default Optional<Channel>getChannelById(String id)Gets a channel by its id.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.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.RatelimitergetGatewayIdentifyRatelimiter()Gets the current gateway identify ratelimiter.Optional<Ratelimiter>getGlobalRatelimiter()Gets the current global ratelimiter.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.default CompletableFuture<IncomingWebhook>getIncomingWebhookByIdAndToken(long id, String token)Gets an incoming webhook by its id and its token.CompletableFuture<IncomingWebhook>getIncomingWebhookByIdAndToken(String id, String token)Gets an incoming webhook by its id and its token.default CompletableFuture<IncomingWebhook>getIncomingWebhookByUrl(String url)Gets a webhook by its url.Set<Intent>getIntents()Gets the intents used to receive some or all events specified inIntent.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.DurationgetLatestGatewayLatency()Gets the latest gateway latency.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 Optional<CompletableFuture<Message>>getMessageByLink(String link)Gets a message by its link.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.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.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<ServerStageVoiceChannel>getServerStageVoiceChannelById(long id)Gets a server stage voice channel by its id.default Optional<ServerStageVoiceChannel>getServerStageVoiceChannelById(String id)Gets a server stage voice channel by its id.Collection<ServerStageVoiceChannel>getServerStageVoiceChannels()Gets a collection with all server stage voice channels of the bot.default Collection<ServerStageVoiceChannel>getServerStageVoiceChannelsByName(String name)Gets a collection with all server stage voice channels with the given name.default Collection<ServerStageVoiceChannel>getServerStageVoiceChannelsByNameIgnoreCase(String name)Gets a collection with all server stage voice channels 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.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.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.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.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.default booleanhasAllUsersInCache()Checks if all users of available servers are in the cache.booleanisDefaultAutomaticMessageCacheCleanupEnabled()Gets whether automatic message cache cleanup is enabled.booleanisUserCacheEnabled()Checks if the user cache is enabled.booleanisWaitingForServersOnStartup()Checks if Javacord is waiting for all servers to become available on startup.booleanisWaitingForUsersOnStartup()Checks if Javacord is waiting for all servers to get cached on startup.default StringmakeMentionsReadable(String content)Gets the readable content of the string, which replaces all mentions etc.default StringmakeMentionsReadable(String content, Server server)Gets the readable content of the string, which replaces all mentions etc.CompletableFuture<Duration>measureRestLatency()Measures, how long Javacord will need to perform a single REST call.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
addAudioSourceFinishedListener, 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, addServerChangeBoostCountListener, addServerChangeBoostLevelListener, addServerChangeDefaultMessageNotificationLevelListener, addServerChangeDescriptionListener, addServerChangeDiscoverySplashListener, addServerChangeExplicitContentFilterLevelListener, addServerChangeIconListener, addServerChangeModeratorsOnlyChannelListener, addServerChangeMultiFactorAuthenticationLevelListener, addServerChangeNameListener, addServerChangeOwnerListener, addServerChangePreferredLocaleListener, addServerChangeRegionListener, addServerChangeRulesChannelListener, addServerChangeServerFeatureListener, addServerChangeSplashListener, addServerChangeSystemChannelListener, addServerChangeVanityUrlCodeListener, addServerChangeVerificationLevelListener, addServerChannelChangeNameListener, addServerChannelChangeNsfwFlagListener, addServerChannelChangeOverwrittenPermissionsListener, addServerChannelChangePositionListener, addServerChannelCreateListener, addServerChannelDeleteListener, addServerChannelInviteCreateListener, addServerChannelInviteDeleteListener, addServerJoinListener, addServerLeaveListener, addServerMemberBanListener, addServerMemberJoinListener, addServerMemberLeaveListener, addServerMemberUnbanListener, addServerStageVoiceChannelChangeTopicListener, addServerTextChannelChangeSlowmodeListener, addServerTextChannelChangeTopicListener, addServerVoiceChannelChangeBitrateListener, addServerVoiceChannelChangeUserLimitListener, addServerVoiceChannelMemberJoinListener, addServerVoiceChannelMemberLeaveListener, addUserChangeActivityListener, addUserChangeAvatarListener, addUserChangeDeafenedListener, addUserChangeDiscriminatorListener, addUserChangeMutedListener, addUserChangeNameListener, addUserChangeNicknameListener, addUserChangeSelfDeafenedListener, addUserChangeSelfMutedListener, addUserChangeStatusListener, addUserRoleAddListener, addUserRoleRemoveListener, addUserStartTypingListener, addVoiceServerUpdateListener, addVoiceStateUpdateListener, addWebhooksUpdateListener, getAudioSourceFinishedListeners, 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, getServerChangeBoostCountListeners, getServerChangeBoostLevelListeners, getServerChangeDefaultMessageNotificationLevelListeners, getServerChangeDescriptionListeners, getServerChangeDiscoverySplashListeners, getServerChangeExplicitContentFilterLevelListeners, getServerChangeIconListeners, getServerChangeModeratorsOnlyChannelListeners, getServerChangeMultiFactorAuthenticationLevelListeners, getServerChangeNameListeners, getServerChangeOwnerListeners, getServerChangePreferredLocaleListeners, getServerChangeRegionListeners, getServerChangeRulesChannelListeners, getServerChangeServerFeatureListeners, getServerChangeSplashListeners, getServerChangeSystemChannelListeners, getServerChangeVanityUrlCodeListeners, getServerChangeVerificationLevelListeners, getServerChannelChangeNameListeners, getServerChannelChangeNsfwFlagListeners, getServerChannelChangeOverwrittenPermissionsListeners, getServerChannelChangePositionListeners, getServerChannelCreateListeners, getServerChannelDeleteListeners, getServerChannelInviteCreateListeners, getServerChannelInviteDeleteListeners, getServerJoinListeners, getServerLeaveListeners, getServerMemberBanListeners, getServerMemberJoinListeners, getServerMemberLeaveListeners, getServerMemberUnbanListeners, getServerStageVoiceChannelChangeTopicListeners, getServerTextChannelChangeSlowmodeListeners, getServerTextChannelChangeTopicListeners, getServerVoiceChannelChangeBitrateListeners, getServerVoiceChannelChangeUserLimitListeners, getServerVoiceChannelMemberJoinListeners, getServerVoiceChannelMemberLeaveListeners, getUserChangeActivityListeners, getUserChangeAvatarListeners, getUserChangeDeafenedListeners, getUserChangeDiscriminatorListeners, getUserChangeMutedListeners, getUserChangeNameListeners, getUserChangeNicknameListeners, getUserChangeSelfDeafenedListeners, getUserChangeSelfMutedListeners, getUserChangeStatusListeners, getUserRoleAddListeners, getUserRoleRemoveListeners, getUserStartTypingListeners, getVoiceServerUpdateListeners, getVoiceStateUpdateListeners, getWebhooksUpdateListeners, removeListener, removeListener
-
-
-
-
Field Detail
-
ESCAPED_CHARACTER
static final Pattern ESCAPED_CHARACTER
-
-
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.
-
getIntents
Set<Intent> getIntents()
Gets the intents used to receive some or all events specified inIntent.- Returns:
- The intents for the events.
-
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.
-
getGlobalRatelimiter
Optional<Ratelimiter> getGlobalRatelimiter()
Gets the current global ratelimiter.**Note:** This method returns an
Optionalfor historic reasons. If you did not provide a ratelimiter by yourself, this method will return aLocalRatelimiterwhich is set to request per111.1 ms. This ratelimiter is shared by every bot with the same token in the same Java program.- Returns:
- The current global ratelimiter.
-
getGatewayIdentifyRatelimiter
Ratelimiter getGatewayIdentifyRatelimiter()
Gets the current gateway identify ratelimiter.If you did not provide a ratelimiter yourself, this method will return a
LocalRatelimiterwhich is set to allow one gateway identify request per 5500ms and is shared with every bot with the same token in the same Java program.- Returns:
- The current gateway identify ratelimiter.
-
getLatestGatewayLatency
Duration getLatestGatewayLatency()
Gets the latest gateway latency.To calculate the gateway latency, Javacord measures the time it takes for Discord to answer the gateway heartbeat packet with a heartbeat ack packet. Please notice, that this values does only get updated on every heartbeat and not on every method call. To calculate an average, you have to collect the latency over a period of multiple minutes.
In very rare cases, the latency will be
-1 nsdirectly after startup, because the initial heartbeat was not answered yet. Usually, the heartbeat is answered before the bot finished loading.Expected latency: Usually, you can expect a latency between
30 msand300 mswith a good internet connection. This value may vary, depending on your location, time of day, Discord's status, and the current workload of your system. A value above1000 msis usually an indicator that something is wrong.- Returns:
- The latest measured gateway latency.
-
measureRestLatency
CompletableFuture<Duration> measureRestLatency()
Measures, how long Javacord will need to perform a single REST call.This method does not measure the "true" latency to Discord's REST endpoints because the request is handled by Javacord like any other request, including rate-limit handling. This causes some small delays that negatively affects the latency. However, this provides a somewhat realistic measurement on how long a typical REST call of Javacord will need. The latency is influenced by many non-network related factors like your system's current workload.
This method uses the
GET /users/@meendpoint to test the latency. The method ensures that only one ping measurement is performed at once by the sameDiscordApiinstance.Warning: This method does not bypass the global ratelimit check. If your bot gets ratelimited globally, the latency will appear higher that it really is!
Expected latency: Usually, you can expect a latency between
50 msand500 mswith a good internet connection. This value may vary, depending on your location, time of day, Discord's status, and the current workload of your system. A value above1000 msis usually an indicator that something is wrong. It is recommended to perform multiple tests and calculate an average value.- Returns:
- The measured latency.
-
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.
-
isWaitingForUsersOnStartup
boolean isWaitingForUsersOnStartup()
Checks if Javacord is waiting for all servers to get cached on startup.- Returns:
- Whether Javacord is waiting for all users to get cached 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.
-
getIncomingWebhookByIdAndToken
CompletableFuture<IncomingWebhook> getIncomingWebhookByIdAndToken(String id, String token)
Gets an incoming webhook by its id and its token.- Parameters:
id- The id of the incoming webhook.token- The token of the incoming webhook.- Returns:
- The incoming webhook with the given id.
-
getIncomingWebhookByIdAndToken
default CompletableFuture<IncomingWebhook> getIncomingWebhookByIdAndToken(long id, String token)
Gets an incoming webhook by its id and its token.- Parameters:
id- The id of the incoming webhook.token- The token of the incoming webhook.- Returns:
- The incoming webhook with the given id.
-
getIncomingWebhookByUrl
default CompletableFuture<IncomingWebhook> getIncomingWebhookByUrl(String url) throws IllegalArgumentException
Gets a webhook by its url.- Parameters:
url- The url of the message.- Returns:
- The incoming webhook with the given url.
- Throws:
IllegalArgumentException- If the link isn't valid.
-
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.
-
isUserCacheEnabled
boolean isUserCacheEnabled()
Checks if the user cache is enabled.- Returns:
- Whether or not the user cache is enabled;
-
hasAllUsersInCache
default boolean hasAllUsersInCache()
Checks if all users of available servers are in the cache.- Returns:
- Whether or not all users of available servers are in the cache.
-
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.
-
makeMentionsReadable
default String makeMentionsReadable(String content, Server server)
Gets the readable content of the string, which replaces all mentions etc. with the actual name. The replacement happens as following:- User mentions:
@nicknameif the user has a nickname,@nameif the user has no nickname, unchanged if the user is not in the cache. - Role mentions:
@nameif the role exists in the server, otherwise#deleted-role - Channel mentions:
#nameif the text channel exists in the server, otherwise#deleted-channel - Custom emoji:
:name:. If the emoji is known, the real name is used, otherwise the name from the mention tag.
- Parameters:
content- The string to strip the mentions away.server- The server to get the display name of users from.- Returns:
- The readable content of the string.
- User mentions:
-
makeMentionsReadable
default String makeMentionsReadable(String content)
Gets the readable content of the string, which replaces all mentions etc. with the actual name. The replacement happens as following:- User mentions:
@nicknameif the user has a nickname,@nameif the user has no nickname, unchanged if the user is not in the cache. - Role mentions:
@nameif the role exists in the server, otherwise#deleted-role - Channel mentions:
#nameif the text channel exists in the server, otherwise#deleted-channel - Custom emoji:
:name:. If the emoji is known, the real name is used, otherwise the name from the mention tag.
- Parameters:
content- The string to strip the mentions away.- Returns:
- The readable content of the string.
- User mentions:
-
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)
-
getMessageByLink
default Optional<CompletableFuture<Message>> getMessageByLink(String link) throws IllegalArgumentException
Gets a message by its link.- Parameters:
link- The link of the message.- Returns:
- The message with the given link.
- Throws:
IllegalArgumentException- If the link isn't valid.
-
getCachedMessageByLink
default Optional<Message> getCachedMessageByLink(String link) throws IllegalArgumentException
Gets a cached message by its link.- Parameters:
link- The link of the message.- Returns:
- The cached message with the given link.
- Throws:
IllegalArgumentException- If the link isn't valid.
-
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
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
Collection<PrivateChannel> getPrivateChannels()
Gets a collection with all private channels of the bot.- Returns:
- A collection with all private channels of the bot.
-
getServerChannels
Collection<ServerChannel> getServerChannels()
Gets a collection with all server channels of the bot.- Returns:
- A collection with all server channels of the bot.
-
getChannelCategories
Collection<ChannelCategory> getChannelCategories()
Gets a collection with all channel categories of the bot.- Returns:
- A collection with all channel categories of the bot.
-
getServerTextChannels
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
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.
-
getServerStageVoiceChannels
Collection<ServerStageVoiceChannel> getServerStageVoiceChannels()
Gets a collection with all server stage voice channels of the bot.- Returns:
- A collection with all server stage voice channels of the bot.
-
getTextChannels
Collection<TextChannel> getTextChannels()
Gets a collection with all text channels of the bot.- Returns:
- A collection with all text channels of the bot.
-
getVoiceChannels
Collection<VoiceChannel> getVoiceChannels()
Gets a collection with all voice channels of the bot.- Returns:
- A collection with all voice channels of the bot.
-
getChannelById
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.
-
getServerStageVoiceChannelById
default Optional<ServerStageVoiceChannel> getServerStageVoiceChannelById(long id)
Gets a server stage voice channel by its id.- Parameters:
id- The id of the server stage voice channel.- Returns:
- The server stage voice channel with the given id.
-
getServerStageVoiceChannelById
default Optional<ServerStageVoiceChannel> getServerStageVoiceChannelById(String id)
Gets a server stage voice channel by its id.- Parameters:
id- The id of the server stage voice channel.- Returns:
- The server stage voice channel with the given id.
-
getServerStageVoiceChannelsByName
default Collection<ServerStageVoiceChannel> getServerStageVoiceChannelsByName(String name)
Gets a collection with all server stage voice channels with the given name. This method is case sensitive!- Parameters:
name- The name of the server stage voice channels.- Returns:
- A collection with all server stage voice channels with the given name.
-
getServerStageVoiceChannelsByNameIgnoreCase
default Collection<ServerStageVoiceChannel> getServerStageVoiceChannelsByNameIgnoreCase(String name)
Gets a collection with all server stage voice channels with the given name. This method is case insensitive!- Parameters:
name- The name of the server stage voice channels.- Returns:
- A collection with all server stage 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.
-
-