Discord.py |加入公会后,如何使bot标签成为公会的所有者?

时间:2020-07-28 19:39:10

标签: python python-3.x discord discord.py discord.py-rewrite

我的代码:

@commands.Cog.listener()
async def on_guild_join(self, guild):
    general = find(lambda x: x.name == "general", guild.text_channels)
    if general and general.permissions_for(guild.me).send_messages:
        await general.send(f"Beep Boop. I've hopped on the server! {guild.owner}, "
                           f"it is advised that you run `.setup` command")

加入公会后,机器人会说:Beep Boop. I've hopped on the server! foobar#1234, it is advised that you run .setup command Foobar#1234在这种情况下是公会的所有者。我也尝试在{guild.owner}之前添加@,这样看起来就像

await general.send(f"Beep Boop. I've hopped on the server! @{guild.owner}, "
                   f"it is advised that you run `.setup` command")

它实际上没有标记公会的所有者。这可能吗?

1 个答案:

答案 0 :(得分:3)

您可以使用guild.owner.mention