@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)
então, eu estou tentando fazer um bot que pode notificar a minha LINHA de grupo sempre que alguém aderir canal de voz em minha discórdia servidor. O problema é, meu amigo, muitas vezes, de jogar com o meu bot por sair e se juntar o canal de voz repeatly e meu bot irá spam no meu grupo de LINHA se alguém juntar o canal de voz.Então, eu preciso de uma ajuda para fazer o meu bot apenas notificar a minha LINHA de grupo, se um usuário já está deixando de canal de voz por 5 minutos e juntar novamente para o canal de voz