我如何使用 discord.py 重写来制作一个 Discord 机器人,它可以使机器人用户不是真实的

How do I make a Discord bot using discord.py rewrite that can make bot users that are not real

我见过几个让机器人成为用户的机器人

一个叫 BetterCensoring 的机器人做到了

It looked like this

有人知道怎么做吗?

我曾多次尝试寻找答案,但找不到任何答案。

这样的东西不是通过实际创建一个新用户帐户来实现的,而是使用 webhook. The send 方法可以自定义 username消息的头像

使用 await channel.create_webhook()

最容易创建 Webhook

请注意,一个公会一次只能有 10 个 webhook,这就是为什么大多数使用此功能的机器人都会创建一个 webhook,用它发送一条消息,然后立即将其删除。

示例(重新创建爬行审查):

async def on_message(message):
    if message.content.startswith('bad word'):
        webhook = await message.channel.create_webhook()
        await webhook.send('####', username='Creeper', avatar_url='this is an url leading to the creeper image')
        await webhook.delete()