Skip to main content

Flastel – Telegram Bot API.

Project description

Installation

  pip install flastel

Flastel

Flastel is a new module for creating a Telegram bot.
You will be able to create several bots on your site by setting them up on your hosting.
The "polling" mode is also supported.
With the "webhook" method, you don't need multi-mode support. You no longer need to create a background specifically for the bot.
This module supports weak hosting, which allows you to save money.

Usage/Examples

from Flastel import TelegramPollingBot
import asyncio
import logging

logging.basicConfig(level=logging.INFO)
logger = logging.getLogger(__name__)

bot_token = "bot_token"
bot = TelegramPollingBot(bot_token)

@bot.command(commands=["/start"], caps_ignore=False)
async def start_command(message):
    chat_id = message.chat_id
    from_user_name = message.from_user.all_name
    await bot.send_message(chat_id, f"Привіт, {from_user_name}! Це стартова команда.", parse_mode="HTML")
    
@bot.command_with_params(commands=["/start"], params=["play", "say", "pay"])
async def start_command_with_params(message, params):
    chat_id = message.chat_id
    from_user_name = message.from_user.all_name
    await bot.send_message(chat_id, f"Привіт, {from_user_name}! Це стартова команда з параметрами {params}.")

@bot.messages_text(messages_txt=["Hello"],  caps_ignore=True)
async def message_handler(message):
    chat_id = message.chat_id
    from_user_name = message.from_user.all_name
    await bot.send_message(chat_id, f"Привіт, {from_user_name}! Дякую за таку привітність.")

@bot.command(commands=["/donate"], caps_ignore=False)
async def donate_command(message):
    user_id = message.chat_id
    title = 'На розвиток модуля'
    description = 'Ня, насправді ці кошти підуть на каву розробнику ʕ•́ᴥ•̀ʔっ'
    payload = 'new_donate'
    currency = 'XTR'
    prices = ['Donates', 10]
    await bot.send_pay(user_id, title, description, payload, currency, prices, in_support=False)

@bot.pay_pre(currency="XTR", prices=[10, 20])
async def handle_xtr_payment(query_data):
    await bot.ok_pay(query_data)

@bot.successful_payment(currency="XTR", prices=[10, 20])
async def handle_successful_xtr_payment(payment_data):
    chat_id = payment_data.chat_id
    await bot.send_message(chat_id,
                f"""Дякую за кружечку кави, тепер на у мене на одну кружку більше!
              пј€гЃЈпјѕв–їпјѕпј‰\nб•™(^в–ї^-б•™) {payment_data.total_amount}{payment_data.currency}""")

if __name__ == "__main__":
    asyncio.run(bot.run_polling())

Links

Telegram Chat
PyPI
Wiki

Support

For support, email gosdepyxa@gmail.com.

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

flastel-0.0.14.5.post1.tar.gz (16.5 kB view details)

Uploaded Source

Built Distribution

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

Flastel-0.0.14.5.post1-py3-none-any.whl (17.4 kB view details)

Uploaded Python 3

File details

Details for the file flastel-0.0.14.5.post1.tar.gz.

File metadata

  • Download URL: flastel-0.0.14.5.post1.tar.gz
  • Upload date:
  • Size: 16.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for flastel-0.0.14.5.post1.tar.gz
Algorithm Hash digest
SHA256 1a0120c3b3504c926d09e7a9ee538308b434c22178998ab34a17094421fa255b
MD5 bc387bf0750bb0a0760358dfe91f5dfb
BLAKE2b-256 77b252fafad22a6fd59f73c6de5b2417065e40a8e4ae50960d103f87c1184b34

See more details on using hashes here.

File details

Details for the file Flastel-0.0.14.5.post1-py3-none-any.whl.

File metadata

File hashes

Hashes for Flastel-0.0.14.5.post1-py3-none-any.whl
Algorithm Hash digest
SHA256 eae4c13312a81baeae54c52a54367cb5a2f4887a7c44884cf3f96d1338a8af28
MD5 582f1c3cc08ef8aa8e8e90e77c03b888
BLAKE2b-256 413ad219ff2fdb18d798ccbb1380e9db9965c65c876cf0ba343843ad41d1ebc9

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