From ff9d8bfd1a85d360fded824d1996bb5232b1660d Mon Sep 17 00:00:00 2001 From: GamerNoTitle Date: Sun, 22 Nov 2020 10:05:22 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=BC=A0=E5=8F=82=E6=96=B9?= =?UTF-8?q?=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/AutoSignin.yml | 6 +----- main.py | 23 ++++++++++------------- 2 files changed, 11 insertions(+), 18 deletions(-) diff --git a/.github/workflows/AutoSignin.yml b/.github/workflows/AutoSignin.yml index df6976a..ababaaa 100644 --- a/.github/workflows/AutoSignin.yml +++ b/.github/workflows/AutoSignin.yml @@ -27,13 +27,9 @@ jobs: - name: Install requirements #安装轮子 run: | pip install -r requirements.txt - - name: set var - run: | - echo ${{ secrets.teleid }} > teleid.txt - echo ${{ secrets.teletoken }} > teletoken.txt - name: Run script run: | - python3 main.py ${{ secrets.cookie }} + python3 main.py "${{ secrets.cookie }}" "${{ secrets.teleid }}" "${{ secrets.teletoken }}" - name: remove var run: | rm cookie.txt diff --git a/main.py b/main.py index 274bcd6..0c9f6f9 100644 --- a/main.py +++ b/main.py @@ -19,20 +19,17 @@ teletoken='' # except Exception as e: # print('[网易云游戏自动签到]无法读取Cookie,回显为\n{}'.format(e)) # sys.exit() - -cookie=sys.argv[1] - -try: - with open('teleid.txt','r') as f: - teleid=f.read() - f.close() - - with open('teletoken.txt','r') as f: - teletoken=f.read() - f.close +if len(sys.argv)==1: + print('[网易云游戏自动签到]未设置cookie,正在退出……') +elif len(sys.argv)==2: + cookie=sys.argv[1] + teleid=0 + teletoken='' +elif len(sys.argv)==4: + cookie=sys.argv[1] + teleid=sys.argv[2] + teletoken=sys.argv[3] tele_enable=True -except: - tele_enable=False if tele_enable: bot=telepot.Bot(teletoken)