FunPay seller Telegram bot (MVP): chats, lot creation, proxies, AI - #1
Open
devin-ai-integration[bot] wants to merge 3 commits into
Open
FunPay seller Telegram bot (MVP): chats, lot creation, proxies, AI#1devin-ai-integration[bot] wants to merge 3 commits into
devin-ai-integration[bot] wants to merge 3 commits into
Conversation
- aiogram 3.x bot with admin-only ACL middleware - Async FunPay client (httpx + lxml) with golden_key auth and CSRF handling - Chat module: list, view history, reply with text/photo, AI-suggested replies - Sell flow: search game/category, fill description, AI improve, photos, submit - Proxy management (HTTP/HTTPS/SOCKS5) with round-robin pool - AI helper (OpenAI) for description writing and chat replies - SQLite storage for proxies, settings, lot drafts - Pydantic-settings config loaded from .env - Unit tests for parsers and proxy pool - CircleCI workflow for ruff + pytest
Author
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
First MVP of a personal Telegram bot for managing a FunPay seller account, scaffolded from scratch in this previously-empty repo. Built per the spec from chat: proxies, chats, search-driven lot creation, AI-assisted descriptions.
Stack: Python 3.11+ • aiogram 3.x • httpx + httpx-socks • lxml/BeautifulSoup • aiosqlite • OpenAI • Pydantic-Settings.
What's in the PR
pyproject.toml(withfunpay-tg-botconsole script),src/layout,.env.example,.gitignore,README.md.src/funpay_tg/funpay/):client.py(golden_key auth, CSRF handling, runner endpoint, image upload for chats and offers, lot save / raise),parsers.py(lxml/bs4 parsers for home, chat list, chat history, my-lots, offer-edit form),proxies.py(round-robin pool, scheme normalisation, HTTP/HTTPS/SOCKS5),types.py,exceptions.py.src/funpay_tg/bot/): aiogram 3.x dispatcher, admin-only ACL middleware, FSM states, inline keyboards, handlers split by feature —start,chats,sell,lots,proxies,settings.src/funpay_tg/db.py): aiosqlite — proxies, settings, lot drafts.src/funpay_tg/ai.py): OpenAI wrapper for description rewriting and chat-reply suggestions.src/funpay_tg/main.py) wires it all together.tests/): unit tests for parsers (synthetic HTML fixtures) and the proxy pool. 12 tests, all green locally..github/workflows/ci.yml) runningruff check src/ tests/andpytest -qon Python 3.11. Also rewrote the welcome-orb stub.circleci/config.ymlto do the same — but this repo isn't connected to CircleCI in practice, so GitHub Actions is the gate that actually runs.ruff check src/ tests/is clean andpytest -qis green both locally and in GitHub Actions on the PR.Updates since last revision
.github/workflows/ci.yml— initial CircleCI config never executed (no project linked there), so CI was effectively missing.tests/test_parsers.pyafterruff(running onsrc/ tests/) flagged it in CI.Review & Testing Checklist for Human
This PR is yellow-to-red risk — large new surface area, no end-to-end test against the real FunPay site, and no smoke-test against the real Telegram API. The unit tests only validate parsers against fixtures I wrote myself, which is not the same as validating them against FunPay's actual HTML.
FUNPAY_GOLDEN_KEYin.env, run the bot, and try /start → Status. The home-page parser (parse_account/ category extraction inparsers.py) is the riskiest piece — FunPay's real markup may differ from the fixture and break category enumeration. Watch for empty category lists or wrong balance / username.client.get_lot_form→_apply_draft(inbot/handlers/sell.py) →client.save_lot. I'm guessing the form field names (fields[summary][ru],fields[desc][ru],price,amount,active); real FunPay subcategories may use different locale-prefixed names and the save will silently fail. Try creating one cheap test lot and confirm it actually appears in your offer list.client.upload_image(chat endpoint) actually attaches. The two upload endpoints (/file/addChatImagevs/file/addOfferImage) are easy to swap by mistake — check both.TELEGRAM_ADMIN_IDSset, confirm that a different Telegram account is blocked byAdminOnlyMiddleware. Security-critical.LoginRequirederrors..circleci/config.ymlor wire the repo into CircleCI.Suggested test plan
python3.11 -m venv .venv && source .venv/bin/activate && pip install -e .[dev]..env.example→.env, fill inTELEGRAM_BOT_TOKEN,TELEGRAM_ADMIN_IDS(your numeric Telegram ID),FUNPAY_GOLDEN_KEY. OptionallyOPENAI_API_KEY.funpay-tg-bot→ DM the bot/start.Notes
.envis gitignored, only.env.exampleis shipped.mainis empty before this PR, so this lands as the entire codebase rather than an incremental change.Link to Devin session: https://app.devin.ai/sessions/4050ba6a349a47cfb97fec100638bc1d
Requested by: @promi1