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?
import discord
from discord.ext import commands
class unban(commands.Cog):
def __init__(self, client):
self.client = client
# Commandok
@commands.command()
async def unban(ctx, *, member): # unindent
banned_users = await ctx.guild.bans() # unindent
member_name, member_discriminator = member.split('#') # unindent
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
def setup(client):
client.add_cog(unban(client))
discord.ext.commands.errors.ExtensionFailed: Extension 'cogs.unban' raised an error: TypeError: cogs must derive from Cog sys:1: RuntimeWarning: coroutine 'Command.call' was never awaited