有没有办法在嵌入之前将用户id转换成用户名?

2024-10-01 15:49:12 发布

您现在位置:Python中文网/ 问答频道 /正文

所以我有一个记事本,可以保存特定服务器上任何用户的用户id。有没有一种方法可以在嵌入时使用用户id显示用户名?你知道吗

记事本如下所示:

<@xxxxxxxxxxx>=1.62
<@xxxxxxxxxxx>=1.31

我几乎什么都试过了。我需要帮助。你知道吗

@bot.command(pass_context=True)
async def trial(ctx):
   embed = discord.Embed(title="Hello",color=0x00FFFF)
   f=open("KD.txt","r")
   x=1
   for line in f:
       y=''
       user,CMMR=line.split("=")
       y=(str(x)+". "+user)
       embed.add_field(name=y,value=CMMR,inline=False)
       x+=1
   await bot.say(embed=embed)
   f.close()

我希望显示用户名。我的结果是它只显示用户id


Tags: 方法用户服务器idbotcontextlinepass

热门问题