Reputation: 1
#help command
@client.command()
async def help(prefix, ctx, type_help = "None"):
author = ctx.message.author
if type_help == "None":
embed = discord.Embed(title = "Help Command", value = "Welcome to the Help Command. Look at the various categories the bot has to offer! If there is a <> it is optional! Also if there is a [], that is required. This bot is made by ! bobthefam#6969", color=discord.Colour.blue())
embed.add_field(name = f"``{prefix}polls``", value = "", inline = False)
else:
embed = discord.Embed(title = "Oops", description = "I think you may have misspelled something. Try again")
await ctx.channel.send(author, embed = embed)
I get the error in the title. How can I fix this?
Upvotes: 0
Views: 687
Reputation: 682
from this page you can see that the actually function doesn't take prefix it's the command that does.
Your code should be has follow:
client = commands.Bot(command_prefix='!')
@client.command() # !help for invoke the command
async def help(ctx, type_help = "None"):
author = ctx.message.author
[...]
from the documentation you can make a dynamic prefix by using a callable (just a nice way to say a function ;) ) for the command_prefix variable
something like this I guess:
def my_custom_prefix(bot, message):
# bot.commands contain all available commands
matching_command = [command.name for command in bot.commands if command.name in message]
if matching_command:
return message.split(matching_command[0])[0]
return "!" # I guess you need a default prefix in case
client = commands.Bot(command_prefix=my_custom_prefix, case_insensitive=True)
@client.command() # {whatever_you_want_by_default_!}help for invoke the command
async def help(ctx, type_help = "None"):
author = ctx.message.author
[...]
Upvotes: 1