【发布时间】:2021-05-22 23:30:06
【问题描述】:
我正在使用 discord.ext.commands Bot 类。我需要从字典中的 id 获取用户信息,以便我可以直接向他们发送消息。我知道有一种方法可以使用客户端类( .get_user_info() )函数从 id 获取用户信息,但是我没有使用客户端类,只使用 Bot 类。有没有办法使用 bot 类获取用户信息?
【问题讨论】:
标签: python discord discord.py
我正在使用 discord.ext.commands Bot 类。我需要从字典中的 id 获取用户信息,以便我可以直接向他们发送消息。我知道有一种方法可以使用客户端类( .get_user_info() )函数从 id 获取用户信息,但是我没有使用客户端类,只使用 Bot 类。有没有办法使用 bot 类获取用户信息?
【问题讨论】:
标签: python discord discord.py
使用user = bot.fetch_user(id)。之后就可以通过user访问用户的所有属性,比如user.display_name。
【讨论】: