Skip to main content

pyTelegramBotApi wrapper

Project description

pyTelegramBotWrapper

PyPI - Python Version GitHub Release PyPI - Version GitHub License

Install

pip install --upgrade telebot_wrapper

Examples

Callback query

from telebot.types import CallbackQuery,  Message
from telebot.util import quick_markup

from telebot_wrapper.utils import compress_string, decompress_string

TOKEN = ""
bot = Bot(token=TOKEN)


@bot.callback_query_handler(lambda call: decompress_string(call.data) == "any")
def handle_callback_query(call: CallbackQuery, parsed_data: list[str]):
    print("ANY")
    bot.send_message(call.message.chat.id, f"Any | Parsed data: {parsed_data}")

@bot.callback_query_handler(lambda call: True)
def callback_query(call: CallbackQuery, parsed_data: list[str]):
    print("default")
    bot.send_message(call.message.chat.id, f"Parsed data: {parsed_data}")
    
    
        
@bot.message_handler(func=lambda message: True)
def message_handler(message: Message):
    markup = quick_markup({
        "btn": {"callback_data": compress_string("any")}
    })
    
    bot.reply_to(message, "txt", reply_markup=markup)

if __name__ == "__main__":
    bot.infinity_polling()

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

telebot_wrapper-0.2.0.tar.gz (2.7 kB view details)

Uploaded Source

Built Distribution

telebot_wrapper-0.2.0-py3-none-any.whl (3.5 kB view details)

Uploaded Python 3

File details

Details for the file telebot_wrapper-0.2.0.tar.gz.

File metadata

  • Download URL: telebot_wrapper-0.2.0.tar.gz
  • Upload date:
  • Size: 2.7 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Linux/6.8.0-36-generic

File hashes

Hashes for telebot_wrapper-0.2.0.tar.gz
Algorithm Hash digest
SHA256 b7ba936ff3e15367ce4c38f7deaa13759e4db1281e6150dde822c82a0b82e905
MD5 16035bddb21b68f3a43a9eba0b612c16
BLAKE2b-256 8948cbbbb73ee79b060529ec9b208909462874d17e1a3f70720f498120b8dee5

See more details on using hashes here.

File details

Details for the file telebot_wrapper-0.2.0-py3-none-any.whl.

File metadata

  • Download URL: telebot_wrapper-0.2.0-py3-none-any.whl
  • Upload date:
  • Size: 3.5 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: poetry/1.8.3 CPython/3.12.3 Linux/6.8.0-36-generic

File hashes

Hashes for telebot_wrapper-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 0eda8e9003def95638faf7858be0dd1e93573389b162e78f70d853f10fea3fe4
MD5 f3ee31f710e8e1c1d60a867985f9ee95
BLAKE2b-256 446457154db71578d68a25e2e2cebc7900be6f9d9cb20c5e5cbd37039f1b9196

See more details on using hashes here.

Supported by

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