When I try to run the command I always get this error message: SyntaxError: 'await' outside function Very simple mistake probably, but I really don't see the mistake in it. Can anyone help?
@commands.command()
async def unban(ctx, *, member):
banned_users = await ctx.guild.bans()
member_name, member_discriminator = member.split('#')
for ban_entry in banned_users:
user = ban_entry.user
if (user.name, user.discriminator) == (member_name, member_discriminator):
await ctx.guild.unban(user)
await ctx.send(f'Unbanned {user.mention}')
return
discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.unban' raised an error: SyntaxError: 'await' outside function (unban.py, line 20)
Aucun commentaire:
Enregistrer un commentaire