【问题标题】:Get User Username - discord.js获取用户用户名 - discord.js
【发布时间】:2021-06-03 06:23:12
【问题描述】:

大家好,我不知道如何在不和谐中获取用户名,但我不能。 关于message.author.username 有什么建议吗?

【问题讨论】:

标签: javascript discord discord.js


【解决方案1】:

要获取用户名,您可以使用 2 种常用方法:

let userName = message.author.username;

或者:

//you can search for a username
let userName = client.users.cache.find(user => user.username === "username here").username;
//note: this depends on if the user is cached or not (link below)

Discord.js Guide - Common Mistakes and Syntax Errors

【讨论】:

    猜你喜欢
    • 2021-12-08
    • 2020-07-05
    • 2023-04-11
    • 1970-01-01
    • 2021-11-26
    • 1970-01-01
    • 1970-01-01
    • 2020-08-02
    • 1970-01-01
    相关资源
    最近更新 更多