INNER CODE UNIT · Python

button

IlyaGusev/rulm · self_instruct/src/bot/run.py:50

    def button(self, update: Update, context: CallbackContext) -> None:
        query = update.callback_query
        query.answer()

        data = query.data
        chat_id = update.effective_chat.id

        if self.write_result(data, chat_id):
            self.show(update, context)
        else:
            context.bot.send_message(text="Нужно перезапустить бот через '/start'", chat_id=chat_id)

    def sample_record(self, username, retries=50, max_overlap=3):
        for _ in range(retries):
            record = random.choice(self.records)
            instruction = record["instruction"]
            count = self.db.count(where("instruction") == instruction)
            if count >= max_overlap:

View source record →

📰 Research Paper
Loading…
⏳ Fetching content…