Skip to content
This repository was archived by the owner on Oct 26, 2022. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/client/Client.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { env } from 'node:process';
import { EventEmitter } from 'stream';
import type { Channel, Guild } from '../structures';
import type { Channel, Guild, User } from '../structures';
import type { ClientOptions } from '../types/lib';
import { REST } from './rest/REST';
import { Gateway } from './ws/Gateway';
Expand All @@ -13,6 +13,8 @@ export class Client extends EventEmitter {
public readonly channels = new Map<string, Channel>();
public intents: number;

public user?: User;

public constructor(options: ClientOptions) {
super();
this.intents = options.intents || 0;
Expand Down
3 changes: 2 additions & 1 deletion src/client/ws/Gateway.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ import {
GatewayReadyDispatch
} from 'discord-api-types/v10';
import { WebSocket } from 'ws';
import { Channel, Guild, Message } from '../../structures';
import { Channel, Guild, Message, User } from '../../structures';
import { log } from '../../utils/logger';
import type { Client } from '../Client';

Expand Down Expand Up @@ -68,6 +68,7 @@ export class Gateway {
case 'READY': {
const readyPayload = buffer as GatewayReadyDispatch;
this.readyGuilds = readyPayload.d.guilds;
this.client.user = new User(readyPayload.d.user);

break;
}
Expand Down