Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/checkin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -50,3 +51,5 @@ jobs:

- name: Check-in
run: python ./message.py


9 changes: 8 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
<a href="https://github.com/jckling/Daily-Bonus/issues"><img src="https://img.shields.io/github/issues/jckling/Daily-Bonus" alt="GitHub issues"></a>
</p>

使用 Github Action 签到,用哪个就配置相应的环境变量,默认输出到控制台,支持 Telegram 消息推送。
使用 Github Action 签到,用哪个就配置相应的环境变量,默认输出到控制台,支持 Telegram 和 Server酱 消息推送。

## 说明

Expand All @@ -18,6 +18,7 @@
- [x] yamibo 论坛(对象)
- [x] yurifans 论坛(积分)
- [x] telegram-bot 推送
- [x] Server酱 推送
- [ ] ff14 (积分)【修复中】
- [ ] 哔咔漫画打卡(哔咔)【未验证】

Expand Down Expand Up @@ -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 登录
Expand Down
17 changes: 17 additions & 0 deletions message.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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)