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

[Improvement] joke category selection #37

Closed
pogross opened this issue May 15, 2020 · 2 comments · Fixed by #45
Closed

[Improvement] joke category selection #37

pogross opened this issue May 15, 2020 · 2 comments · Fixed by #45
Labels
First issue Issues suitable for new contributors Internal Changes not directly visible to the user: speed improvements, unit tests

Comments

@pogross
Copy link
Member

pogross commented May 15, 2020

Joke category selection

choice = "all"
if "chuck" in user_text.lower():
choice = "chuck"
if "neutral" in user_text.lower():
choice = "neutral"

Suggestion by @fuzzygwalchmei

use choice = dict.get(user_text.lower(), "all") as easier and adaptive approach

Problem

User may misspell command and/or add additional words in text

Fix

Check all words and find the most similar command.
Potential approaches:

Further a dict of available commands needs to be derived from the PyJokes package.

@pmayd
Copy link
Collaborator

pmayd commented Sep 7, 2020

will look into this

pmayd added a commit to pmayd/karmabot that referenced this issue Sep 8, 2020
…gories from pyjokes module and find closest match with difflib
@pogross pogross added Internal Changes not directly visible to the user: speed improvements, unit tests First issue Issues suitable for new contributors labels Sep 8, 2020
bbelderbos pushed a commit that referenced this issue Sep 9, 2020
* add error handling for env vars; run pre-commit

* improve joke command (issue #37): get list of categories from pyjokes module and find closest match with difflib

* refactor logic of category match into helper function with own tests
bbelderbos added a commit that referenced this issue Sep 9, 2020
* bump version for pypi package generation to match git tag

* Fix version (#40)

* add runtime file for heroku

* allow any 3.7 sub version

* breaks heroku deploy, poetry build pack makes this file

* dummy commit

* version bump

* Update README (#42)

* Add some Slack and Docker detail to the README

Provide some more guidance around finding Slack IDs and tokens, and
running the included docker-based postgres server.

* Remove readme detail

* Allow `topchannels` command in private messages (#41)

Let people review the top channel list in the peace and comfort of their
own DMs :)

* add error handling for env vars; run pre-commit (#43)

* fix python version and enable test for PRs

* add a fake KARMABOT_DATABASE_URL to the nox env (#48)

* Improve joke command (#45)

* add error handling for env vars; run pre-commit

* improve joke command (issue #37): get list of categories from pyjokes module and find closest match with difflib

* refactor logic of category match into helper function with own tests

* version bump

* Update versions of python, nox, poetry

Co-authored-by: AJ Kerrigan <[email protected]>
Co-authored-by: Michael Aydinbas <[email protected]>
Co-authored-by: Patrick-Oliver Groß <[email protected]>
@pogross pogross linked a pull request Sep 9, 2020 that will close this issue
@pogross
Copy link
Member Author

pogross commented Sep 9, 2020

Solved. Thanks @pmayd 👍

@pogross pogross closed this as completed Sep 9, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
First issue Issues suitable for new contributors Internal Changes not directly visible to the user: speed improvements, unit tests
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants