【发布时间】:2022-12-23 02:49:07
【问题描述】:
我想获取使用斜杠命令的用户 ID。我尝试使用:
author = ctx.message.author.id
但我得到这个错误:
AttributeError: 'NoneType' object has no attribute 'author'
我的完整代码:
slash = SlashCommand(Bot,sync_commands=True)
@slash.slash(
name="getid",
description="description",
guild_ids=[guild id here]
)
async def _getid(ctx:SlashContext):
author = ctx.message.author.id
await ctx.send(author)
【问题讨论】:
标签: discord discord.py