diff --git a/.github/workflows/checkin.yml b/.github/workflows/checkin.yml index badbc21..d00aceb 100644 --- a/.github/workflows/checkin.yml +++ b/.github/workflows/checkin.yml @@ -26,6 +26,7 @@ jobs: PICA_PASSWORD: ${{ secrets.PICA_PASSWORD }} TG_BOT_TOKEN: ${{ secrets.TG_BOT_TOKEN }} TG_USER_ID: ${{ secrets.TG_USER_ID }} + SERVERPUSHKEY: ${{ secrets.SERVERPUSHKEY }} steps: - name: Checkout repo @@ -50,3 +51,5 @@ jobs: - name: Check-in run: python ./message.py + + diff --git a/README.md b/README.md index fd13cce..4ca8c0a 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ GitHub issues

-使用 Github Action 签到,用哪个就配置相应的环境变量,默认输出到控制台,支持 Telegram 消息推送。 +使用 Github Action 签到,用哪个就配置相应的环境变量,默认输出到控制台,支持 Telegram 和 Server酱 消息推送。 ## 说明 @@ -18,6 +18,7 @@ - [x] yamibo 论坛(对象) - [x] yurifans 论坛(积分) - [x] telegram-bot 推送 +- [x] Server酱 推送 - [ ] ff14 (积分)【修复中】 - [ ] 哔咔漫画打卡(哔咔)【未验证】 @@ -59,6 +60,12 @@ Telegram 推送签到结果 | TG_BOT_TOKEN | bot token | [How Do I Create a Bot?](https://core.telegram.org/bots#how-do-i-create-a-bot) | | TG_USER_ID | user id | [How can I send a message to someone with my telegram bot using their Username](https://stackoverflow.com/questions/41664810/how-can-i-send-a-message-to-someone-with-my-telegram-bot-using-their-username) | +### Server酱 推送 + +| Name | Description | How to | +|---------------|-------------|-------------------------------------------------------| +| SERVERPUSHKEY | SendKey | [Server酱官网](https://sct.ftqq.com/) 获取 SendKey 密钥 | + ### V2EX V2EX 论坛使用 Cookie 登录 diff --git a/message.py b/message.py index b0b7de9..13bd810 100644 --- a/message.py +++ b/message.py @@ -13,10 +13,12 @@ from Yamibo import yamibo_checkin from Yurifans import yurifans_checkin from telegram import Bot +import requests # info TG_USER_ID = os.environ.get("TG_USER_ID") TG_BOT_TOKEN = os.environ.get("TG_BOT_TOKEN") +SERVERPUSHKEY = os.environ.get("SERVERPUSHKEY") if __name__ == '__main__': start_time = time.time() @@ -48,4 +50,19 @@ parse_mode="HTML" ) + if SERVERPUSHKEY: + server_url = f"https://sctapi.ftqq.com/{SERVERPUSHKEY}.send" + data = { + "title": "Daily Bonus 签到通知", + "desp": content + } + try: + response = requests.post(server_url, data=data) + if response.status_code == 200: + print("Server酱推送成功") + else: + print(f"Server酱推送失败: {response.status_code}") + except Exception as e: + print(f"Server酱推送异常: {str(e)}") + print(content)