【发布时间】:2021-05-08 22:07:56
【问题描述】:
所以我需要我的机器人从 UserID 中获取用户。我试过这样:
import discord
from discord.ext import commands
from discord.utils import get
client = commands.Bot(command_prefix = '&')
@client.command(pass_context = True)
async def test(ctx, id : int):
user = client.get_user(id)
print(user)
TOKEN = ""
client.run(TOKEN)
但它总是返回 None,但为什么呢? :C 感谢您的帮助。
【问题讨论】:
-
这能回答你的问题吗? Discord.py get user object from id/tag
-
不,那篇文章中的任何内容都不适合我。
-
命令由用户运行,否则使其成为常规函数。
-
我在帖子中添加了实际代码。
标签: python discord discord.py