Lib name change

This commit is contained in:
Helloyunho 2020-11-08 16:20:28 +09:00
parent 8ff3ef9f71
commit 41656e2bfe

View file

@ -12,8 +12,8 @@ import {
} from '../types/gateway.ts'
import { gatewayHandlers } from './handlers/index.ts'
import { GATEWAY_BOT } from '../types/endpoint.ts'
import { GatewayCache } from "../managers/gatewayCache.ts"
import { ClientActivityPayload } from "../structures/presence.ts"
import { GatewayCache } from '../managers/gatewayCache.ts'
import { ClientActivityPayload } from '../structures/presence.ts'
/**
* Handles Discord gateway connection.
@ -219,8 +219,8 @@ class Gateway {
token: this.token,
properties: {
$os: Deno.build.os,
$browser: 'discord.deno', // TODO: Change lib name
$device: 'discord.deno'
$browser: 'harmony', // TODO: Change lib name
$device: 'harmony'
},
compress: true,
shard: [0, 1], // TODO: Make sharding possible
@ -234,17 +234,17 @@ class Gateway {
if (this.client.bot === false) {
// TODO: Complete Selfbot support
this.debug("Modify Identify Payload for Self-bot..")
this.debug('Modify Identify Payload for Self-bot..')
// delete payload.d['intents']
// payload.d.intents = Intents.None
payload.d.presence = null
payload.d.properties = {
$os: "Windows",
$browser: "Firefox",
$device: ""
$os: 'Windows',
$browser: 'Firefox',
$device: ''
}
this.debug("Warn: Support for selfbots is incomplete")
this.debug('Warn: Support for selfbots is incomplete')
}
this.send(payload)
@ -299,12 +299,14 @@ class Gateway {
send (data: GatewayResponse): boolean {
if (this.websocket.readyState !== this.websocket.OPEN) return false
this.websocket.send(JSON.stringify({
this.websocket.send(
JSON.stringify({
op: data.op,
d: data.d,
s: typeof data.s === "number" ? data.s : null,
t: data.t === undefined ? null : data.t,
}))
s: typeof data.s === 'number' ? data.s : null,
t: data.t === undefined ? null : data.t
})
)
return true
}
@ -319,7 +321,7 @@ class Gateway {
const payload = {
op: GatewayOpcodes.HEARTBEAT,
d: this.sequenceID ?? null
};
}
this.send(payload)
this.lastPingTimestamp = Date.now()