Obtaining username from user id | discord.py(从用户 id 获取用户名 |不和谐.py)
问题描述
好吧,我一直在使用不和谐的数据库来获取队列中用户 id 的主要列表,尽管我在从用户 id 获取用户时遇到问题,因为它没有返回
Well I have been working with databases for a while with discord in order to obtain major lists of user id's in a queue, although I am having problem's obtaining the user from user id as it returns none
举例
members = list(privateduos[matchid])
user = discord.User(id=int(members[0]))
await client.say("Say `test` " + str(user))
await client.wait_for_message(content="test", author=user)
这是输出
client.wait_for_message似乎也没有检测到代码中的消息作者,有什么解决办法吗?
The client.wait_for_message doesnt seem to detect the message author in the code as well, any solutions?
推荐答案
方法 client.get_user_info 自上次迁移后已弃用,您应该改用 Client.fetch_user()
The method client.get_user_info is deprecated since the last Migration, you should use Client.fetch_user() instead
有关详细信息,请参阅此链接:https://discordpy.readthedocs.io/zh/latest/migrating.html
See this link for the details : https://discordpy.readthedocs.io/en/latest/migrating.html
这篇关于从用户 id 获取用户名 |不和谐.py的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:从用户 id 获取用户名 |不和谐.py
基础教程推荐
- 用于分类数据的跳跃记号标签 2022-01-01
- 筛选NumPy数组 2022-01-01
- 如何在海运重新绘制中自定义标题和y标签 2022-01-01
- 何时使用 os.name、sys.platform 或 platform.system? 2022-01-01
- Dask.array.套用_沿_轴:由于额外的元素([1]),使用dask.array的每一行作为另一个函数的输入失败 2022-01-01
- 如何让 python 脚本监听来自另一个脚本的输入 2022-01-01
- 使用PyInstaller后在Windows中打开可执行文件时出错 2022-01-01
- Python kivy 入口点 inflateRest2 无法定位 libpng16-16.dll 2022-01-01
- 在 Python 中,如果我在一个“with"中返回.块,文件还会关闭吗? 2022-01-01
- 线程时出现 msgbox 错误,GUI 块 2022-01-01