我需要做到这一点,以便当bot加入新服务器时,它将特定消息写入第一个文本通道。
我试图做某事:
@bot.event
async def on_guild_join(guild):
print("Join to " + guild.name)
guild_to_audiocontroller[guild] = AudioController(bot, guild)
await guild_to_audiocontroller[guild].register_voice_channel(guild.voice_channels[0])
for guild in bot.guilds:
await guild.text_channels[0].send(join_message)
但是它不想工作,我该怎么办?
答案 0 :(得分:1)
只要您的漫游器具有Send Messages
权限,您只需在加入时发送消息就可以:
@bot.event
async def on_guild_join(guild):
await guild.text_channels[0].send("I have joined the server")