A Python library for organizing and loading bot functions from external files for the Telebot library. Simplifies bot code management by allowing the use of separate files for bot commands and functions.
Project description
TeleBee library provided by Mohammed Ghanam.
TeleBee is a Python library designed to simplify the management and organization of code in bot projects using the Telebot library. This library allows you to load code from Python files located in specific directories without interfering with the polling or infinity_polling processes. You can write your code normally, and the library will automatically load and organize it.
Features
- Load code from Python files in specified directories.
- Does not interfere with
pollingorinfinity_pollingprocesses. - A flexible and easy-to-use library that allows developers to write code normally in separate files.
- Supports organizing code in different directories.
Installation
- First, install the
pyTelegramBotAPIlibrary (if not installed already):
pip install pyTelegramBotAPI
``
##Usage
- 1. Setting up TeleBee:
At the beginning of your Python file, import the library, create a TeleBee object, and pass in your bot's token.
``python
from telebot import TeleBot
from telebee import TeleBee
# Set up the bot using your bot's token
bot = TeleBot('YOUR_BOT_TOKEN')
# Set up TeleBee and load code from specified directories
telebee_bot = TeleBee(function_dirs=['start', 'functions'])
telebee_bot.load_functions()
# The developer controls polling separately
bot.infinity_polling()
``
- 2. Adding code:
The developer writes their code in Python files within the specified directories. For example, the developer can add files like start.py or functions/another_function.py.
Example of start.py:
``python
@bot.message_handler(commands=['start'])
def start_message(message):
bot.reply_to(message, "Welcome to the bot!")
``
Example of functions/another_function.py:
``python
@bot.message_handler(commands=['hello'])
def hello_message(message):
bot.reply_to(message, "Hello, how are you?")
``
- 3. Customizing directories:
You can customize the directories containing the code by passing them to TeleBee in the function_dirs argument.
``python
telebee_bot = TeleBee(function_dirs=['your_custom_folder', 'another_folder'])
telebee_bot.load_functions()
``
## For Contact:
- My telegram Account: [@midoghanam](https://t.me/midoghanam)
- My Channel: [@mido_ghanam](https://t.me/mido_ghanam)
## Best Regards ♡
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file telebee-1.0.tar.gz.
File metadata
- Download URL: telebee-1.0.tar.gz
- Upload date:
- Size: 3.8 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
b3e7f10bd179b090f94811a3b3cff12d45d42873e7a968c7a15321ec1cb2cef0
|
|
| MD5 |
9f295531e08cb2e17b273ebfb07fe0b6
|
|
| BLAKE2b-256 |
645bbede90865c61641c9bb58cbcea6bf97a53eb5a9bfeb4048475a0a7a1660f
|
File details
Details for the file telebee-1.0-py3-none-any.whl.
File metadata
- Download URL: telebee-1.0-py3-none-any.whl
- Upload date:
- Size: 3.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/6.1.0 CPython/3.12.9
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
962aec39aecf43a62d44c195d61a707fe9ff0004f101161f43ddf6412003b59b
|
|
| MD5 |
f1b4eb094655eb0a4928b662fc4e0070
|
|
| BLAKE2b-256 |
1d7e666b2f31c263d555d5154979db7826edecc12dbb9a62502f24a5d335cf5b
|