Client.user is undefined even at the fired ready event in discord.js v14.18.0
Hello people!
I was trying to log that my client is ready and with the name it is logged in, but it is just straight up undefined
this just evalutes to undefined but readyClient has properties on it.
export const data = eventFile({
name: "ready",
once: true,
execute: async (client, readyClient) => {
console.log(readyClient.user)
readyClient.logger.ready(`Logged in as ${readyClient.user.username}!`);
}
});
export const data = eventFile({
name: "ready",
once: true,
execute: async (client, readyClient) => {
console.log(readyClient.user)
readyClient.logger.ready(`Logged in as ${readyClient.user.username}!`);
}
});
16 Replies
- What's your exact discord.js
npm list discord.js
and node node -v
version?
- Not a discord.js issue? Check out #other-js-ts.
- Consider reading #how-to-get-help to improve your question!
- Explain what exactly your issue is.
- Post the full error stack trace, not just the top part!
- Show your code!
- Issue solved? Press the button!
- ✅
Marked as resolved by OPlog readyClient and show the output
it's kinda hard
on a coder server heh
I mean it says ClusterClient
Like I said, show the output
_events: [Object: null prototype] { ready: [AsyncFunction (anonymous)] },
_eventsCount: 1,
_maxListeners: undefined,
client: <ref *1> DiscordBot {
_events: [Object: null prototype] {
shardDisconnect: [Function (anonymous)],
ready: [Function (anonymous)],
interactionCreate: [AsyncFunction (anonymous)],
messageCreate: [AsyncFunction (anonymous)]
},
_eventsCount: 4,
_maxListeners: undefined,
options: {
closeTimeout: 5000,
waitGuildTimeout: 15000,
shardCount: 1,
makeCache: [Function (anonymous)],
partials: [Array],
failIfNotExists: true,
enforceNonce: false,
presence: [Object],
sweepers: [Object],
ws: [Object],
rest: [Object],
jsonTransformer: [Function: toSnakeCase],
intents: [IntentsBitField],
allowedMentions: [Object],
shards: [Array]
},
rest: REST {
_events: [Object: null prototype] {},
_eventCount: 0,
_maxListeners: 10,
_internalPromiseMap: Map(0) {},
_wrapperId: 0n,
agent: null,
cdn: [CDN],
globalRemaining: 49,
globalDelay: null,
globalReset: 1740648792258,
hashes: Collection(0) [Map] {},
handlers: [Collection [Map]],
hashTimer: Timeout {
_idleTimeout: 14400000,
_idlePrev: [TimersList],
_idleNext: [TimersList],
_idleStart: 552,
_onTimeout: [Function (anonymous)],
_timerArgs: undefined,
_repeat: 14400000,
_destroyed: false,
[Symbol(refed)]: false,
[Symbol(kHasPrimitive)]: false,
[Symbol(asyncId)]: 103,
[Symbol(triggerId)]: 0
},
handlerTimer: Timeout {
_idleTimeout: 3600000,
_idlePrev: [Timeout],
_idleNext: [TimersList],
_idleStart: 553,
_onTimeout: [Function (anonymous)],
_timerArgs: undefined,
_repeat: 3600000,
_destroyed: false,
[Symbol(refed)]: false,
[Symbol(kHasPrimitive)]: false,
[Symbol(asyncId)]: 104,
[Symbol(triggerId)]: 0
},
options: [Object]
},
_events: [Object: null prototype] { ready: [AsyncFunction (anonymous)] },
_eventsCount: 1,
_maxListeners: undefined,
client: <ref *1> DiscordBot {
_events: [Object: null prototype] {
shardDisconnect: [Function (anonymous)],
ready: [Function (anonymous)],
interactionCreate: [AsyncFunction (anonymous)],
messageCreate: [AsyncFunction (anonymous)]
},
_eventsCount: 4,
_maxListeners: undefined,
options: {
closeTimeout: 5000,
waitGuildTimeout: 15000,
shardCount: 1,
makeCache: [Function (anonymous)],
partials: [Array],
failIfNotExists: true,
enforceNonce: false,
presence: [Object],
sweepers: [Object],
ws: [Object],
rest: [Object],
jsonTransformer: [Function: toSnakeCase],
intents: [IntentsBitField],
allowedMentions: [Object],
shards: [Array]
},
rest: REST {
_events: [Object: null prototype] {},
_eventCount: 0,
_maxListeners: 10,
_internalPromiseMap: Map(0) {},
_wrapperId: 0n,
agent: null,
cdn: [CDN],
globalRemaining: 49,
globalDelay: null,
globalReset: 1740648792258,
hashes: Collection(0) [Map] {},
handlers: [Collection [Map]],
hashTimer: Timeout {
_idleTimeout: 14400000,
_idlePrev: [TimersList],
_idleNext: [TimersList],
_idleStart: 552,
_onTimeout: [Function (anonymous)],
_timerArgs: undefined,
_repeat: 14400000,
_destroyed: false,
[Symbol(refed)]: false,
[Symbol(kHasPrimitive)]: false,
[Symbol(asyncId)]: 103,
[Symbol(triggerId)]: 0
},
handlerTimer: Timeout {
_idleTimeout: 3600000,
_idlePrev: [Timeout],
_idleNext: [TimersList],
_idleStart: 553,
_onTimeout: [Function (anonymous)],
_timerArgs: undefined,
_repeat: 3600000,
_destroyed: false,
[Symbol(refed)]: false,
[Symbol(kHasPrimitive)]: false,
[Symbol(asyncId)]: 104,
[Symbol(triggerId)]: 0
},
options: [Object]
},
ws: WebSocketManager {
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
gateway: null,
shards: Collection(0) [Map] {},
status: 3,
destroyed: false,
_ws: [WebSocketManager],
[Symbol(kCapture)]: false
},
actions: ActionsManager {
injectedUser: Symbol(djs.actions.injectedUser),
injectedChannel: Symbol(djs.actions.injectedChannel),
injectedMessage: Symbol(djs.actions.injectedMessage),
client: [Circular *1],
ApplicationCommandPermissionsUpdate: [ApplicationCommandPermissionsUpdateAction],
AutoModerationActionExecution: [AutoModerationActionExecutionAction],
AutoModerationRuleCreate: [AutoModerationRuleCreateAction],
AutoModerationRuleDelete: [AutoModerationRuleDeleteAction],
AutoModerationRuleUpdate: [AutoModerationRuleUpdateAction],
ChannelCreate: [ChannelCreateAction],
ChannelDelete: [ChannelDeleteAction],
ChannelUpdate: [ChannelUpdateAction],
EntitlementCreate: [EntitlementCreateAction],
EntitlementDelete: [EntitlementDeleteAction],
EntitlementUpdate: [EntitlementUpdateAction],
GuildAuditLogEntryCreate: [GuildAuditLogEntryCreateAction],
GuildBanAdd: [GuildBanAdd],
GuildBanRemove: [GuildBanRemove],
GuildChannelsPositionUpdate: [GuildChannelsPositionUpdate],
GuildDelete: [GuildDeleteAction],
GuildEmojiCreate: [GuildEmojiCreateAction],
GuildEmojiDelete: [GuildEmojiDeleteAction],
GuildEmojiUpdate: [GuildEmojiUpdateAction],
GuildEmojisUpdate: [GuildEmojisUpdateAction],
GuildIntegrationsUpdate: [GuildIntegrationsUpdate],
GuildMemberRemove: [GuildMemberRemoveAction],
GuildMemberUpdate: [GuildMemberUpdateAction],
GuildRoleCreate: [GuildRoleCreate],
GuildRoleDelete: [GuildRoleDeleteAction],
GuildRoleUpdate: [GuildRoleUpdateAction],
GuildRolesPositionUpdate: [GuildRolesPositionUpdate],
GuildScheduledEventCreate: [GuildScheduledEventCreateAction],
GuildScheduledEventDelete: [GuildScheduledEventDeleteAction],
GuildScheduledEventUpdate: [GuildScheduledEventUpdateAction],
GuildScheduledEventUserAdd: [GuildScheduledEventUserAddAction],
GuildScheduledEventUserRemove: [GuildScheduledEventUserRemoveAction],
GuildStickerCreate: [GuildStickerCreateAction],
GuildStickerDelete: [GuildStickerDeleteAction],
GuildStickerUpdate: [GuildStickerUpdateAction],
GuildStickersUpdate: [GuildStickersUpdateAction],
GuildUpdate: [GuildUpdateAction],
InteractionCreate: [InteractionCreateAction],
InviteCreate: [InviteCreateAction],
InviteDelete: [InviteDeleteAction],
MessageCreate: [MessageCreateAction],
MessageDelete: [MessageDeleteAction],
MessageDeleteBulk: [MessageDeleteBulkAction],
MessagePollVoteAdd: [MessagePollVoteAddAction],
MessagePollVoteRemove: [MessagePollVoteRemoveAction],
MessageReactionAdd: [MessageReactionAdd],
MessageReactionRemove: [MessageReactionRemove],
MessageReactionRemoveAll: [MessageReactionRemoveAll],
MessageReactionRemoveEmoji: [MessageReactionRemoveEmoji],
MessageUpdate: [MessageUpdateAction],
PresenceUpdate: [PresenceUpdateAction],
StageInstanceCreate: [StageInstanceCreateAction],
StageInstanceDelete: [StageInstanceDeleteAction],
StageInstanceUpdate: [StageInstanceUpdateAction],
ThreadCreate: [ThreadCreateAction],
ThreadDelete: [ThreadDeleteAction],
ThreadListSync: [ThreadListSyncAction],
ws: WebSocketManager {
_events: [Object: null prototype] {},
_eventsCount: 0,
_maxListeners: undefined,
gateway: null,
shards: Collection(0) [Map] {},
status: 3,
destroyed: false,
_ws: [WebSocketManager],
[Symbol(kCapture)]: false
},
actions: ActionsManager {
injectedUser: Symbol(djs.actions.injectedUser),
injectedChannel: Symbol(djs.actions.injectedChannel),
injectedMessage: Symbol(djs.actions.injectedMessage),
client: [Circular *1],
ApplicationCommandPermissionsUpdate: [ApplicationCommandPermissionsUpdateAction],
AutoModerationActionExecution: [AutoModerationActionExecutionAction],
AutoModerationRuleCreate: [AutoModerationRuleCreateAction],
AutoModerationRuleDelete: [AutoModerationRuleDeleteAction],
AutoModerationRuleUpdate: [AutoModerationRuleUpdateAction],
ChannelCreate: [ChannelCreateAction],
ChannelDelete: [ChannelDeleteAction],
ChannelUpdate: [ChannelUpdateAction],
EntitlementCreate: [EntitlementCreateAction],
EntitlementDelete: [EntitlementDeleteAction],
EntitlementUpdate: [EntitlementUpdateAction],
GuildAuditLogEntryCreate: [GuildAuditLogEntryCreateAction],
GuildBanAdd: [GuildBanAdd],
GuildBanRemove: [GuildBanRemove],
GuildChannelsPositionUpdate: [GuildChannelsPositionUpdate],
GuildDelete: [GuildDeleteAction],
GuildEmojiCreate: [GuildEmojiCreateAction],
GuildEmojiDelete: [GuildEmojiDeleteAction],
GuildEmojiUpdate: [GuildEmojiUpdateAction],
GuildEmojisUpdate: [GuildEmojisUpdateAction],
GuildIntegrationsUpdate: [GuildIntegrationsUpdate],
GuildMemberRemove: [GuildMemberRemoveAction],
GuildMemberUpdate: [GuildMemberUpdateAction],
GuildRoleCreate: [GuildRoleCreate],
GuildRoleDelete: [GuildRoleDeleteAction],
GuildRoleUpdate: [GuildRoleUpdateAction],
GuildRolesPositionUpdate: [GuildRolesPositionUpdate],
GuildScheduledEventCreate: [GuildScheduledEventCreateAction],
GuildScheduledEventDelete: [GuildScheduledEventDeleteAction],
GuildScheduledEventUpdate: [GuildScheduledEventUpdateAction],
GuildScheduledEventUserAdd: [GuildScheduledEventUserAddAction],
GuildScheduledEventUserRemove: [GuildScheduledEventUserRemoveAction],
GuildStickerCreate: [GuildStickerCreateAction],
GuildStickerDelete: [GuildStickerDeleteAction],
GuildStickerUpdate: [GuildStickerUpdateAction],
GuildStickersUpdate: [GuildStickersUpdateAction],
GuildUpdate: [GuildUpdateAction],
InteractionCreate: [InteractionCreateAction],
InviteCreate: [InviteCreateAction],
InviteDelete: [InviteDeleteAction],
MessageCreate: [MessageCreateAction],
MessageDelete: [MessageDeleteAction],
MessageDeleteBulk: [MessageDeleteBulkAction],
MessagePollVoteAdd: [MessagePollVoteAddAction],
MessagePollVoteRemove: [MessagePollVoteRemoveAction],
MessageReactionAdd: [MessageReactionAdd],
MessageReactionRemove: [MessageReactionRemove],
MessageReactionRemoveAll: [MessageReactionRemoveAll],
MessageReactionRemoveEmoji: [MessageReactionRemoveEmoji],
MessageUpdate: [MessageUpdateAction],
PresenceUpdate: [PresenceUpdateAction],
StageInstanceCreate: [StageInstanceCreateAction],
StageInstanceDelete: [StageInstanceDeleteAction],
StageInstanceUpdate: [StageInstanceUpdateAction],
ThreadCreate: [ThreadCreateAction],
ThreadDelete: [ThreadDeleteAction],
ThreadListSync: [ThreadListSyncAction],
ThreadMemberUpdate: [ThreadMemberUpdateAction],
ThreadMembersUpdate: [ThreadMembersUpdateAction],
TypingStart: [TypingStart],
UserUpdate: [UserUpdateAction],
VoiceStateUpdate: [VoiceStateUpdate],
WebhooksUpdate: [WebhooksUpdate]
},
voice: ClientVoiceManager { adapters: Map(0) {} },
shard: null,
users: UserManager {},
guilds: GuildManager {},
channels: ChannelManager {},
sweepers: Sweepers { options: [Object], intervals: [Object] },
presence: ClientPresence {
userId: null,
guild: null,
status: 'online',
activities: [],
clientStatus: null
},
user: null,
application: null,
readyTimestamp: null,
logger: Logger { prefix: 'BOT', showDebug: true },
cluster: [Circular *2],
manager: Manager {
client: [Circular *1],
eventManager: [EventManager],
messageManager: [MessageManager],
interactionManager: [InteractionManager],
commandManager: [CommandManager],
cooldownManager: [CooldownManager]
},
config: {
token: 'MTAyMzM1MzMzMDA2NTNOOOOOOOfX0SvUSng',
useSharding: true,
showDebug: true,
prefix: '-'
},
[Symbol(kCapture)]: true
},
mode: 'process',
shardList: [ 0 ],
queue: { mode: 'manual' },
maintenance: false,
ready: false,
process: ChildClient {
ipc: process {
version: 'v18.19.1',
versions: [Object],
arch: 'x64',
platform: 'linux',
release: [Object],
_rawDebug: [Function: _rawDebug],
moduleLoadList: [Array],
binding: [Function: binding],
_linkedBinding: [Function: _linkedBinding],
_events: [Object: null prototype],
_eventsCount: 6,
_maxListeners: undefined,
domain: null,
_exiting: [Getter/Setter],
config: [Getter/Setter],
dlopen: [Function: dlopen],
uptime: [Function: uptime],
_getActiveRequests: [Function: _getActiveRequests],
_getActiveHandles: [Function: _getActiveHandles],
getActiveResourcesInfo: [Function: getActiveResourcesInfo],
reallyExit: [Function: reallyExit],
_kill: [Function: _kill],
cpuUsage: [Function: cpuUsage],
resourceUsage: [Function: resourceUsage],
memoryUsage: [Function],
constrainedMemory: [Function: constrainedMemory],
kill: [Function: kill],
exit: [Function: exit],
hrtime: [Function],
openStdin: [Function (anonymous)],
getuid: [Function: getuid],
geteuid: [Function: geteuid],
getgid: [Function: getgid],
getegid: [Function: getegid],
getgroups: [Function: getgroups],
allowedNodeEnvironmentFlags: [NodeEnvironmentFlagsSet [Set]],
assert: [Function: deprecated],
features: [Object],
_fatalException: [Function (anonymous)],
setUncaughtExceptionCaptureCallback: [Function: setUncaughtExceptionCaptureCallback],
hasUncaughtExceptionCaptureCallback: [Function: hasUncaughtExceptionCaptureCallback],
emitWarning: [Function: emitWarning],
nextTick: [Function: nextTick],
_tickCallback: [Function: runNextTicks],
sourceMapsEnabled: [Getter],
setSourceMapsEnabled: [Function: setSourceMapsEnabled],
_debugProcess: [Function: _debugProcess],
_debugEnd: [Function: _debugEnd],
_startProfilerIdleNotifier: [Function (anonymous)],
_stopProfilerIdleNotifier: [Function (anonymous)],
stdout: [Getter],
stdin: [Getter],
ThreadMemberUpdate: [ThreadMemberUpdateAction],
ThreadMembersUpdate: [ThreadMembersUpdateAction],
TypingStart: [TypingStart],
UserUpdate: [UserUpdateAction],
VoiceStateUpdate: [VoiceStateUpdate],
WebhooksUpdate: [WebhooksUpdate]
},
voice: ClientVoiceManager { adapters: Map(0) {} },
shard: null,
users: UserManager {},
guilds: GuildManager {},
channels: ChannelManager {},
sweepers: Sweepers { options: [Object], intervals: [Object] },
presence: ClientPresence {
userId: null,
guild: null,
status: 'online',
activities: [],
clientStatus: null
},
user: null,
application: null,
readyTimestamp: null,
logger: Logger { prefix: 'BOT', showDebug: true },
cluster: [Circular *2],
manager: Manager {
client: [Circular *1],
eventManager: [EventManager],
messageManager: [MessageManager],
interactionManager: [InteractionManager],
commandManager: [CommandManager],
cooldownManager: [CooldownManager]
},
config: {
token: 'MTAyMzM1MzMzMDA2NTNOOOOOOOfX0SvUSng',
useSharding: true,
showDebug: true,
prefix: '-'
},
[Symbol(kCapture)]: true
},
mode: 'process',
shardList: [ 0 ],
queue: { mode: 'manual' },
maintenance: false,
ready: false,
process: ChildClient {
ipc: process {
version: 'v18.19.1',
versions: [Object],
arch: 'x64',
platform: 'linux',
release: [Object],
_rawDebug: [Function: _rawDebug],
moduleLoadList: [Array],
binding: [Function: binding],
_linkedBinding: [Function: _linkedBinding],
_events: [Object: null prototype],
_eventsCount: 6,
_maxListeners: undefined,
domain: null,
_exiting: [Getter/Setter],
config: [Getter/Setter],
dlopen: [Function: dlopen],
uptime: [Function: uptime],
_getActiveRequests: [Function: _getActiveRequests],
_getActiveHandles: [Function: _getActiveHandles],
getActiveResourcesInfo: [Function: getActiveResourcesInfo],
reallyExit: [Function: reallyExit],
_kill: [Function: _kill],
cpuUsage: [Function: cpuUsage],
resourceUsage: [Function: resourceUsage],
memoryUsage: [Function],
constrainedMemory: [Function: constrainedMemory],
kill: [Function: kill],
exit: [Function: exit],
hrtime: [Function],
openStdin: [Function (anonymous)],
getuid: [Function: getuid],
geteuid: [Function: geteuid],
getgid: [Function: getgid],
getegid: [Function: getegid],
getgroups: [Function: getgroups],
allowedNodeEnvironmentFlags: [NodeEnvironmentFlagsSet [Set]],
assert: [Function: deprecated],
features: [Object],
_fatalException: [Function (anonymous)],
setUncaughtExceptionCaptureCallback: [Function: setUncaughtExceptionCaptureCallback],
hasUncaughtExceptionCaptureCallback: [Function: hasUncaughtExceptionCaptureCallback],
emitWarning: [Function: emitWarning],
nextTick: [Function: nextTick],
_tickCallback: [Function: runNextTicks],
sourceMapsEnabled: [Getter],
setSourceMapsEnabled: [Function: setSourceMapsEnabled],
_debugProcess: [Function: _debugProcess],
_debugEnd: [Function: _debugEnd],
_startProfilerIdleNotifier: [Function (anonymous)],
_stopProfilerIdleNotifier: [Function (anonymous)],
stdout: [Getter],
stdin: [Getter],
stderr: [Getter],
abort: [Function: abort],
umask: [Function: wrappedUmask],
chdir: [Function (anonymous)],
cwd: [Function: wrappedCwd],
initgroups: [Function: initgroups],
setgroups: [Function: setgroups],
setegid: [Function (anonymous)],
seteuid: [Function (anonymous)],
setgid: [Function (anonymous)],
setuid: [Function (anonymous)],
env: [Object],
title: '/usr/bin/node',
argv: [Array],
execArgv: [],
pid: 2532490,
ppid: 2532475,
execPath: '/usr/bin/node',
debugPort: 9229,
argv0: '/usr/bin/node',
exitCode: undefined,
_preload_modules: [],
report: [Getter],
channel: [Control],
_handleQueue: null,
_pendingMessage: null,
send: [Function (anonymous)],
_send: [Function (anonymous)],
connected: true,
disconnect: [Function (anonymous)],
_disconnect: [Function (anonymous)],
[Symbol(kCapture)]: false,
[Symbol(kChannelHandle)]: [Pipe]
}
},
messageHandler: ClusterClientHandler {
client: [Circular *2],
ipc: ChildClient { ipc: [process] }
},
promise: PromiseHandler { nonce: Map(0) {} },
[Symbol(kCapture)]: false
}
stderr: [Getter],
abort: [Function: abort],
umask: [Function: wrappedUmask],
chdir: [Function (anonymous)],
cwd: [Function: wrappedCwd],
initgroups: [Function: initgroups],
setgroups: [Function: setgroups],
setegid: [Function (anonymous)],
seteuid: [Function (anonymous)],
setgid: [Function (anonymous)],
setuid: [Function (anonymous)],
env: [Object],
title: '/usr/bin/node',
argv: [Array],
execArgv: [],
pid: 2532490,
ppid: 2532475,
execPath: '/usr/bin/node',
debugPort: 9229,
argv0: '/usr/bin/node',
exitCode: undefined,
_preload_modules: [],
report: [Getter],
channel: [Control],
_handleQueue: null,
_pendingMessage: null,
send: [Function (anonymous)],
_send: [Function (anonymous)],
connected: true,
disconnect: [Function (anonymous)],
_disconnect: [Function (anonymous)],
[Symbol(kCapture)]: false,
[Symbol(kChannelHandle)]: [Pipe]
}
},
messageHandler: ClusterClientHandler {
client: [Circular *2],
ipc: ChildClient { ipc: [process] }
},
promise: PromiseHandler { nonce: Map(0) {} },
[Symbol(kCapture)]: false
}
can you please use a sourcebin and slap it all in there, the whole object
readyClient.client.user
but that is still null
what package are you using for this magical "ClusterClient"
discord-hybrid-sharding
https://discord.gg/YTdNBHh then please ask them for support on this
i already asked in their server
but they didn't know either why the user is null
well, thats their beer though, we can't provide support for a package thats not from us
ah ok
thanks