Answer the question
In order to leave comments, you need to log in
Error in Discord.py bot command?
@Bot.command()
TypeError: command() missing 1 required positional argument: 'self'.
Tell me how to fix the error, code:
@Bot.command()
@commands.has_permissions(administrator = True)
async def mute(ctx, member: discord.Member, time: int, reason):
await ctx.channel.purge(limit = 1)
muterole = discord.utils.get(ctx.guild.roles, id = 807889764539826216)
emb = discord.Embed(title = "Mute", color = "ff0d0d")
emb.add_field(name = "Administrator", value = ctx.message.author.mention, inline = False)
emb.add_field(name = "User", value = member.mention, inline = False)
emb.add_field(name = "Reason", value = reason, inline = False)
emb.add_field(name = "Time", value = time, inline = False)
await member.add_roles(muterole)
await ctx.send(embed = emb)
Answer the question
In order to leave comments, you need to log in
You are trying to call a method command
on a class, not on an object.
Most likely, at the moment you have:
from discord.ext.commands import Bot
@Bot.command()
async def cmd(...):
...
from discord.ext.commands import Bot
bot = Bot(...)
@bot.command()
async def cmd(...)
...
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question