You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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.
The text was updated successfully, but these errors were encountered:
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:json_mode
andjson_path
options)if bot.config.waifu.unique_waifus
)if bot.config.waifu.track_usage
, or whatever the option name ends up being)shutdown()
(Would also make sense to periodically persist waifu suggestions made withThe.addwaifu
into the database, instead of only at shutdown.).addwaifu
feature will be removed.The text was updated successfully, but these errors were encountered: