@client.event
async def on_voice_state_update(member, before, after):
# This function is called when not only member join to the voice channel,
# but also member changed their status to mute.
# So, it is necessary to catch only events that joining channel.
if before.channel != after.channel:
if after.channel is not None and after.channel.id == int(VOICE_CHANNEL_ID1):
_name = member.nick if member.nick else member.name
message = {
"message": "\n" + _name + " Join The Livestream Channel"
}
requests.post(LINE_NOTIFY_API_URL, headers=HEADERS, data=message)
if before.channel != after.channel:
if after.channel is not None and after.channel.id == int(VOICE_CHANNEL_ID2):
_name = member.nick if member.nick else member.name
message = {
"message": "\n" + _name + " Join The Nongskuy Channel"
}
requests.post(LINE_NOTIFY_API_URL, headers=HEADERS, data=message)
client.run(DISCORD_BOT_ACCESS_TOKEN)
así que estoy tratando de hacer un bot que puede notificar a mi grupo de LÍNEA cada vez que alguien unirse canal de voz en mi discordia servidor. El problema es que mi amigo a veces, jugar con mi bot por salir y unirse a el canal de voz repeatly y mi bot de spam en mi LÍNEA de grupo si alguien unirse al canal de voz.Así, necesito una ayuda para hacer mi bot sólo notificar a mi grupo de LÍNEA si un usuario ya está dejando canal de voz durante 5 minutos y unirse de nuevo al canal de voz