Reputation: 13
I not sure what I've done wrong here and getting this error:
Traceback (most recent call last):
File "main.py", line 23, in <module>
@client.commands() TypeError: 'set' object is not callable
Here's my code:
import discord
import random
import os
from discord.ext import commands
my_secret = os.environ['Token']
client = commands.Bot(command_prefix = '?')
@client.event
async def on_ready():
print('Bot is ready.')
@client.command()
async def kick(ctx, member : discord.Member, *, reason=None):
await member.kick(reason=reason)
@client.command()
async def ban(ctx, member : discord.Member, *, reason=None):
await member.ban(reason=reason)
await ctx.send(f'Banned {member.mention}')
@client.commands()
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
client.run(os.environ['Token'])
Upvotes: 0
Views: 961
Reputation: 15361
There seems to be a typo in
@client.commands()
async def unban(ctx, *, member):
should be
@client.command()
async def unban(ctx, *, member):
Upvotes: 1