I wanted to make a command for my private server, that creates webhooks in all guild's channels and makes them send a message, I already tried to make it like this:
@client.command()
async def allchannel(ctx):
for channel in ctx.guild.channels:
webhook = discord.utils.get(await ctx.channel.webhooks())
if not webhook:
webhook = await ctx.channel.create_webhook("Test")
await webhook.send(content="Hello")
But it says: discord.ext.commands.errors.CommandInvokeError: Command raised an exception: TypeError: create_webhook() takes 1 positional argument but 2 were given
Ok, I solved the problem myself, If you want to know how I did it, I just had to put this:
except AttributeError:
pass
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.