diff --git a/packages/client/README.md b/packages/client/README.md new file mode 100644 index 000000000..848e2bf39 --- /dev/null +++ b/packages/client/README.md @@ -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. \ No newline at end of file diff --git a/packages/client/src/Client.ts b/packages/client/src/Client.ts index bd27737c0..f10fb13c8 100644 --- a/packages/client/src/Client.ts +++ b/packages/client/src/Client.ts @@ -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() diff --git a/packages/client/src/RequestHandler.ts b/packages/client/src/RequestHandler.ts index f5a37853c..0dfdf5085 100644 --- a/packages/client/src/RequestHandler.ts +++ b/packages/client/src/RequestHandler.ts @@ -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 diff --git a/packages/client/src/gateway/Shard.ts b/packages/client/src/gateway/Shard.ts index db5e6fb26..07194be24 100644 --- a/packages/client/src/gateway/Shard.ts +++ b/packages/client/src/gateway/Shard.ts @@ -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 diff --git a/packages/client/src/gateway/ShardManager.ts b/packages/client/src/gateway/ShardManager.ts index 3189c2f5d..daa7d31c0 100644 --- a/packages/client/src/gateway/ShardManager.ts +++ b/packages/client/src/gateway/ShardManager.ts @@ -115,7 +115,7 @@ export class ShardManager extends Collection { } // connect the shard - shard.connect() + shard.identify() this.buckets.set(rateLimitKey, Date.now()) // remove the shard from the queue