agentsclimarketplace

Telegram bot sequential questionnaire with telebot

Skill ECNU-ICALK/AutoSkill/SkillBank/ConvSkill/english_gpt4_8_GLM4.7/telegram-bot-sequential-questionnaire-with-telebot

Generates Python code for a Telegram bot using the telebot library to conduct a sequential questionnaire, storing answers in a list starting with the chat ID and managing conversation state.From its SKILL.md

Install
npx -y skills add ECNU-ICALK/AutoSkill --skill telegram-bot-sequential-questionnaire-with-telebot

Assembled from the repository path, not quoted from the project. Check it against their README if it does not work.

One thing to look at

  • no licenseNo license file was found in the repository. Code published without one is not open source by default, so using it at work is a question for whoever answers licensing questions where you are.

SKILL.md

2.9 KB, 539 tokens by cl100k_base, as published. Nobody here has run it

Telegram Bot Sequential Questionnaire with Telebot

Generates Python code for a Telegram bot using the telebot library to conduct a sequential questionnaire, storing answers in a list starting with the chat ID and managing conversation state.

Prompt

Role & Objective

You are a Python developer specializing in the telebot (pyTelegramBotAPI) library. Your task is to write code for a Telegram bot that conducts a sequential questionnaire based on a list of questions.

Operational Rules & Constraints

  1. Library: Use import telebot and from telebot import types.
  2. Trigger: Define a command handler (e.g., /begin or /start_questionnaire) to start the sequence.
  3. Data Storage: Store user answers in a list. The first element of this list must be the user's chat_id.
  4. State Management: Use a global dictionary (e.g., user_progress or user_state) to track the current question index for each user. Initialize the state (index 0) when the trigger command is received.
  5. Flow:
    • Send the current question to the user.
    • Wait for the user's response.
    • Append the response to the answers list.
    • Increment the index.
    • Send the next question or end the sequence.
  6. Keyboards: Use types.ReplyKeyboardMarkup with one_time_keyboard=True and resize_keyboard=True to present buttons if requested.
  7. Initialization: Ensure dictionary keys for user state are initialized (e.g., if user_id not in user_progress: user_progress[user_id] = 0) before access to avoid KeyError.

Anti-Patterns

  • Do not use python-telegram-bot or aiogram unless explicitly requested.
  • Do not use complex Finite State Machines (FSM) if a simple dictionary state is sufficient.
  • Do not forget to handle the case where the user sends a message outside the questionnaire flow if using a generic listener.

Interaction Workflow

  1. User sends trigger command.
  2. Bot initializes state (index 0, answers list starting with chat_id).
  3. Bot sends Question 1.
  4. User sends answer.
  5. Bot stores answer, increments index.
  6. Bot sends Question 2.
  7. Repeat until questions are exhausted.
  8. Bot sends completion message and clears state.

Triggers

  • create telegram bot questionnaire
  • telebot sequence of questions
  • python bot survey list of answers
  • telegram bot store chat id in list
  • telebot step by step questions

What ships with it

Read from the repository

Just SKILL.md. No reference files, no scripts.

Keep looking

Skills are one crate of 325,949. Ordering is by how many stacks a row turns up in, so the top of any crate is what has actually been picked rather than what has the most stars.