Skip to main content

Client Providers

NestCord have snippets to access the client and its properties in your application. You can inject managers and utils of discord.js client using constructor.

src/app.service.ts
import { Injectable } from '@nestjs/common';
import { Client, ChannelManager, GuildManager, UserManager, ShardClientUtil, ClientVoiceManager, WebSocketManager, REST } from 'discord.js';

@Injectable()
export class AppService {
public constructor(
private readonly client: Client,
private readonly channels: ChannelManager,
private readonly guilds: GuildManager,
private readonly users: UserManager,
private readonly shard: ShardClientUtil,
private readonly voice: ClientVoiceManager,
private readonly ws: WebSocketManager,
private readonly rest: REST
) {}
}
Class (Type to be Injected)Client Property (Will access to)Description
ClientclientDiscord.js client
ChannelManagerclient.channelsChannels of client
GuildManagerclient.guildsGuilds of client
UserManagerclient.usersUsers of client
ShardClientUtilclient.shardShards utilities
ClientVoiceManagerclient.voiceVoice manager
WebSocketManagerclient.wsWebsocket manager
RESTclient.restREST manager