从用户ID获取用户名|不和谐 [英] Obtaining username from user id | discord.py

查看:69
本文介绍了从用户ID获取用户名|不和谐的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

尽管我在从用户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获取用户名|不和谐的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆