Get channel by id

Hi, im trying to get a channel by it's id but i get undefined
7 Replies
Unknown User
Unknown User17mo ago
Message Not Public
Sign In & Join Server To View
Parogo_72
Parogo_7217mo ago
Then either the id is wrong, or you use that code outside an event Or missing Guilds intent
Waxer59
Waxer5917mo ago
Can't you get a channel by its id outside an event ?
Parogo_72
Parogo_7217mo ago
If the bot isnt logged in the cache will be empty
Waxer59
Waxer5917mo ago
and what would be the way for the cache to be loaded using a function outside of an event, if any?
Parogo_72
Parogo_7217mo ago
As I said the bot needs to be logged in So you either call that function inside an event, or somewhere where you know for sure that the bot already logged in
Waxer59
Waxer5917mo ago
ok ty