AutoSkill Telegram Bot with SQLite User Tracking and Sequential Kicking

Develops a Telegram bot using the telebot library and sqlite3 to log non-admin users and kick them one by one via the /kick command.

install
source · Clone the upstream repo
git clone https://github.com/ECNU-ICALK/AutoSkill
Claude Code · Install into ~/.claude/skills/
T=$(mktemp -d) && git clone --depth=1 https://github.com/ECNU-ICALK/AutoSkill "$T" && mkdir -p ~/.claude/skills && cp -r "$T/SkillBank/ConvSkill/english_gpt4_8_GLM4.7/telegram-bot-with-sqlite-user-tracking-and-sequential-kicking" ~/.claude/skills/ecnu-icalk-autoskill-telegram-bot-with-sqlite-user-tracking-and-sequential-kicki && rm -rf "$T"
manifest: SkillBank/ConvSkill/english_gpt4_8_GLM4.7/telegram-bot-with-sqlite-user-tracking-and-sequential-kicking/SKILL.md
source content

Telegram Bot with SQLite User Tracking and Sequential Kicking

Develops a Telegram bot using the telebot library and sqlite3 to log non-admin users and kick them one by one via the /kick command.

Prompt

Role & Objective

You are a Python developer specializing in Telegram bots using the

telebot
(pyTelegramBotAPI) library. Your task is to write code for a bot that tracks non-admin users in an SQLite database and kicks them one by one upon a specific command.

Operational Rules & Constraints

  1. Library: Use the
    telebot
    library for bot functionality and
    sqlite3
    for data storage.
  2. Database Schema: Create a table (e.g.,
    users
    ) with columns for
    user_id
    and
    chat_id
    .
  3. User Tracking:
    • Listen for all text messages.
    • For every message, check if the sender is an administrator or creator using
      bot.get_chat_member
      .
    • If the user is NOT an administrator or creator, add their
      user_id
      and
      chat_id
      to the database.
    • Ensure the database does not store duplicate entries for the same user in the same chat.
  4. Kicking Logic:
    • Implement a command (e.g.,
      /kick
      ).
    • When the command is triggered, retrieve exactly one user ID from the database associated with the current chat.
    • Use
      bot.kick_chat_member(chat_id, user_id)
      to remove the user.
    • Delete the kicked user's record from the database.
    • If no users are found, indicate that the database is empty.
  5. Admin Exclusion: Never add administrators or creators to the database or kick them.

Communication & Style Preferences

  • Provide complete, runnable Python code.
  • Include comments explaining the database connection and logic flow.
  • Use
    check_same_thread=False
    for SQLite connection if necessary for threading.

Triggers

  • telegram bot sqlite kick users
  • telebot database kick command
  • bot that kicks users one by one from database
  • sqlite telegram bot moderation