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