Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature idea: Exhaustible waifu list #23

Open
dgw opened this issue Aug 16, 2023 · 0 comments
Open

Feature idea: Exhaustible waifu list #23

dgw opened this issue Aug 16, 2023 · 0 comments
Labels
enhancement New feature or request

Comments

@dgw
Copy link
Owner

dgw commented Aug 16, 2023

This should probably be optional, and the limitations (wait a sec, I'll get to that) documented alongside the setting, but it would be pretty neat if each waifu was removed from the list of possibilities once someone "gets" that entry.

Since the list is large (and growing over time), "used" entries would need to be persisted to a file. Forgetting which entries have been used after every restart would make the feature basically useless.

A very simplistic hash of the final Character Name (Series or Franchise Title) format actually stored in the list, like CRC32, could be used for persisting entries. Encoded to a hexadecimal string, the 32-bit hash would be just 8 characters/bytes. (Nothing stops the file from being binary—in which case each entry would be just a 4-byte integer—but I wouldn't want to contradict the unspoken convention that files in Sopel's homedir should at least be human-readable, even if human edits would be ill-advised.)

Prerequisites

I'd say that refactoring the "actual" list-loading logic out of setup() and into helper functions is necessary for this not to result in excessively complex code. Including what's needed for this feature, there should be at least:

  • a function that generates the "raw" list given the bot's settings (containing the json_mode and json_path options)
  • a function to deduplicate the list (only if bot.config.waifu.unique_waifus)
  • a function to load the "used" hash data and remove those entries from the list (only if bot.config.waifu.track_usage, or whatever the option name ends up being)
  • a function to persist the "used" hashes from memory to disk both periodically and at shutdown()

(Would also make sense to periodically persist waifu suggestions made with .addwaifu into the database, instead of only at shutdown.) The .addwaifu feature will be removed.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant