하는 방법을 불화 로봇만 나에게 통지할 경우 참가하는 사용자의 음성 채널이 이미 떠나는 음성 채널을 5 분 이상기

0

질문

@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)

그래서 내가 만들려고 할 수있는 로봇에게 통지 라인 그룹을 때마다 누군가가 참 음성 채널에서 내 불화 서버입니다. 문제,나의 친구는 종종 재료 로봇을 떠나기로 합류한 음성 채널 repeatly 및 내 로봇이 스팸 메일에 나선 그룹의 누군가가 참 음성 채널입니다.그래서 저는 필요한 도움을 로봇만을 알리 나의 라인 그룹을 경우에는 사용자가 이미 떠나는 음성 채널을 5 분간 가시성 채널

discord
2021-11-23 15:55:57
1

최고의 응답

0

그것은 당신이 본질적으로 원하는지 확인하려면 5,또는 더 분야 간에 전달되는 각 음성 채널을 떠나/에 가입하는 사용자. 사용할 수 있습니다 datetime 모듈의 시간을 사용자가 합류하고 왼쪽 채널입니다. 을 얻는 방법 현재시간에서는 파이썬. 일단 당신이 시간을 얻을,당신이 얻을 수 있는 분의 시간을 다음과 같다:

>>> now = datetime.now()
>>> print(now)
2021-11-23 14:05:31.787939
>>> print(now.minute)
5

할 수 있도록 상점 now.minute 에서 또 다른 변수를 사용에 대한 비교니다.

2021-11-23 19:11:34

다른 언어로

이 페이지는 다른 언어로되어 있습니다

Русский
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................