mirror of
https://github.com/ReVanced/revanced-bots.git
synced 2026-01-20 09:43:59 +00:00
chore: format and remove unneccessary code
This commit is contained in:
@@ -49,7 +49,9 @@ export default class Client {
|
||||
rs(packet)
|
||||
}
|
||||
|
||||
const parseTextFailedListener = (packet: Packet<ServerOperation.ParseTextFailed>) => {
|
||||
const parseTextFailedListener = (
|
||||
packet: Packet<ServerOperation.ParseTextFailed>
|
||||
) => {
|
||||
if (packet.d.id !== currentId) return
|
||||
this.gateway.off('parseTextFailed', parseTextFailedListener)
|
||||
rj(packet)
|
||||
@@ -84,7 +86,9 @@ export default class Client {
|
||||
rs(packet)
|
||||
}
|
||||
|
||||
const parseImageFailedListener = (packet: Packet<ServerOperation.ParseImageFailed>) => {
|
||||
const parseImageFailedListener = (
|
||||
packet: Packet<ServerOperation.ParseImageFailed>
|
||||
) => {
|
||||
if (packet.d.id !== currentId) return
|
||||
this.gateway.off('parseImageFailed', parseImageFailedListener)
|
||||
rj(packet)
|
||||
|
||||
@@ -24,8 +24,7 @@ export default class ClientGateway {
|
||||
|
||||
#hbTimeout: NodeJS.Timeout = null!
|
||||
#socket: WebSocket = null!
|
||||
#emitter =
|
||||
new EventEmitter() as TypedEmitter<ClientGatewayEventHandlers>
|
||||
#emitter = new EventEmitter() as TypedEmitter<ClientGatewayEventHandlers>
|
||||
|
||||
constructor(options: ClientGatewayOptions) {
|
||||
this.url = options.url
|
||||
@@ -110,6 +109,7 @@ export default class ClientGateway {
|
||||
|
||||
switch (packet.op) {
|
||||
case ServerOperation.Hello:
|
||||
// eslint-disable-next-line no-case-declarations
|
||||
const data = Object.freeze(
|
||||
(packet as Packet<ServerOperation.Hello>).d
|
||||
)
|
||||
@@ -124,9 +124,11 @@ export default class ClientGateway {
|
||||
default:
|
||||
return this.#emitter.emit(
|
||||
uncapitalize(
|
||||
ServerOperation[packet.op] as ClientGatewayServerEventName
|
||||
ServerOperation[
|
||||
packet.op
|
||||
] as ClientGatewayServerEventName
|
||||
),
|
||||
// @ts-expect-error
|
||||
// @ts-expect-error TypeScript doesn't know that the lines above negate the type enough
|
||||
packet
|
||||
)
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
export { default as Client } from './Client.js'
|
||||
export * from './Client.js'
|
||||
export { default as ClientGateway } from './ClientGateway.js'
|
||||
export * from './ClientGateway.js'
|
||||
export * from './ClientGateway.js'
|
||||
|
||||
Reference in New Issue
Block a user