From 79cec13090c01982a013791c8f6890674bc89cbc Mon Sep 17 00:00:00 2001 From: Tokisaki-Galaxy Date: Mon, 25 Jan 2021 12:11:00 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E5=85=A5=E9=85=B7Q=E6=8E=A8=E9=80=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- main.py | 34 ++++++++++++++++++++++++++-------- 1 file changed, 26 insertions(+), 8 deletions(-) diff --git a/main.py b/main.py index 7c696e6..1a58e76 100644 --- a/main.py +++ b/main.py @@ -5,24 +5,28 @@ import telepot tele_enable = False sc_enable = False +qq_enable = False sign_url = 'https://n.cg.163.com/api/v2/sign-today' current = 'https://n.cg.163.com/api/v2/client-settings/@current' cookies = sys.argv[1].split('#') -teleid = sys.argv[2] -teletoken = sys.argv[3] -sckey = sys.argv[4] +switchpush = sys.argv[2] +pushkey = sys.argv[3] +teleid = sys.argv[3] +teletoken = sys.argv[4] if cookies == "": print('[网易云游戏自动签到]未设置cookie,正在退出……') sys.exit() -if teleid != "" and teletoken != "": +if switchpush == "1": #微信推送 + sc_enable = True +elif switchpush == "2": #qq推送 + qq_enable = True +elif switchpush == "3": #telegram推送 tele_enable = True bot = telepot.Bot(teletoken) -if sckey != "": - sc_enable = True - + class Error(Exception): pass @@ -80,6 +84,11 @@ def scsend(SCKEY, message): sc_url = 'http://sc.ftqq.com/{}.send?text=网易云游戏自动签到脚本&desp={}'.format(SCKEY, message) if sc_enable: r.get(url=sc_url) + +def qqsend(QQKEY, message): + qq_url = 'https://push.xuthus.cc/send/{}?c=网易云游戏自动签到脚本\n{}'.format(QQKEY, message) + if qq_enable: + r.get(url=qq_url) if __name__ == "__main__": @@ -145,9 +154,18 @@ if __name__ == "__main__": GamerNoTitle: https://bili33.top 网易云游戏自动签到脚本: https://github.com/GamerNoTitle/wyycg-autocheckin '''.format(len(success), len(failure), len(cookies), outputmsg) + qqinfomsg = ''' + 感谢使用来自bili33.top GamerNoTitle的网易云游戏自动签到脚本 + 今日签到结果如下: + 成功数量:{0}-{2} + 失败数量:{1}-{2} + 具体情况如下: + {3} + '''.format(len(success), len(failure), len(cookies), outputmsg) - scsend(sckey, scinfomsg) send(teleid, teleinfomsg) + scsend(pushkey, scinfomsg) + qqsend(pushkey, qqinfomsg) print(teleinfomsg) if (len(failure) != 0): raise Error