Answer the question
In order to leave comments, you need to log in
Creating webhooks in discord.py?
It may be easy, but I can't write a command in which the bot creates a webhook.
I took the code from the official discord.py documentation.
It just gives me an error, here is the code
@bot.command()
async def webhookcreate(ctx):
await create_webhook(name)
Ignoring exception in command webhookcreate:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\discord\ext\commands\core.py", line 85, in wrapped
ret = await coro(*args, **kwargs)
File "C:\скрытая папка\ттттт\bot\main.py", line 285, in webhookcreate
await create_webhook(name)
NameError: name 'create_webhook' is not defined
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
File "C:\Users\user\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\discord\ext\commands\bot.py", line 903, in invoke
await ctx.command.invoke(ctx)
File "C:\Users\user\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\site-packages\discord\ext\commands\core.py", line 859, in invoke
await injected(*ctx.args, **ctx.kwargs)
File "C:\Users\user\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.8_qbz5n2kfra8p0\LocalCache\local-packages\Python38\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: NameError: name 'create_webhook' is not defined
Answer the question
In order to leave comments, you need to log in
@bot.command(pass_context=True)
async def webhookcreate(ctx, *, arg):
await ctx.channel.create_webhook(name= arg )
await ctx.author.send("Webhook created!")
await ctx.author.send ("How to give the webhook url I xs, I don't understand anything in Python, I even had to ask to solve the problem")
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question