Skip to content

Commit

Permalink
Update login_script.py
Browse files Browse the repository at this point in the history
修改telegram通知格式
  • Loading branch information
yixiu001 authored Jul 9, 2024
1 parent d1faa42 commit e89abeb
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions login_script.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ async def delay_time(ms):
# 全局浏览器实例
browser = None

# telegram消息
message = 'serv00&ct8自动化脚本运行\n'

async def login(username, password, panel):
global browser

Expand Down Expand Up @@ -81,15 +84,17 @@ async def main():
now_utc = format_to_iso(datetime.utcnow())
now_beijing = format_to_iso(datetime.utcnow() + timedelta(hours=8))
success_message = f'{serviceName}账号 {username} 于北京时间 {now_beijing}(UTC时间 {now_utc})登录成功!'

message += success_message + '\n'
print(success_message)
send_telegram_message(success_message)
else:
message += f'{serviceName}账号 {username} 登录失败,请检查{serviceName}账号和密码是否正确。\n'
print(f'{serviceName}账号 {username} 登录失败,请检查{serviceName}账号和密码是否正确。')

delay = random.randint(1000, 8000)
await delay_time(delay)


message += '所有{serviceName}账号登录完成!'
send_telegram_message(message)
print('所有{serviceName}账号登录完成!')

# 发送Telegram消息
Expand Down

0 comments on commit e89abeb

Please sign in to comment.