harmony/src/gateway/handlers/resume.ts

19 lines
558 B
TypeScript
Raw Normal View History

2020-11-08 07:57:24 +00:00
import { User } from '../../structures/user.ts'
import { CLIENT_USER } from '../../types/endpoint.ts'
2020-11-25 11:53:40 +00:00
import { Resume } from '../../types/gateway.ts'
import { Gateway, GatewayEventHandler } from '../index.ts'
2020-11-25 11:53:40 +00:00
export const resume: GatewayEventHandler = async (
gateway: Gateway,
d: Resume
) => {
gateway.debug(`Session Resumed!`)
2021-01-20 10:05:15 +00:00
gateway.client.emit('resumed')
2020-11-25 11:53:40 +00:00
if (gateway.client.user === undefined)
gateway.client.user = new User(
gateway.client,
await gateway.client.rest.get(CLIENT_USER())
)
2020-11-01 12:05:22 +00:00
gateway.client.emit('ready')
2020-11-25 11:53:40 +00:00
}