Telegram Anti-Spam Bot: Dynamic Question Generator
In the previous episode, we implemented the basic framework of an anti-spam bot What if we want to implement a rich way of generating question-answer pairs? Let's look at the current code. After generating a question-answer pair, it's saved, and then new members answer the question and the answer is checked. So, let's do this. In the directory where the python file main.py is located, there is a pset directory. The pset directory contains multiple .py files. Each of these .py files contains at least 1 function: buildQA buildQA returns 2 strings, one is the question, and one is the correct_answer I want to randomly call the buildQA function from one of the .py files in the pset directory in main.py Throw this text at M$ copilot (or any GPT you have on hand), and you'll easily get an answer. Apply the modification plan to the project. In the main py file, add this function def get_random_module(): # Find all .py files in the pset directory (excluding __init__.py) ...