]> git.cworth.org Git - turbot/commit
Rework code to map channel IDs to hunt or puzzle objects from the database
authorCarl Worth <cworth@cworth.org>
Thu, 31 Dec 2020 22:43:07 +0000 (14:43 -0800)
committerCarl Worth <cworth@cworth.org>
Fri, 1 Jan 2021 05:46:27 +0000 (21:46 -0800)
commit8db59b56dad42087514e933591eadb4c974f1518
treefa6c91a0ae834516954d840258c573d4efcfc67b
parent4bd6b54853a3af52ac9a5952891de4cd2c3c1386
Rework code to map channel IDs to hunt or puzzle objects from the database

The old functions were named things like channel_is_puzzle,
channel_is_hunt, and fund_hunt_for_channel. These were still expecting
the old multi-table database schema so they were broken, (as was all
functionality built on top of them such as the /state and /solved
commands).

The new functions are built on the all-one-table database schema, so
should actually work again. They also have a cleaner interface in that
they only rely only on channel ID (and never put any special stock in
the channel name). Instead of doing magic with the channel name, the
code looks up the hunt_id from the database entry for a puzzle as
needed.

The new functions are named puzzle_for_channel and hunt_for_channel
and are implemented on top of a common, internal function:
db_entry_for_channel.
turbot/interaction.py