@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)
ดังนั้นฉันกำลังพยายามทำ bot ที่สามารถแจ้งให้ทราบของเส้นกลุ่มเมื่อไรก็ตามที่มีคนเข้าร่วมกันเสียงช่องในของฉัน discord เซิร์ฟเวอร์ ปัญหาคือเพื่อนฉันบ่อยแค่เล่นกับของฉัน bot เดินออกไปและเข้าร่วมกับเสียงของช่อง repeatly และของฉัน bot จะ spamming อยู่ในเส้นกลุ่มถ้าใครซักคนเข้าร่วมกับเสียงของช่องดังนั้นฉันต้องการช่วยเพื่อทำให้ฉัน bot เดียวที่แจ้งให้ทราบของเส้นกลุ่มถ้าเป็นของผู้ใช้แล้วทิ้งเสียงช่องสำหรับ 5 นาทีและเข้าร่วมกันอีกครั้ต้องเสียงช่อง