No description
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2026-06-14 10:52:13 +08:00
.env.example Add Pixiv view and bookmark filters 2026-06-14 10:52:13 +08:00
.gitignore Add Telegram login 2026-06-12 18:40:29 +08:00
auth.go Refactor code 2026-06-13 21:33:48 +08:00
commands.go Register bot commands 2026-06-14 01:07:37 +08:00
env.go Add Pixiv view and bookmark filters 2026-06-14 10:52:13 +08:00
go.mod Add Pixiv review bot 2026-06-13 23:58:02 +08:00
go.sum Add Pixiv review bot 2026-06-13 23:58:02 +08:00
LICENSE Initial commit 2026-06-12 02:34:13 +00:00
main.go Add Pixiv review bot 2026-06-13 23:58:02 +08:00
pixiv.go Add Pixiv view and bookmark filters 2026-06-14 10:52:13 +08:00
README.md Add Pixiv view and bookmark filters 2026-06-14 10:52:13 +08:00
review_bot.go Add related artwork browsing 2026-06-14 10:24:45 +08:00
target.go Add multi-group target selection 2026-06-14 00:59:18 +08:00
telegram.go Refactor code 2026-06-13 21:33:48 +08:00

pixiv-story-bot

A minimal Telegram user login client built with github.com/gotd/td.

It performs user login, saves the Telegram session credentials to a local file, and can download the first image of a Pixiv artwork to send it to a Telegram group story.

Usage

Create a Telegram application at https://my.telegram.org/apps, then run:

TELEGRAM_APP_ID=123456 \
TELEGRAM_APP_HASH=your_app_hash \
TELEGRAM_PHONE=+8613800000000 \
go run . login

The program will prompt for the Telegram login code. If your account has 2FA enabled, it will also prompt for the 2FA password.

Optional environment variables:

  • TELEGRAM_SESSION_FILE: session file path, defaults to telegram-session.json.
  • TELEGRAM_PASSWORD: Telegram 2FA password. If unset and 2FA is required, the program prompts interactively.
  • TELEGRAM_TARGET_GROUP_ID: target group/channel IDs for story sending. Multiple groups can be configured with comma-separated values.
  • TELEGRAM_TARGET_GROUP_ACCESS_HASH: target group/channel access hashes. Multiple hashes can be configured with comma-separated values matching TELEGRAM_TARGET_GROUP_ID.
  • PIXIV_REFRESH_TOKEN: Pixiv refresh token used by github.com/txperl/pixivgo for authenticated Pixiv App-API requests.
  • PIXIV_ACCESS_TOKEN: optional existing Pixiv access token. If set, it is used directly with PIXIV_REFRESH_TOKEN.
  • PIXIV_MIN_VIEW_COUNT: optional minimum view count for accepted Pixiv illustrations. Empty means no limit.
  • PIXIV_MIN_BOOKMARK_COUNT: optional minimum bookmark count for accepted Pixiv illustrations. Empty means no limit.
  • TELEGRAM_BOT_TOKEN: Telegram Bot token for the bot review command.
  • TELEGRAM_BOT_ALLOWED_USER_ID: optional comma-separated Telegram user IDs allowed to use the review bot.

Example with a custom session path:

TELEGRAM_APP_ID=123456 \
TELEGRAM_APP_HASH=your_app_hash \
TELEGRAM_PHONE=+8613800000000 \
TELEGRAM_SESSION_FILE=.telegram/session.json \
go run . login

List group/channel IDs and access hashes after logging in:

go run . groups

Use the printed TELEGRAM_TARGET_GROUP_ID and TELEGRAM_TARGET_GROUP_ACCESS_HASH values to send the first image of a Pixiv artwork to the target group story. When multiple groups are configured, the CLI send command uses the first group:

TELEGRAM_APP_ID=123456 \
TELEGRAM_APP_HASH=your_app_hash \
TELEGRAM_TARGET_GROUP_ID=123456789 \
TELEGRAM_TARGET_GROUP_ACCESS_HASH=987654321 \
PIXIV_REFRESH_TOKEN=your_pixiv_refresh_token \
go run . send 22238487

Start the review bot. Use /group to list target groups and /group <number> (for example /group 1) to choose the target group for the current chat. Send /get to browse recommended Pixiv illustrations, /rank to browse today's illustration ranking, /search <keyword> to browse search results, or /send <artwork-id> to directly send one artwork. Browse commands show illustrations one by one with [Send] [Next] [Related] [Cancel] buttons; [Related] switches the current session to recommendations related to the displayed artwork.

TELEGRAM_BOT_TOKEN=your_bot_token \
TELEGRAM_BOT_ALLOWED_USER_ID=123456789,987654321 \
go run .

Keep the generated session file private; it contains credentials for your Telegram account session.