【发布时间】:2021-01-09 23:57:25
【问题描述】:
我目前正在制作一个不和谐机器人,并希望在服务器加入时在#general 频道中发送消息,这是我目前拥有的代码。
async def on_guild_join(guild):
general = find(lambda x: x.name == 'general', guild.text_channels)
if general and general.permissions_for(guild.me).send_messages:
embed=discord.Embed(title="**======== *Thanks For Adding Me!* ========**", description=f"""
Thanks for adding me to {guild.name}!
You can use the `--help` command to get started!
""", color=0xd89522)
await general.send(embed=embed)
当我运行这段代码时,注意到发生了。我没有得到任何错误或输出。
如果有人可以提供帮助,那就太好了。谢谢!
【问题讨论】:
-
这能回答你的问题吗? Send a message when the bot joins a server
标签: python discord.py