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

Feature/add meme command #64

Closed

Conversation

AlexandreLachanceGit
Copy link
Contributor

For issue #63

Feature:

  • Add meme command.

@AlexandreLachanceGit
Copy link
Contributor Author

Won't work because of issue #65.

src/functions/meme/requirements.txt Outdated Show resolved Hide resolved
@@ -0,0 +1,102 @@
{
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We will need a way to access that list from Discord, maybe a command or something
Without autocomplete of command this will be insanly hard to remember

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking about thinking about linking to a page on the website, but that isn't ideal. Sending a huge list through discord messages isn't ideal either. Open to suggestions.

Copy link
Owner

@ArmandBriere ArmandBriere Sep 13, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We add the list to firestore then ?

request_json: Optional[dict] = request.get_json(silent=True)

with open(MEME_FILE, "r", encoding="utf-8") as meme_file:
memes: dict = json.load(meme_file)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why not make memes.json a python dict file so that we don't need to open files ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using a JSON seems like better practice than using a hard coded dictionary. Especially because it probably is going to be modified often.

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

JSON or python CONSTANT is the same, we just use python import and not file read

src/functions/meme/main.py Show resolved Hide resolved
src/functions/meme/main.py Outdated Show resolved Hide resolved


@patch.dict(os.environ, {"IMGFLIP_API_USERNAME": "TEST", "IMGFLIP_API_PASSWORD": "TEST"}, clear=True)
@patch(f"{MODULE_PATH}.open", mock_open(read_data='{"TestMeme": "TestID"}'), create=True)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See meme.json as python file to remove those mock

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants