取消禁止特定用户
Unbanning a specific user
重要说明:我没有使用重写。
我一直在尝试使用命令取消对 discord.py 中某条消息的特定用户的禁止。
示例:
在命令“!unban”中,bot 解禁了命令中未提及的用户。
我试过
@client.event
async def on_message(message):
if message.content == x:
await message.guild.unban('[User ID], *, reason=none')
这导致
await self._state.http.unban(user.id, self.id, reason=reason)
AttributeError: 'str' object has no attribute 'id'
如果有人能帮助我,我将不胜感激。我迷路了。
该命令的正确用法是 guild.unban(user, reason=None)
。调用函数时不需要星号,=None
表示 reason 是可选的。如果你没有理由:
你的情况:
await message.guild.unban(userID)
只要您的用户 ID 是 snowflake 对象的格式(例如该用户的 User
对象!)
,就可以完成这项工作
重要说明:我没有使用重写。
我一直在尝试使用命令取消对 discord.py 中某条消息的特定用户的禁止。 示例:
在命令“!unban”中,bot 解禁了命令中未提及的用户。
我试过
@client.event
async def on_message(message):
if message.content == x:
await message.guild.unban('[User ID], *, reason=none')
这导致
await self._state.http.unban(user.id, self.id, reason=reason)
AttributeError: 'str' object has no attribute 'id'
如果有人能帮助我,我将不胜感激。我迷路了。
该命令的正确用法是 guild.unban(user, reason=None)
。调用函数时不需要星号,=None
表示 reason 是可选的。如果你没有理由:
你的情况:
await message.guild.unban(userID)
只要您的用户 ID 是 snowflake 对象的格式(例如该用户的 User
对象!)