TeleBot Plugins
A simple plugin system for pyTelegramBotAPI (telebot) that allows you to organize your bot's functionality into separate plugin files without having to redefine the bot instance in each file.
Features
- Load plugins from a specified directory
- Support for both synchronous and asynchronous telebot
- Handle relative paths properly
- Automatically register the bot instance globally
- Support for webhook and polling modes
Installation
pip install telebot-plugins
Usage
Basic Example
from telebot import TeleBot
from telebot_plugins import TelebotWithPlugins
# Create a bot instance
API_TOKEN = "YOUR_BOT_TOKEN"
bot = TeleBot(API_TOKEN)
# Initialize TelebotWithPlugins
plugins = TelebotWithPlugins(
bot=bot,
plugins="plugins", # plugins folder name
exclude=["disabled_plugin.py"] # files to exclude (optional)
)
if __name__ == '__main__':
# Start the bot
bot.polling()
Example Plugin File (plugins/example.py)
from telebot import bot # The bot is automatically available
@bot.message_handler(commands=['start'])
def send_welcome(message):
bot.reply_to(message, "Hello! This is a plugin example.")
Async Bot Example
from telebot.async_telebot import AsyncTeleBot
from telebot_plugins import TelebotWithPlugins
import asyncio
# Create an async bot instance
API_TOKEN = "YOUR_BOT_TOKEN"
bot = AsyncTeleBot(API_TOKEN)
# Initialize TelebotWithPlugins
plugins = TelebotWithPlugins(
bot=bot,
plugins="plugins"
)
if __name__ == '__main__':
# Start the async bot
asyncio.run(bot.polling())
Metadata
Release files for telebot-plugins 0.1.4
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | Provenance | Actions |
|---|---|---|---|---|
| telebot_plugins-0.1.4.tar.gz | 2.8 kB | Without provenance | Details for telebot_plugins-0.1.4.tar.gz |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Actions Reset |
|---|---|---|---|---|
| telebot_plugins-0.1.4-py3-none-any.whl | Python 3 | none | any | Details for telebot_plugins-0.1.4-py3-none-any.whl |
Total release size: 5.8 kB
Release files / telebot_plugins-0.1.4.tar.gz
| Download URL | telebot_plugins-0.1.4.tar.gz |
|---|---|
| Size | 2.8 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
57a6deb78aefda354a92941456aa6a9f28de9248fc77b473409fefe6491e4e53
|
|
BLAKE2b-256 checksum How to use checksums |
93e05cc3ffe26995ddb82d0d9fc0fcd9901173a77eb529f9306fa0d689c484e5
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Release files / telebot_plugins-0.1.4-py3-none-any.whl
| Download URL | telebot_plugins-0.1.4-py3-none-any.whl |
|---|---|
| Size | 3.0 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
1b777d3ee315808aeac892422fd44781babbae162602941b8ea4836f9d90e54a
|
|
BLAKE2b-256 checksum How to use checksums |
159d197aacc3381153d3e2858fce1c315fab70ce6c13b7652aa195988cd7bc8d
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/6.1.0 CPython/3.12.9
|
Security for telebot-plugins 0.1.4
Provenance
Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.
No provenance found
None of the files in this release were uploaded with provenance metadata.
A note on package security
PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.
To learn more about protecting yourself from malicious actors, visit our package security documentation.