我想为我的私人服务器创建一个命令,在所有公会的频道中创建 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:Command引发异常:TypeError:create_webhook()需要1个位置参数,但给出了2个
答案 0 :(得分:0)
好的,我自己解决了这个问题,如果你想知道我是怎么做到的,我只需要把这个:
except AttributeError:
pass