@client.command()
async def status(current, content: str):
status = None
for member in current.guild.members:
if str(member.id) == content:
status = member.status
break
if status == discord.Status.online:
online_embed = discord.Embed(
title="awa is online", description="", color=0xF6E5E5
)
await current.send(embed=online_embed)
我每次都必须做 #status [user id],有没有办法让它只 #status?
答案 0 :(得分:0)
在命令中获取成员对象的最简单方法之一(允许您使用用户的 ID、他们的姓名等)是使用他们提供的转换器。
@client.command()
async def test(current, member: discord.Member=None):
if member == None: # if no member is provided..
member = current.author # ..make member the author
await current.send(f"Hello {member.mention}!")
其他类似问题: