mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-12 01:23:31 +01:00
feat(ClientOptions): add support for setting an initial presence (#2320)
* docs/feat(WebsocketOptions): Parse ws options presence Allow the `presence` property in `WebsocketOptions` to be used the same way as `ClientUser#setPresence`. * Move presence options to top level
This commit is contained in:
@@ -39,7 +39,10 @@ class ClientManager {
|
||||
this.client.emit(Events.DEBUG, `Authenticated using token ${token}`);
|
||||
this.client.token = token;
|
||||
const timeout = this.client.setTimeout(() => reject(new Error('WS_CONNECTION_TIMEOUT')), 1000 * 300);
|
||||
this.client.api.gateway.get().then(res => {
|
||||
this.client.api.gateway.get().then(async res => {
|
||||
if (this.client.options.presence != null) { // eslint-disable-line eqeqeq
|
||||
this.client.options.ws.presence = await this.client.presences._parse(this.client.options.presence);
|
||||
}
|
||||
const gateway = `${res.url}/`;
|
||||
this.client.emit(Events.DEBUG, `Using gateway ${gateway}`);
|
||||
this.client.ws.connect(gateway);
|
||||
|
||||
Reference in New Issue
Block a user