如何获取 Python 的 discord 库中某个频道的 Webhook 的所有信息?

How can I get all the info of a Webhook of a channel in Python's discord library?

如何获取频道Webhook的所有信息?

我找到了 the API reference of the discord library。但我被困在开始阶段,不知道如何开始。我能得到一些帮助来找到开始的方法吗?

我不确定这是不是你想要的。

但是假设通道 'a' 中有一个 webhook。我们可以使用下面的代码。要检索链接到该特定频道的所有 webhook(当在频道 'a' 中调用此命令时):

@commands.command()
async def get_channel_webhooks(self, ctx):

    # Loops through every webhook linked to the channel
    for hook in await ctx.channel.webhooks():
        hook_channel_id = hook.channel_id
        await ctx.send(f"channel_id of hook: {hook_channel_id}")

当你读到这篇文章时documentation you will see what you can do with the webhook object. In the code previously shown. We used hook.channel_id to retrieve the channel_id the webhook is linked to. And ctx.channel.webhooks() to retrieve a full list of all webhooks linked to that channel (documentation)。

但您还可以获得以下信息:用户、url、姓名等(阅读 documentation 了解更多信息),