{"id":20821441,"url":"https://github.com/lolipopj/telly-bot","last_synced_at":"2025-05-07T16:24:06.681Z","repository":{"id":43700351,"uuid":"445407916","full_name":"LolipopJ/telly-bot","owner":"LolipopJ","description":"A Telegram bot based on Bun.","archived":false,"fork":false,"pushed_at":"2025-03-31T11:04:05.000Z","size":1061,"stargazers_count":2,"open_issues_count":0,"forks_count":1,"subscribers_count":1,"default_branch":"bun","last_synced_at":"2025-03-31T11:51:10.690Z","etag":null,"topics":["alist","bun","chatgpt","github-issues","mongodb","pixiv","telegram-bot"],"latest_commit_sha":null,"homepage":"https://t.me/lolipop_mini_bot","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/LolipopJ.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-01-07T05:24:30.000Z","updated_at":"2025-03-31T11:04:09.000Z","dependencies_parsed_at":"2024-10-28T21:46:09.482Z","dependency_job_id":null,"html_url":"https://github.com/LolipopJ/telly-bot","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LolipopJ%2Ftelly-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LolipopJ%2Ftelly-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LolipopJ%2Ftelly-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/LolipopJ%2Ftelly-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/LolipopJ","download_url":"https://codeload.github.com/LolipopJ/telly-bot/tar.gz/refs/heads/bun","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252913632,"owners_count":21824224,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alist","bun","chatgpt","github-issues","mongodb","pixiv","telegram-bot"],"created_at":"2024-11-17T22:12:14.184Z","updated_at":"2025-05-07T16:24:06.666Z","avatar_url":"https://github.com/LolipopJ.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# telly-bot\n\n## Start service\n\nThis project based on [Bun](https://bun.sh), which needs to be installed globally:\n\n```bash\nnpm install -g bun\n```\n\nTo install dependencies:\n\n```bash\nbun install\n```\n\nTo start bot service:\n\n```bash\nbun run server\n```\n\n## Start service with Docker\n\nBuild Docker image:\n\n```bash\ndocker build --pull -t telly-bot:latest .\n```\n\nUse the image to spin up a container:\n\n```bash\ndocker run -d -p 3300:3300 --restart unless-stopped --name telly-bot telly-bot:latest\n```\n\n## Configurations\n\nCreate `.env` in root directory to hold environment variables.\n\n### Required\n\n**Required** environment variables:\n\n```bash\n# Telegram bot token\nTELEGRAM_BOT_TOKEN=XXXXXXXXXX:XXXXXXXXXXXXXXXXXXXXXXXXXXX-XXXXXXX\n```\n\n### Common\n\nOptional common environment variables:\n\n```bash\n# Listening port of service. Default to `3300`\nPORT=3300\n# Secret token to execute private (POST) API\nAPI_SECRET_TOKEN=YOUR_SECRET_TOKEN\n# Telegram chat that receives monitoring messages and so on. The chat between bot and yourself is recommended\nTELEGRAM_CHAT_ID_ADMIN=TARGET_CHAT_ID\n```\n\n### Database / MongoDB\n\nTelly bot chooses MongoDB as the provider of database service. Some features require connecting to MongoDB.\n\n```bash\n# MongoDB uri\nMONGO_URI=mongodb://username:password@127.0.0.1:27017/telly-bot\n```\n\nDon't worry, Telly bot can work without MongoDB.\n\n### AList\n\n```bash\n# AList address\nALIST_URL=http://127.0.0.1:5244\n# AList login username\nALIST_USERNAME=YOUR_ALIST_USERNAME\n# AList login password\nALIST_PASSWORD=YOUR_ALIST_PASSWORD\n# Custom service routes\nALIST_ROUTES=[{\"route\":\"/random-img\",\"path\":\"/path/to/img-dir\",\"type\":\"random-image\"}]\n```\n\nWhen visit `http://127.0.0.1:3300/alist/random-img` or send `/random_img` to bot, you will get a random image from the `/path/to/img-dir` directory in AList.\n\nNotes: If directory `/path/to/img-dir` has too many files, the first request in a certain time interval may failed. This is due to AList's file cache mechanism (default to 30 minutes, can be configured on the AList management page), please wait a few seconds and try again.\n\n### ChatGPT\n\nAdapt to [ChatAnywhere](https://github.com/chatanywhere/GPT_API_free).\n\n```bash\n# ChatGPT model version. Default to `gpt-3.5-turbo-0125`\nCHATGPT_MODEL=gpt-3.5-turbo-0125\n# ChatAnywhere API key\nCHATGPT_API_KEY=YOUR_CHATGPT_API_KEY\n# Telegram chat that receives key usage\nTELEGRAM_CHAT_ID_CHATGPT_BALANCE=TARGET_CHAT_ID\n```\n\nSend `/chat ${message}` to play with a cat girl! You can also:\n\n- `/chat_cat_girl ${message}`: Same to `/chat ${message}`.\n- `/chat_dan ${message}`: Chat with an unlimited AI agent named Dan.\n- `/chat_poet ${message}`: Talk with a poet who writes impressive words.\n\nVisit `http://127.0.0.1:3300/chatgpt/balance` to view key usage. If `TELEGRAM_CHAT_ID_CHATGPT_BALANCE` (higher priority) or `TELEGRAM_CHAT_ID_ADMIN` is set, key usage will also be forwarded to target chat every 9 AM and 9 PM.\n\n### Github\n\n```bash\nGITHUB_PERSONAL_ACCESS_TOKEN=YOUR_GITHUB_PERSONAL_ACCESS_TOKEN\n```\n\n### Minecraft\n\nBased on [Minecraft Server Status](https://mcstatus.io/).\n\n```bash\nMINECRAFT_SERVER_HOST=example.domain.com\nTELEGRAM_CHAT_ID_MINECRAFT_MONITOR=TARGET_CHAT_ID\n```\n\n## API\n\n### Telegram bot API\n\n#### Query bot status\n\n```ts\naxios.get(\"http://127.0.0.1:3300/bot/status\");\n```\n\n#### Send custom message\n\nSend custom message to target chat. Content should be parsable by HTML mode: \u003chttps://core.telegram.org/bots/api#html-style\u003e.\n\n```ts\naxios.post(\n  \"http://127.0.0.1:3300/bot/send-message\",\n  {\n    content: \"custom message\",\n    chatId: TELEGRAM_CHAT_ID_ADMIN,\n  },\n  {\n    headers: { Authorization: API_SECRET_TOKEN },\n  },\n);\n```\n\nIf `chatId` is blank, `TELEGRAM_CHAT_ID_ADMIN` will be used.\n\n### ChatGPT API\n\n#### Query CA key usage\n\n```ts\naxios.get(\"http://127.0.0.1:3300/chatgpt/balance\");\n```\n\n#### Chat with a cat girl\n\n```ts\naxios.post(\n  \"http://127.0.0.1:3300/chatgpt/chat\",\n  {\n    content: \"custom message\",\n  },\n  {\n    headers: { Authorization: API_SECRET_TOKEN },\n  },\n);\n```\n\n## Development\n\nTo develop:\n\n```bash\nbun run start\n```\n\nTo lint files and fix code syntax:\n\n```bash\n# Require a Node.js \u003e=20.11.0 to get typing check\nbun run lint\n# Auto fix\nbun run lint:fix\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flolipopj%2Ftelly-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Flolipopj%2Ftelly-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Flolipopj%2Ftelly-bot/lists"}