So I've tried to do this simple poll function using python for my discord bot:
@command(name="makePoll")
@has_permissions(manage_guild=True)
async def createPoll(self, ctx, question, *options):
if len(options) > 10:
await ctx.send("You can only supply a maximum of 10 options.")
else:
embed = Embed(title="Poll",
description=question,
colour=ctx.author.colour,
timestamp=datetime.utcnow())
fields = [("Options", "\n".join([f"{numbers[idx]} {options}" for idx, option in enumerate(options)]), False),
("Instructions", "React to case a vote!", False)]
for name, value, inline in fields:
embed.add_field(name=name, value=value, inline=inline)
await ctx.send(embed=embed)
And the problem is that it throws me an error when I try to call the function. The error:Ignoring exception in command None: discord.ext.commands.errors.CommandNotFound: Command "makePoll" is not found.
edit: tried to name client.command makepoll but know it gives me this error:Ignoring exception in command makePoll: Traceback (most recent call last): File "F:\first try on python\venv\lib\site-packages\discord\ext\commands\core.py", line 85, in wrapped ret = await coro(*args, **kwargs) File "F:/first try on python/for loop/bot1.py", line 40, in createPoll colour=ctx.author.colour, AttributeError: 'str' object has no attribute 'author'
The above exception was the direct cause of the following exception:
Traceback (most recent call last): File "F:\first try on python\venv\lib\site-packages\discord\ext\commands\bot.py", line 903, in invoke await ctx.command.invoke(ctx) File "F:\first try on python\venv\lib\site-packages\discord\ext\commands\core.py", line 859, in invoke await injected(*ctx.args, **ctx.kwargs) File "F:\first try on python\venv\lib\site-packages\discord\ext\commands\core.py", line 94, in wrapped raise CommandInvokeError(exc) from exc discord.ext.commands.errors.CommandInvokeError: Command raised an exception: AttributeError: 'str' object has no attribute 'author'
@client.command(name="makePoll")
instead of@command(name="makePoll")
? – Nurqmcommands.command(name='makepool')
. – Nurqm