1
0
mirror of https://github.com/Oreomeow/VIP.git synced 2026-06-17 07:27:02 +08:00

♻️ 'Refactored by Sourcery' (#14)

Co-authored-by: Sourcery AI <>
This commit is contained in:
sourcery-ai[bot]
2022-10-08 14:43:43 +08:00
committed by GitHub
parent 3cc4a1bc0f
commit 6f437ddef5
17 changed files with 232 additions and 298 deletions

View File

@@ -70,16 +70,11 @@ if (
QQ_SKEY = os.environ["QQ_SKEY"]
QQ_MODE = os.environ["QQ_MODE"]
# 获取pushplus+ PUSH_PLUS_TOKEN
if "PUSH_PLUS_TOKEN" in os.environ:
if len(os.environ["PUSH_PLUS_TOKEN"]) > 1:
PUSH_PLUS_TOKEN = os.environ["PUSH_PLUS_TOKEN"]
# print("已获取并使用Env环境 PUSH_PLUS_TOKEN")
if "PUSH_PLUS_TOKEN" in os.environ and len(os.environ["PUSH_PLUS_TOKEN"]) > 1:
PUSH_PLUS_TOKEN = os.environ["PUSH_PLUS_TOKEN"]
# 获取企业微信应用推送 QYWX_AM
if "QYWX_AM" in os.environ:
if len(os.environ["QYWX_AM"]) > 1:
QYWX_AM = os.environ["QYWX_AM"]
# print("已获取并使用Env环境 QYWX_AM")
if "QYWX_AM" in os.environ and len(os.environ["QYWX_AM"]) > 1:
QYWX_AM = os.environ["QYWX_AM"]
if BARK:
notify_mode.append("bark")
# print("BARK 推送打开")
@@ -107,7 +102,7 @@ if QYWX_AM:
def message(str_msg):
global message_info
print(str_msg)
message_info = "{}\n{}".format(message_info, str_msg)
message_info = f"{message_info}\n{str_msg}"
sys.stdout.flush()
@@ -171,7 +166,7 @@ def telegram_bot(title, content):
}
proxies = None
if TG_PROXY_IP and TG_PROXY_PORT:
proxyStr = "http://{}:{}".format(TG_PROXY_IP, TG_PROXY_PORT)
proxyStr = f"http://{TG_PROXY_IP}:{TG_PROXY_PORT}"
proxies = {"http": proxyStr, "https": proxyStr}
try:
response = requests.post(
@@ -190,7 +185,7 @@ def telegram_bot(title, content):
def dingding_bot(title, content):
timestamp = str(round(time.time() * 1000)) # 时间戳
secret_enc = DD_BOT_SECRET.encode("utf-8")
string_to_sign = "{}\n{}".format(timestamp, DD_BOT_SECRET)
string_to_sign = f"{timestamp}\n{DD_BOT_SECRET}"
string_to_sign_enc = string_to_sign.encode("utf-8")
hmac_code = hmac.new(
secret_enc, string_to_sign_enc, digestmod=hashlib.sha256