Skip to main content

Flastel – New core to Telegram Bot.

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

Uploaded Python 3

File details

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

File metadata

  • Download URL: flastel-0.0.14.3b3.tar.gz
  • Upload date:
  • Size: 16.1 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.3b3.tar.gz
Algorithm Hash digest
SHA256 c0c58f8360fce5b628f641e549cac82527be57cb3022b8f2a547253a167d428d
MD5 85d2ba2bfa3ac448afa8d53b5e914132
BLAKE2b-256 d26ec5f5413d8291cc2254e2dd051cdaa32d250cb08bfc8a634aca11f5cd3a98

See more details on using hashes here.

File details

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

File metadata

  • Download URL: Flastel-0.0.14.3b3-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.3b3-py3-none-any.whl
Algorithm Hash digest
SHA256 00d1b7cd6a6be64941933b4d52c1c7e58a98181f573da037ece793887325bbd0
MD5 5ed3c6fbd4c265a7a301bffdad86ad2d
BLAKE2b-256 f5f63bc8e56daba150a8db7c6d38c36fde326f48b18b2f212a6a9adceacb5986

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