@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)
所以我试图让一个机器人可以通知我的线组每当有人加入语音信道我不和谐的服务器。 问题是,我的朋友经常玩我的机器人由离开和加入音频道屡和我的机器人将垃圾邮件在我的线组,如果有人加入语音通道。因此,我需要一个有助于使我的机器人才通知我的线组如果一个用户已经离开的声音频道于5分钟,参加再次要语音通道