|
1 | 1 | # 🤖 Telegram Auto Sign |
2 | 2 |
|
3 | | -基于 GitHub Actions 和 Python (Telethon) 实现的 Telegram 每日自动签到脚本。利用个人账号 (Userbot) 每日自动向指定的 Telegram 机器人发送签到指令,彻底解放双手。 |
4 | | - |
5 | | -## ✨ 核心特性 |
6 | | -- **☁️ 零成本部署**:依托 GitHub Actions 自动运行,无需本地服务器或 VPS。 |
7 | | -- **👥 多 Bot 支持**:支持同时向多个机器人发送签到指令。 |
8 | | -- **🎲 智能防风控**:内置 `1~20` 分钟随机延迟启动,以及消息发送间隔随机停顿,避免触发 TG 反垃圾机制。 |
9 | | -- **📝 自动日志保活**:每次运行后自动将签到结果写入 `checkin.log` 并推送到本仓库,完美绕过 GitHub Actions 60 天无代码提交自动暂停的限制。 |
10 | | - |
11 | | -## 🚀 如何使用 (部署指南) |
12 | | - |
13 | | -### 1. 准备工作:获取 API 凭据 |
14 | | -1. 登录 [Telegram API 平台](https://my.telegram.org/)。 |
15 | | -2. 进入 **API development tools**,创建一个应用。 |
16 | | -3. 记下你的 `App api_id` 和 `App api_hash`。 |
17 | | - |
18 | | -### 2. 准备工作:获取 Session String |
19 | | -在本地电脑 Python 环境中安装依赖 `pip install telethon`,并运行以下代码获取你的专属 Session 字符串: |
20 | | -```python |
21 | | -import asyncio |
22 | | -from telethon import TelegramClient |
23 | | -from telethon.sessions import StringSession |
24 | | - |
25 | | -api_id = '你的 api_id' |
26 | | -api_hash = '你的 api_hash' |
27 | | - |
28 | | -async def main(): |
29 | | - client = TelegramClient(StringSession(), api_id, api_hash) |
30 | | - await client.start() |
31 | | - print("你的 Session 字符串是:\n", client.session.save()) |
32 | | - |
33 | | -if __name__ == '__main__': |
34 | | - asyncio.run(main()) |
| 3 | +An automated daily sign-in script for Telegram bots, powered by GitHub Actions and Python (Telethon). It uses your personal account (Userbot) to send sign-in commands (like `/qd`) to specified Telegram bots daily, completely freeing your hands. |
| 4 | + |
| 5 | +## ✨ Core Features |
| 6 | +* **☁️ Zero-Cost Deployment**: Runs entirely on GitHub Actions. No need for a local server or VPS. |
| 7 | +* **👥 Multi-Bot Support**: Capable of sending sign-in commands to multiple bots sequentially. |
| 8 | +* **🎲 Smart Anti-Ban System**: Built-in 1~20 minutes randomized startup delay and random pauses between messages to prevent triggering Telegram's spam filters. |
| 9 | +* **📝 Auto-Log Keepalive**: Automatically writes sign-in results to `checkin.log` and pushes it to the repository after each run. This perfectly bypasses GitHub Actions' 60-day inactivity suspension rule. |
| 10 | + |
| 11 | +## 🚀 Deployment Guide |
| 12 | + |
| 13 | +### Step 1: Get API Credentials |
| 14 | +1. Log in to the [Telegram API Development Tools](https://my.telegram.org/). |
| 15 | +2. Create a new application. |
| 16 | +3. Note down your `App api_id` and `App api_hash`. |
| 17 | + |
| 18 | +### Step 2: Get Session String |
| 19 | +Install the dependency (`pip install telethon`) on your local machine and run a script to generate your session string. |
| 20 | +> ⚠️ **WARNING**: Treat your Session String like a password. NEVER share it publicly! |
| 21 | +
|
| 22 | +### Step 3: Configure GitHub Repository Secrets |
| 23 | +1. Create a **Private** repository (Highly recommended for security). |
| 24 | +2. Go to `Settings` -> `Secrets and variables` -> `Actions`, and add the following 4 **Repository secrets**: |
| 25 | + * `API_ID`: Your API ID (Numbers only). |
| 26 | + * `API_HASH`: Your API Hash string. |
| 27 | + * `SESSION_STRING`: The extremely long session string generated in Step 2. |
| 28 | + * `BOT_USERNAME`: The target bot usernames, separated by commas (e.g., `@bot1, @bot2`). |
| 29 | + |
| 30 | +### Step 4: Grant Action Permissions |
| 31 | +To allow the script to push the log file back to the repository: |
| 32 | +1. Go to `Settings` -> `Actions` -> `General`. |
| 33 | +2. Scroll down to **Workflow permissions**. |
| 34 | +3. Select **Read and write permissions** and click `Save`. |
| 35 | + |
| 36 | +### Step 5: First Run & Test |
| 37 | +Go to the **Actions** tab, select the `Telegram Auto Sign` workflow on the left, and click `Run workflow` to test it manually. If successful, your account will send the commands, and a log file will appear in your repository! |
| 38 | + |
| 39 | +--- |
| 40 | + |
| 41 | +## ⏱️ Schedule Modification |
| 42 | +The default trigger time is **00:00 UTC daily**. |
| 43 | +To modify this, edit the cron expression in the `.github/workflows/checkin.yml` file. |
| 44 | + |
| 45 | +## ⚠️ Disclaimer |
| 46 | +This script is for educational and automated testing purposes only. Do not use it for high-frequency spamming or violating Telegram's Terms of Service. The user bears all responsibility for any account restrictions or bans caused by API abuse. |
0 commit comments