Use intent from connect function if it was set in both function and client setting

This commit is contained in:
Helloyunho 2020-12-05 16:18:45 +09:00
parent 9c67ff6c84
commit 8a0882cd4d
1 changed files with 7 additions and 2 deletions

View File

@ -140,9 +140,14 @@ export class Client extends EventEmitter {
else if (this.token === undefined && token !== undefined) {
this.token = token
} else throw new Error('No Token Provided')
if (intents === undefined && this.intents !== undefined)
if (intents !== undefined && this.intents !== undefined) {
this.debug(
'client',
'Intents were set in both client and connect function. Using the one in the connect function...'
)
} else if (intents === undefined && this.intents !== undefined) {
intents = this.intents
else if (intents !== undefined && this.intents === undefined) {
} else if (intents !== undefined && this.intents === undefined) {
this.intents = intents
} else throw new Error('No Gateway Intents were provided')
this.gateway = new Gateway(this, token, intents)