Problem getting channel

so i have logChannel defined like this
globalThis.logChannel = client.channels.cache.get("channel id");
globalThis.logChannel = client.channels.cache.get("channel id");
and i have my error handler in a folder in the work dir... but it gives the error that cannot read properties of undefined i also used my eval cmd and it returns the channel info just fine
50 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
wen
wenOP2y ago
djs v14.7.1 and node v17.3.0
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
wen
wenOP2y ago
logChannel.send(err.stack);
^

TypeError: Cannot read properties of undefined (reading 'send')
logChannel.send(err.stack);
^

TypeError: Cannot read properties of undefined (reading 'send')
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
wen
wenOP2y ago
ok lemme try
throw new Error("Expected token to be set for this request, but none was present");
^

Error: Expected token to be set for this request, but none was present
throw new Error("Expected token to be set for this request, but none was present");
^

Error: Expected token to be set for this request, but none was present
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
wen
wenOP2y ago
discord
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
wen
wenOP2y ago
i am i have a whole handler set up and i am also passing client as args
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
d.js docs
d.js docs2y ago
To share long code snippets use a service like gist, sourcebin, starbin, or similar instead of posting them as large code blocks.
wen
wenOP2y ago
of ?
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
wen
wenOP2y ago
when there is an error
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
wen
wenOP2y ago
wdym
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
wen
wenOP2y ago
OH in my index.js i just pass client with my handlers
wen
wenOP2y ago
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
wen
wenOP2y ago
yes it showed this now i changed it back
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
wen
wenOP2y ago
all cmds work fine though... also i have different files for different events
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
wen
wenOP2y ago
OHHHHHHHH
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
wen
wenOP2y ago
but also my bot is present in the server where the channel is
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
wen
wenOP2y ago
lemme try it
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
wen
wenOP2y ago
ok so this worked as it sends stuff in channel now but there is a problem
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
wen
wenOP2y ago
process.on("multipleResolves", (type, promise, reason) => {
console.log("Multiple Resolves Error");
console.log(type, promise, reason);
channel.send("Multiple resolves error");
});
process.on("multipleResolves", (type, promise, reason) => {
console.log("Multiple Resolves Error");
console.log(type, promise, reason);
channel.send("Multiple resolves error");
});
it just spams Multiple resolves error
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
wen
wenOP2y ago
yes
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
wen
wenOP2y ago
Multiple Resolves Error
resolve Promise {
{
id: '1061313525676519524',
type: 0,
content: 'Multiple resolves error',
channel_id: '1061279068647071754',
author: {
id: '1047583623353737227',
username: 'Zero Two',
avatar: '2a08bc814fe6cee6239aa3170695815b',
avatar_decoration: null,
discriminator: '1928',
public_flags: 0,
bot: true
},
attachments: [],
embeds: [],
mentions: [],
mention_roles: [],
pinned: false,
mention_everyone: false,
tts: false,
timestamp: '2023-01-07T16:01:02.773000+00:00',
edited_timestamp: null,
flags: 0,
components: [],
referenced_message: null
}
}
Multiple Resolves Error
resolve Promise {
{
id: '1061313525676519524',
type: 0,
content: 'Multiple resolves error',
channel_id: '1061279068647071754',
author: {
id: '1047583623353737227',
username: 'Zero Two',
avatar: '2a08bc814fe6cee6239aa3170695815b',
avatar_decoration: null,
discriminator: '1928',
public_flags: 0,
bot: true
},
attachments: [],
embeds: [],
mentions: [],
mention_roles: [],
pinned: false,
mention_everyone: false,
tts: false,
timestamp: '2023-01-07T16:01:02.773000+00:00',
edited_timestamp: null,
flags: 0,
components: [],
referenced_message: null
}
}
several of these
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
wen
wenOP2y ago
ok lemme try
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
wen
wenOP2y ago
i have
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
wen
wenOP2y ago
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
wen
wenOP2y ago
tysm
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
wen
wenOP2y ago
:)
Want results from more Discord servers?
Add your server