Repository navigation
Fetch from SC2 Pulse and add /ping - #4
Merged
Merged
Conversation
The daily fetch and /fetch asked the Blizzard API, which needs credentials, and its public fallback is gone. SC2 Pulse gives the current-season 1v1 ladders of every stored profile in one call per season, so the bot needs no Blizzard credentials. A ladder is stored only when its MMR or number of games changed, dated by when it was last played. Each fetch also searches every user's Battle Tag again, so new profiles are added by themselves. /link, the Blizzard client and the BLIZZARD_CLIENT_ID, BLIZZARD_CLIENT_SECRET and REALM_ID settings are gone. China gets its flag.
Commands are tappable everywhere, monospace is kept for what is worth copying (Battle Tags, profile ids, examples, MMR), and usernames get their @. Users without a username are stored as a link to them again, as the old bot did. /help groups the commands into You and Everyone, and the ranking shows each user's Battle Tag name.
Telegram takes at most 4096 characters per message and 1024 per photo caption, so a big group's /rank or /ladders, or the daily post, would be refused. Replies are cut between lines, which keeps each part valid HTML. A /profile whose ladders don't fit in the caption sends the chart first and the ladders after it, and the daily post pins its first part.
In a group, /ping mentions every user of the bot who is a member of that group (asked to Telegram, user by user), except whoever asked, four per message: Telegram only notifies the first four mentions of a message. In a private chat it answers its help.
In a group, tapping /help_fetch sends "/help_fetch@bot", which was read as help for a command named "fetch@bot". The bot name is now taken off before the arguments, and links for other bots are ignored.
aiogram builds all of its ~450 pydantic models when it is imported: about 140 MB, more than the rest of the bot together. python-telegram-bot costs about 20 MB. Inside the image the bot starts at 119 MB instead of 247 MB and peaks at 145 MB instead of 272 MB after every user's /profile, so it fits the 256 MB limit of the homelab with room to spare. The charts are byte-for-byte the same. The daily fetch runs on python-telegram-bot's job queue, in the server's time zone (it defaults to UTC), instead of a second scheduler of our own.
/link and the BLIZZARD_CLIENT_ID, BLIZZARD_CLIENT_SECRET and REALM_ID settings are gone, so the next release is 0.2.0 rather than 0.1.1.
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.
Makes the deployed bot work without Blizzard credentials and within 256 MB limit, plus a few features found while testing. One commit per change:
/fetchasked the Blizzard API, which needs credentials, and its public fallback is gone./link, the Blizzard client and theBLIZZARD_CLIENT_ID,BLIZZARD_CLIENT_SECRETandREALM_IDsettings are removed./command.@, and users without a username are stored as a link again./helpis grouped into You and Everyone./pingto mention the group./help_fetch@bot, which was read as help for a command calledfetch@bot./profileit peaks at 145 MB instead of 272 MB.Testing
make qapasses (108 tests, 98% coverage), including from a fresh clone.--memory 256m --read-onlyand tried in Telegram.After merge
LOG_CHANNEL_IDto the group.🤖 Generated with Claude Code