Discord.js如何仅从用户名获取用户ID

时间:2020-06-11 19:36:04

标签: javascript node.js discord discord.js

这不起作用: client.users.cache.get(`${args[0]}`).id;

该如何解决?我正在使用v12

1 个答案:

答案 0 :(得分:1)

尝试

matching_client = client.users.cache.filter(user => user.username === args[0]);

matching_client是与该用户名匹配的用户的集合

相关文档链接:

enter image description here

相关问题