discord.py,使用 webhook 在所有频道中发送消息

discord.py, sending a message in all channels with a webhook

我想为我的私人服务器创建一个命令,在所有公会的频道中创建 webhooks 并让他们发送消息,我已经尝试过这样:

@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")

但它说:discord.ext.commands.errors.CommandInvokeError:命令引发异常:TypeError:create_webhook() 接受 1 个位置参数,但给出了 2 个

好的,我自己解决了这个问题,如果你想知道我是怎么做到的,我只需要把这个:

except AttributeError:
            pass