Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

点击“清体力”功能,任务完成后发送通知 #234

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions tasks/power/power.py
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
from module.notification import notif
from module.screen import screen
from module.automation import auto
from module.logger import log
from module.config import cfg
from tasks.power.instance import Instance
import time

from utils.date import Date


class Power:
@staticmethod
Expand All @@ -26,6 +29,17 @@ def run():
else:
Power.process_standard(instance_type, instance_name, power)

def get_wait_time(current_power):
# 距离体力到达240上限剩余秒数
wait_time_power_full = (240 - current_power) * 6 * 60
return wait_time_power_full

current_power = Power.get()

wait_time = get_wait_time(current_power)
future_time = Date.calculate_future_time(wait_time)
log.info(cfg.notify_template['FullTime'].format(power=current_power, time=future_time))
notif.notify(cfg.notify_template['FullTime'].format(power=current_power, time=future_time))
log.hr("完成", 2)

@staticmethod
Expand Down
Loading