fix: Cannot read properties of undefined (reading 'guildId')

TypeError: Cannot read properties of undefined (reading 'guildId')
    at module.exports [as INTERACTION_SUCCESS]
This commit is contained in:
March 7th
2022-10-11 17:19:57 +07:00
parent e8158ec85f
commit 3c2b4c9364
4 changed files with 4 additions and 3 deletions

View File

@@ -10,6 +10,7 @@ module.exports = (client, { d: data }) => {
client.emit(Events.INTERACTION_SUCCESS, data);
// Get channel data
const cache = client._interactionCache.get(data.nonce);
if (!cache) return;
const channel = cache.guildId
? client.guilds.cache.get(cache.guildId)?.channels.cache.get(cache.channelId)
: client.channels.cache.get(cache.channelId);