【发布时间】:2021-11-24 03:11:34
【问题描述】:
@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)
所以我正在尝试制作一个机器人,当有人加入我的不和谐服务器中的语音频道时,它可以通知我的 LINE 组。问题是,我的朋友经常通过反复离开和加入语音频道来玩我的机器人,如果有人加入语音频道,我的机器人会在我的 LINE 组中发送垃圾邮件。所以,我需要帮助让我的机器人只通知我的 LINE 组如果用户已经离开语音频道 5 分钟并再次加入语音频道
【问题讨论】:
标签: discord