PagerMaid_Plugins/telegram_update.py
Xtao_dada 2b5987ec68
📦 xtao-some : 修改 pixiv 反代 api , 优化逻辑 , 提醒 (#66)
* 👷 更新 CI 通知范围

* 👷 修改提醒间隔时间

* 📦 修改 pixiv 反代 api , 优化逻辑 , 提醒

* Update list.json
2020-11-08 00:17:37 +08:00

26 lines
920 B
Python
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

import json, time, sys
from requests import get, post
token = str(sys.argv[1])
main = json.loads(get("https://api.github.com/repos/xtaodada/PagerMaid_Plugins/commits/master").content)
push_content = {}
push_content['chat_id'] = '-1001441461877'
push_content['disable_web_page_preview'] = 'True'
push_content['parse_mode'] = 'markdown'
push_content['text'] = "#更新日志 #" + main['commit']['author'][
'name'] + ' \n\n🔨 [' + main['sha'][0:7] + '](https://github.com/xtaodada/PagerMaid_Plugins/compare/' + \
main[
'sha'] + '): ' + main['commit']['message']
url = 'https://api.telegram.org/bot' + token + '/sendMessage'
try:
main_req = post(url, data=push_content)
except:
pass
push_content['chat_id'] = '-1001319957857'
time.sleep(1)
try:
main_req = get(url, data=push_content)
except:
pass
print(main['sha'] + " ok")