Package discord4j.core
Class DiscordClientBuilder<C,O extends RouterOptions>
- java.lang.Object
-
- discord4j.rest.RestClientBuilder<C,O>
-
- discord4j.core.DiscordClientBuilder<C,O>
-
public final class DiscordClientBuilder<C,O extends RouterOptions> extends RestClientBuilder<C,O>
Builder suited for creating aDiscordClient. To acquire an instance, seecreate(String).
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class discord4j.rest.RestClientBuilder
RestClientBuilder.Config
-
-
Field Summary
-
Fields inherited from class discord4j.rest.RestClientBuilder
allowedMentions, clientFactory, exchangeStrategies, globalRateLimiter, jacksonResources, optionsModifier, reactorResources, requestQueueFactory, responseTransformers, token
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description Cbuild()Create a client capable of connecting to Discord REST API and to establish Gateway and Voice Gateway connections, using aDefaultRouterthat is capable of working in monolithic environments.Cbuild(Function<O,Router> routerFactory)Create a client capable of connecting to Discord REST API and to establish Gateway and Voice Gateway connections, using a customRouterfactory.static DiscordClientBuilder<DiscordClient,RouterOptions>create(String token)Initialize a new builder with the given token.-
Methods inherited from class discord4j.rest.RestClientBuilder
createRest, onClientResponse, setDefaultAllowedMentions, setExchangeStrategies, setExtraOptions, setGlobalRateLimiter, setJacksonResources, setReactorResources, setRequestQueueFactory, setToken
-
-
-
-
Method Detail
-
create
public static DiscordClientBuilder<DiscordClient,RouterOptions> create(String token)
Initialize a new builder with the given token.- Parameters:
token- the bot token used to authenticate to Discord
-
build
public C build()
Create a client capable of connecting to Discord REST API and to establish Gateway and Voice Gateway connections, using aDefaultRouterthat is capable of working in monolithic environments.- Overrides:
buildin classRestClientBuilder<C,O extends RouterOptions>- Returns:
- a configured
DiscordClientbased on this builder parameters
-
build
public C build(Function<O,Router> routerFactory)
Create a client capable of connecting to Discord REST API and to establish Gateway and Voice Gateway connections, using a customRouterfactory. The resultingDiscordClientwill use the producedRouterfor every request.- Overrides:
buildin classRestClientBuilder<C,O extends RouterOptions>- Parameters:
routerFactory- the factory ofRouterimplementation- Returns:
- a configured
DiscordClientbased on this builder parameters
-
-