如果有人加入特定的语音频道,请在特定的“日志频道”中通知

时间:2021-04-26 19:47:10

标签: python discord discord.py

请帮帮我 我尝试了很多,但它不起作用

@bot.event
async def on_voice_state_update(member, before, after):
    notifchannel = 702241043810353332
    channel = before.channel or after.channel
    if channel.id == 677216062013440030:
        if before.channel is None and after.channel is not None:
            await notifchannel.send("...")
    

1 个答案:

答案 0 :(得分:0)

您需要通过

获取频道对象
notifchannel = member.guild.get_channel(702241043810353332)

而不是在频道 ID 上调用函数 send()