Skip to content

How to send a message in a specific channel in "guildMemberRemove" event ? #8780

Closed Answered by almostSouji
Izuki13 asked this question in Q&A
Discussion options

You must be logged in to vote

The error you receive means that channel has the value undefined which means the cache-lookup .cache.get(key) was unsuccessful.
This means that at the time this code runs there is no channel with the provided key in the cache.

Now this, in turn, means that either the key is wrong (make sure you pasted the right value) or that the cache simply does not hold the expected channel. Since channels generally arrive on ready with the initial guild payloads and are updated via incoming events, that suggests the cache might just be empty.

If not already the case, move the code into some execution scope that runs after the client is ready. In your case "when a member leaves the server" would sugges…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by Jiralite
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants