Skip to main content

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.

PyPI - Version
Python License
Status


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 polling or infinity_polling processes.
  • A flexible and easy-to-use library that allows developers to write code normally in separate files.
  • Supports organizing code in different directories.

Installation

  1. First, install the pyTelegramBotAPI library (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.

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()
    1. 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:

@bot.message_handler(commands=['start'])
def start_message(message):
    bot.reply_to(message, "Welcome to the bot!")

Example of functions/another_function.py:

@bot.message_handler(commands=['hello'])
def hello_message(message):
    bot.reply_to(message, "Hello, how are you?")
    1. Customizing directories:

You can customize the directories containing the code by passing them to TeleBee in the function_dirs argument.

telebee_bot = TeleBee(function_dirs=['your_custom_folder', 'another_folder'])
telebee_bot.load_functions()

For Contact:

Best Regards ♡

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

telebee-1.1.tar.gz (3.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

telebee-1.1-py3-none-any.whl (3.6 kB view details)

Uploaded Python 3

File details

Details for the file telebee-1.1.tar.gz.

File metadata

  • Download URL: telebee-1.1.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

Hashes for telebee-1.1.tar.gz
Algorithm Hash digest
SHA256 dfdd2661ec0e37c849f0fed2645e56ac1c6b698b7276c6f34c56e4d9cd36fea1
MD5 9893d2bfb33a32ef8cef4c56371991a7
BLAKE2b-256 d63e254e8d254323354fd80ab92b2063f7f4dee824701baba67a0472e96accaa

See more details on using hashes here.

File details

Details for the file telebee-1.1-py3-none-any.whl.

File metadata

  • Download URL: telebee-1.1-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

Hashes for telebee-1.1-py3-none-any.whl
Algorithm Hash digest
SHA256 2411c0ec874178a5f858503b4f683d77bd6cf92b7c79096e2e9eaad3ab83f5f0
MD5 fe9edd9c743ea7b072d4e5bfec10e3de
BLAKE2b-256 67d2c6cce01e9960f51089494f9c652327a166907072f5603b0f869b59454ab5

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page