Python 不和谐成员
好的,我的ban命令可以工作Python 不和谐成员,python,python-3.x,discord,discord.py,Python,Python 3.x,Discord,Discord.py,好的,我的ban命令可以工作ban(member),但是,除了使用unban(member)外,执行相同操作时,输出总是找不到用户。 这是ban命令的代码,unban命令的正确用法是什么 @commands.command(pass_context = True) @commands.has_permissions(ban_members=True) async def ban(self, ctx, member:discord.Member=None): """Bans a membe
ban(member)
,但是,除了使用unban(member)
外,执行相同操作时,输出总是找不到用户。
这是ban命令的代码,unban命令的正确用法是什么
@commands.command(pass_context = True)
@commands.has_permissions(ban_members=True)
async def ban(self, ctx, member:discord.Member=None):
"""Bans a member."""
if not member:
await self.bot.say("Who would you like me to ban, {0.mention}?".format(ctx.message.author))
pass
await self.bot.ban(member)
await self.bot.say(f"{member.mention} got banned, what a shame...")
print(colored('moderation.clf: ', 'blue'), colored('Banned member', 'white'))
由于成员代表服务器内的用户,因此不能为当前被禁止的用户提供成员实例。您必须使用非unban特定服务器的
User
实例,例如wait self.bot.unban(server,User)
,其中服务器类型为discord.server
和用户类型为discord.User
unban接受用户,而不是成员。这是因为当你禁止某人进入服务器时,他们不再是成员。您需要获取他们的用户
对象。好的!wait server\u voice\u状态(user=member,deafen=True)
和wait server\u voice\u状态(user=member,mute=True)
?没有用户
参数。它有一个成员
参数