diff options
| -rw-r--r-- | ircbot/main.py | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/ircbot/main.py b/ircbot/main.py index 8d59037..a7c8c3a 100644 --- a/ircbot/main.py +++ b/ircbot/main.py @@ -72,14 +72,23 @@ def memo_cmd(chan, sender, args): save_memos() return '已留言' +meetlink = dict() +meettime = dict() + @command("meet") def meet_cmd(chan, sender, args): - data_to_hash = SERVER + chan + '#' + str(int(time.time()) // 120) + if chan in meetlink and chan in meettime: + if time.time() - meettime[chan] < 120: + return meetlink[chan] + data_to_hash = SERVER + chan + '#' + str(time.time()) data_bytes = data_to_hash.encode('utf-8') hash_object = hashlib.sha256() hash_object.update(data_bytes) hex_digest = hash_object.hexdigest() - return '加入会议: https://meet.jit.si/' + hex_digest[:24] + '#config.startWithVideoMuted=true' + link = '加入会议: https://meet.jit.si/' + hex_digest[:24] + '#config.startWithVideoMuted=true' + meetlink[chan] = link + meettime[chan] = time.time() + return link @command("log") def log_command(chan, sender, args): |
