StampyAI / stampy

A Discord bot for the Robert Miles AI server
38 stars 9 forks source link

Splitting questions module #263

Closed MatthewBaggins closed 1 year ago

MatthewBaggins commented 1 year ago
ProducerMatt commented 1 year ago

Confirmed working in my fork 👍

MatthewBaggins commented 1 year ago

What's new in each module, rather than merely refactored

question_setter

questions

question_query_utils

I wanted to have a type that would specify a few types of question queries: by (1) title (2) gdoc link(s) (one or more) (3) last question that stampy interacted with (4) specified status and/or tag and/or maximum number of questions that I want to get. Something like Rust's enums would be ideal (see Listing 6.2 here), but Python doesn't have that. So I opted for a way that is very non-pythonic but probably very efficient and type-checker-friendly, i.e., using a union of 2-tuples, where the first element is a string literal specifying a type of query and the second is information specifying that query.