Discord.py |加入公会时,如何让机器人标签成为公会所有者?

2024-10-02 16:28:29 发布

您现在位置:Python中文网/ 问答频道 /正文

我的代码:

@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是公会的所有者。我也尝试过添加@before{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")

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


Tags: thesendthatserverisonveit