From 9de2c867dcd1b8833340fecb8bfb00996d7678c7 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Sun, 3 Oct 2021 11:25:03 +0800 Subject: [PATCH] =?UTF-8?q?autochangename=20=E4=BF=AE=E5=A4=8D=E6=97=B6?= =?UTF-8?q?=E9=97=B4=E9=94=99=E8=AF=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- autochangename.py | 8 ++++---- list.json | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/autochangename.py b/autochangename.py index d7c837d..725e90a 100644 --- a/autochangename.py +++ b/autochangename.py @@ -1,8 +1,7 @@ """ Module to automate message deletion. """ -from asyncio import sleep -import time import random -from time import strftime +from asyncio import sleep +from datetime import datetime, timedelta, timezone from telethon.tl.functions.account import UpdateProfileRequest from emoji import emojize from pagermaid import bot, log @@ -27,7 +26,8 @@ async def change_name_auto(context): await log("开始每 30 秒更新一次 last_name") while True: try: - time_cur = strftime("%H:%M:%S:%p:%a", time.localtime()) + time_cur = datetime.utcnow().replace(tzinfo=timezone.utc).astimezone(timezone( + timedelta(hours=8))).strftime('%H:%M:%S:%p:%a') hour, minu, seco, p, abbwn = time_cur.split(':') if seco == '00' or seco == '30': shift = 0 diff --git a/list.json b/list.json index 003104d..36b3bd0 100644 --- a/list.json +++ b/list.json @@ -22,7 +22,7 @@ }, { "name": "autochangename", - "version": "1.1", + "version": "1.11", "section": "profile", "maintainer": "xtaodada", "size": "2.1 kb",