Closed deepfates closed 2 years ago
maybe a decorator, like requires_admin / hide? at least fewer # type: hides
in the link it looks like a protocol might be the way to go, or a Command class that inherits from Callable but has more attributes....
mobfriend issue should be fixed, run pip install --upgrade prometheus_client prometheus_async
locally; they added type hints in a new release
Okay @technillogue , I pulled your fix from main (thx!) and then updated to a decorator and protocol. This fixes most of the issues with mypy, except for adding synonyms to an inherited method, because the signatures no longer match. Don't know how common this use case is though? Definitely reduced the amount of #type: ignore
although not total LOC
this is so exciting.
I'm going to add the pdictng_readme.md document requested by @technillogue in #112
A bot with a thesaurus!
We want to be able to easily define synonyms for the various commands within bots: "hi" for "hello", "picture" for "imagine", etc.
I pulled the relevant logic out of https://github.com/mobilecoinofficial/forest/pull/127 and put it into SynonymBot class, using the powerful aPersistDict for stateful storage of synonyms.
Devs can still add lists of synonyms to methods in development, but now admins and users can adjust the bot's vocabulary directly in Signal. The interface is roughly based on the syntax of
ln
in the command line, like so:link hello wazzup
SynonymBot has commands for linking, unlinking, listing synonyms, and more. It also has dialogue branches for various error states.
Still wondering:
Design/abstraction
Technical hurdles
type: ignore
but it seems to be an open issue in the community. Several hacky solutions are listed at https://github.com/python/mypy/issues/2087NLP questions
link
andunlink
are available to users. This opens possibilities for abuse.string_dist
Happy to accept feedback on any of the above, or anything I missed.
Sample dialogue