Skip to main content

Flastel – New core to Telegram Bot.

Reason this release was yanked:

Баг

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.3.tar.gz (16.0 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.3-py3-none-any.whl (16.9 kB view details)

Uploaded Python 3

File details

Details for the file flastel-0.0.14.3.tar.gz.

File metadata

  • Download URL: flastel-0.0.14.3.tar.gz
  • Upload date:
  • Size: 16.0 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.3.tar.gz
Algorithm Hash digest
SHA256 b8003d0fd7b12ca746fca3166db7937e311e9c18e0fdd6a6cd8fd171c1f54891
MD5 45819c297efa4ed7477fd42439fecf97
BLAKE2b-256 9f5be26f9e21df9db09dc0409c9ba8d14a9b1469a41c054de7d2eca2ea30689d

See more details on using hashes here.

File details

Details for the file Flastel-0.0.14.3-py3-none-any.whl.

File metadata

  • Download URL: Flastel-0.0.14.3-py3-none-any.whl
  • Upload date:
  • Size: 16.9 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/5.1.1 CPython/3.12.3

File hashes

Hashes for Flastel-0.0.14.3-py3-none-any.whl
Algorithm Hash digest
SHA256 06011fc3fa91a34e3ad4ab2e6e26919535032f640d92a460d1d441c159bf2ee1
MD5 39b28974086d21d104959d01bd6020dd
BLAKE2b-256 57ecc613dbb7d320fc174a2371207f0a7654ca2e34fcaf107a535f2f0d97f50a

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