fix: identify bug

This commit is contained in:
Skillz
2023-02-28 13:42:33 -06:00
parent 25ac315230
commit f072d12311
5 changed files with 41 additions and 12 deletions

36
packages/client/README.md Normal file
View File

@@ -0,0 +1,36 @@
# @discordeno/client
This package is intended to provide a class based implementation on top of discordeno. It is based on Eris libraries API as it is just amazing! This also means since the API is near 1:1 the migration for Eris -> Discordeno is as simple as:
```ts
npm uninstall eris && npm install @discordeno/client
```
Then replace all `from 'eris';` with `from '@discordeno/client'` and enjoy!
## Credits
https://github.com/abalabahaha/eris
## Eris License
The MIT License (MIT)
Copyright (c) 2016-2021 abalabahaha
Permission is hereby granted, free of charge, to any person obtaining a copy of
this software and associated documentation files (the "Software"), to deal in
the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View File

@@ -258,7 +258,7 @@ export class Client extends EventEmitter {
/** The amount of times it has already tried to reconnect. */
reconnectAttempts: number = 0
/** The client user */
user?: ExtendedUser
user!: ExtendedUser
constructor(token: string, options: ClientOptions) {
super()

View File

@@ -37,7 +37,7 @@ export class RequestHandler {
{
// agent: client.options.agent || null,
agent: null,
baseURL: "https://discord.com/api",
baseURL: 'https://discord.com/api',
decodeReasons: true,
disableLatencyCompensation: false,
domain: 'discord.com',
@@ -82,14 +82,7 @@ export class RequestHandler {
*/
globalUnblock(): void {}
warnUser(): void {
// LOG IT ENOUGH TIMES TO MAKE USER SEE IT CLEARLY
for (let i = 0; i < 10; i++) {
console.warn(
'[WARNING] Using internal RestManager since no proxy rest manager was provided. THIS IS NOT RECOMMENDED. Please use a proxy rest manager. If you need help setting it up, join discord.gg/ddeno',
)
}
}
warnUser(): void {}
/**
* Make an API request

View File

@@ -95,7 +95,7 @@ export class Shard extends EventEmitter {
id: number
latency: number = 0
preReady = false
presence!: ClientPresence
presence: ClientPresence = { activities: [], afk: false, status: 'online', since: 0 }
presenceUpdateBucket!: Bucket
ready = false
reconnectInterval: number = 0

View File

@@ -115,7 +115,7 @@ export class ShardManager extends Collection<number, Shard> {
}
// connect the shard
shard.connect()
shard.identify()
this.buckets.set(rateLimitKey, Date.now())
// remove the shard from the queue