Discord.py |我怎样才能让机器人在加入公会时标记公会的所有者?
Discord.py | How can I make the bot tag the owner of the guild on joining the guild?
我的代码:
@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")
它实际上并没有标记公会的所有者。这可能吗?
您可以使用 guild.owner.mention
.
我的代码:
@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")
它实际上并没有标记公会的所有者。这可能吗?
您可以使用 guild.owner.mention
.