Skip to content

Commit

Permalink
[feat] fix weekend.
Browse files Browse the repository at this point in the history
  • Loading branch information
yin8086 committed Sep 12, 2024
1 parent b5d7526 commit b952956
Show file tree
Hide file tree
Showing 3 changed files with 23 additions and 4 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/default.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
name: Run Your Python Script

on:
push:
branches:
- main
#push:
# branches:
# - main
schedule:
- cron: '6 2 * * *' # 在北京时间上午10点6分运行(+8)
- cron: '6 6 * * *' # 在北京时间上午14点6分运行(+8)
Expand Down
20 changes: 19 additions & 1 deletion py.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import base64
import random
from datetime import datetime, time, timezone

import pytz

telegram_api_token = os.environ.get('TELEGRAM_API_TOKEN')
telegram_chat_id = os.environ.get('TELEGRAM_CHAT_ID')
Expand All @@ -14,6 +14,20 @@
change_step4 = int(os.environ.get('CHANGE_STEP4'))
target_step = int(os.environ.get('TARGET_STEP'))

# 定义你想要的时区(比如,'Asia/Shanghai' 表示上海时间)
timezone_name = 'Asia/Shanghai'
timezone = pytz.timezone(timezone_name)

# 获取当前时间并转换为指定时区的时间
current_time_in_timezone = datetime.now(timezone)

# 获取星期几(0表示星期一,6表示星期日)
weekday_number = current_time_in_timezone.weekday()

# 将数字转换为星期几的名称
weekdays = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
weekday_name = weekdays[weekday_number]

# 检查 Telegram 相关信息是否存在
if telegram_api_token is None or telegram_chat_id is None:
print("Telegram API Token或聊天ID未设置。无法发送通知。")
Expand Down Expand Up @@ -95,6 +109,10 @@ def modify_steps(account, password, min_steps=None, max_steps=None, attempts=3,
min_steps = target_step - 16
max_steps = target_step + 22

if (weekday_number == 5 or weekday_number == 6) :
min_steps = min_steps + 2000
max_steps = max_steps + 2000

for account, password in account_password_pairs:
result = modify_steps(account, password, min_steps, max_steps)
hidden_account = account[:3] + '*' * (len(account) - 6) + account[-3:]
Expand Down
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
requests
pytz

0 comments on commit b952956

Please sign in to comment.