Repository navigation
feat: send periodic flood adverts at a configurable interval - #15
Merged
Merged
Conversation
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
Adds a periodic flood-advert feature: the bot sends a flood advertisement every N hours (
0= disabled). The interval is seeded frommcbot.confon first run, then stored in the database (bot_meta) and managed at runtime — changes persist across restarts and take effect within ~60s without a restart. Settable via!adm advert interval <hours>and the web Manage→Radio screen.Behavior
!adm advert interval 3→ flood advert every 3 hours;!adm advert interval 0disables; bare!adm advert intervalshows the current value.!adm advert flood, web button, or periodic) resets the clock, so the guarantee is "≥ N hours between flood adverts."Changes
Config.advert_interval_hours([bot], default 0) + parse;MCBotstate,_load_advert_interval()(DB-authoritative, seeds from config when the key is absent),set_advert_interval()(memory + DB, resets schedule),send_advert()anchors the schedule on flood, and aperiodic_adverttask (60s poll, registered for shutdown).radio_advert_interval()(read) +radio_set_advert_interval()(validate 0–168h, persist, auditradio.advert_interval).!adm advert interval <hours>subcommand + help text.GET/POST /api/radio/advert-interval.advert_interval_hoursas the first-run seed.Testing
tests/test_advert_interval.pypasses; existing suites (logging, repeat-tracking, eviction, decode-advert) still pass;py_compileclean;npm run buildclean.