autochangename 修复时间错误

This commit is contained in:
xtaodada 2021-10-03 11:25:03 +08:00
parent 0dffb55978
commit 9de2c867dc
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736
2 changed files with 5 additions and 5 deletions

View File

@ -1,8 +1,7 @@
""" Module to automate message deletion. """ """ Module to automate message deletion. """
from asyncio import sleep
import time
import random import random
from time import strftime from asyncio import sleep
from datetime import datetime, timedelta, timezone
from telethon.tl.functions.account import UpdateProfileRequest from telethon.tl.functions.account import UpdateProfileRequest
from emoji import emojize from emoji import emojize
from pagermaid import bot, log from pagermaid import bot, log
@ -27,7 +26,8 @@ async def change_name_auto(context):
await log("开始每 30 秒更新一次 last_name") await log("开始每 30 秒更新一次 last_name")
while True: while True:
try: 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(':') hour, minu, seco, p, abbwn = time_cur.split(':')
if seco == '00' or seco == '30': if seco == '00' or seco == '30':
shift = 0 shift = 0

View File

@ -22,7 +22,7 @@
}, },
{ {
"name": "autochangename", "name": "autochangename",
"version": "1.1", "version": "1.11",
"section": "profile", "section": "profile",
"maintainer": "xtaodada", "maintainer": "xtaodada",
"size": "2.1 kb", "size": "2.1 kb",