简体   繁体   English

无法读取未定义的属性(读取“用户”)| 交互.client.api.users | Discord.js V14

[英]Cannot read properties of undefined (reading 'users') | interaction.client.api.users | Discord.js V14

This Error:此错误: 控制台错误

TypeError: Cannot read properties of undefined (reading 'users')
    at Object.execute (D:\Mortal\Belgeler\Kod Denemeleri\Discord Botu\Via\v4 (v14)\commands\Kullanıcı\profil.js:34:55)
    at module.exports (D:\Mortal\Belgeler\Kod Denemeleri\Discord Botu\Via\v4 (v14)\events\interactionCreate.js:28:21)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

And this my code:这是我的代码: 错误

const APIFetch = await interaction.client.api.users(user ? user.id : interaction.user.id).get()

I could not find the solution to the problem on the internet because it is a new version.我在互联网上找不到问题的解决方案,因为它是一个新版本。 I researched for about 2 hours;我研究了大约2个小时; At first, I looked at the sites and then looked at what data I could pull through interaction or the customer.起初,我查看了网站,然后查看了我可以通过交互或客户获取哪些数据。 We can't pull API data.我们无法提取 API 数据。 That's why we get the error "users" can't be read.这就是为什么我们得到错误“用户”无法读取的原因。 At least that's it, as I understand it... How do I resolve this error?至少就是这样,据我所知......我该如何解决这个错误?

直接使用interaction.client.users:

const data = await interaction.client.users.fetch(user ? user.id : interaction.user.id);

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 错误 discord.js v14(类型错误:无法读取未定义的属性(读取“标志”)) - Erro discord.js v14 (TypeError: Cannot read properties of undefined (reading 'FLAGS')) Discord.js V14 类型错误:无法读取未定义的属性(读取“回复”) - Discord.js V14 TypeError: Cannot read properties of undefined (reading 'reply') 类型错误:无法读取未定义的属性(读取“回复”)- discord.js v14 - TypeError: Cannot read properties of undefined (reading 'reply') - discord.js v14 类型错误:无法读取未定义的属性(读取“setTitle”)。 用于随机猫图片命令 - Discord.js V14 - TypeError: Cannot read properties of undefined (reading 'setTitle'). for random cat picture command - Discord.js V14 类型错误:无法读取未定义的属性(读取“发送”)| Discord JS v14 - TypeError: Cannot read properties of undefined (reading 'send') | Discord JS v14 未处理的拒绝:TypeError:无法读取未定义的属性(读取“0”)在尝试打印 discord.js v14 中的 JSON object 时出错 - Unhandled Rejection: TypeError: Cannot read properties of undefined (reading '0') getting error while trying to print JSON object in discord.js v14 Discord.js v14 交互失败 - Discord.js v14 interaction failed discord.js 错误:无法读取未定义的属性(读取“客户端”) - discord.js error: Cannot read properties of undefined (reading 'client') 如何使用 Discord.js v14 更改用户昵称 - How do I change a users nick name using Discord.js v14 无法读取未定义的属性(读取“权限”)。 | Discord.js v13 - Cannot read properties of undefined (reading 'permissions'). | Discord.js v13
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM