Add !advice command with custom Markov chain text generation#41
Open
Copilot wants to merge 8 commits into
Open
Add !advice command with custom Markov chain text generation#41Copilot wants to merge 8 commits into
Copilot wants to merge 8 commits into
Conversation
Agent-Logs-Url: https://github.com/datafruits/fruitbot/sessions/4e15716f-c691-4cf0-a19a-95c6da8eb9cf Co-authored-by: mcfiredrill <66243+mcfiredrill@users.noreply.github.com>
Copilot created this pull request from a session on behalf of
mcfiredrill
April 18, 2026 21:52
View session
- Load model from markov_model.txt on init (if it exists) - Save periodically every 5 minutes via Process.send_after - Save on graceful shutdown via terminate/2 with trap_exit - Add save/0 client API for manual saves from IEx - Tab-separated text format: chain entries then starts, separated by blank line - Configurable path via MARKOV_MODEL_PATH env var - Add markov_model.txt to .gitignore Agent-Logs-Url: https://github.com/datafruits/fruitbot/sessions/ae78124d-42bc-4a5e-88de-c0e13b34ed23 Co-authored-by: mcfiredrill <66243+mcfiredrill@users.noreply.github.com>
Agent-Logs-Url: https://github.com/datafruits/fruitbot/sessions/ae78124d-42bc-4a5e-88de-c0e13b34ed23 Co-authored-by: mcfiredrill <66243+mcfiredrill@users.noreply.github.com>
Add Fruitbot.DiscordBackfill module that paginates through a Discord channel's history using Nostrum.Api.get_channel_messages/3, filters out bot messages and commands, and trains the Markov chain on each message. Runs async via Task.start to avoid blocking. Add MarkovChain.backfill/1 convenience function and !backfill chat command. Agent-Logs-Url: https://github.com/datafruits/fruitbot/sessions/4a3e72c9-18d6-4a10-b14c-8dcfdac4eacc Co-authored-by: mcfiredrill <66243+mcfiredrill@users.noreply.github.com>
Agent-Logs-Url: https://github.com/datafruits/fruitbot/sessions/4a3e72c9-18d6-4a10-b14c-8dcfdac4eacc Co-authored-by: mcfiredrill <66243+mcfiredrill@users.noreply.github.com>
Nostrum.Api.get_channel_messages/3 crashes when passed an empty map
as the locator argument. Use the 2-argument form for the initial
page fetch (no before_id), and only pass %{before: id} for
subsequent pages.
Agent-Logs-Url: https://github.com/datafruits/fruitbot/sessions/58bcf38f-8671-47ac-bf5f-5fc63ac523d3
Co-authored-by: mcfiredrill <66243+mcfiredrill@users.noreply.github.com>
Nostrum.Api.Channel.messages_call/3 expects the locator as a tuple
(e.g. {:before, message_id}) or {} for no locator. Passing a map
%{before: id} caused it to be placed directly into the query params
list as [{:limit, 100}, %{before => id}], crashing the HTTP state
machine on the second page fetch.
Agent-Logs-Url: https://github.com/datafruits/fruitbot/sessions/c687df36-526d-4013-9e53-9c6a3874f9bb
Co-authored-by: mcfiredrill <66243+mcfiredrill@users.noreply.github.com>
Agent-Logs-Url: https://github.com/datafruits/fruitbot/sessions/453fb770-483d-4408-8eb8-44e1d384ad87 Co-authored-by: mcfiredrill <66243+mcfiredrill@users.noreply.github.com>
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.
@default_max_messagesconstant (default 5,000) toDiscordBackfillrun/2that accepts an optional max message limitfetch_pageto stop when the limit is reached!backfillcommand handler to mention the default limit