## Installation
```bash
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](https://t.me/Flastele)
[PyPI](https://pypi.org/project/Flastel/)
[Wiki](https://github.com/DepyXa/Flastel/wiki)
## Support
For support, email gosdepyxa@gmail.com.
Raw data
{
"_id": null,
"home_page": "https://github.com/DepyXa/Flastel",
"name": "Flastel",
"maintainer": null,
"docs_url": null,
"requires_python": ">=3.6",
"maintainer_email": null,
"keywords": "Telegram Bot API",
"author": "DepyXa",
"author_email": "dere96632@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/77/b2/52fafad22a6fd59f73c6de5b2417065e40a8e4ae50960d103f87c1184b34/flastel-0.0.14.5.post1.tar.gz",
"platform": null,
"description": "\r\n## Installation\r\n\r\n```bash\r\n pip install flastel\r\n```\r\n \r\n\r\n# Flastel\r\nFlastel is a new module for creating a Telegram bot. \r\n You will be able to create several bots on your site by setting them up on your hosting. \r\n The \"polling\" mode is also supported. \r\n With the \"webhook\" method, you don't need multi-mode support.\r\n You no longer need to create a background specifically for the bot. \r\n This module supports weak hosting, which allows you to save money. \r\n\r\n\r\n\r\n## Usage/Examples\r\n\r\n```\r\nfrom Flastel import TelegramPollingBot\r\nimport asyncio\r\nimport logging\r\n\r\nlogging.basicConfig(level=logging.INFO)\r\nlogger = logging.getLogger(__name__)\r\n\r\nbot_token = \"bot_token\"\r\nbot = TelegramPollingBot(bot_token)\r\n\r\n@bot.command(commands=[\"/start\"], caps_ignore=False)\r\nasync def start_command(message):\r\n chat_id = message.chat_id\r\n from_user_name = message.from_user.all_name\r\n await bot.send_message(chat_id, f\"\u0420\u045f\u0421\u0402\u0420\u0451\u0420\u0406\u0421\u2013\u0421\u201a, {from_user_name}! \u0420\u00a6\u0420\u00b5 \u0421\u0403\u0421\u201a\u0420\u00b0\u0421\u0402\u0421\u201a\u0420\u0455\u0420\u0406\u0420\u00b0 \u0420\u0454\u0420\u0455\u0420\u0458\u0420\u00b0\u0420\u0405\u0420\u0491\u0420\u00b0.\", parse_mode=\"HTML\")\r\n \r\n@bot.command_with_params(commands=[\"/start\"], params=[\"play\", \"say\", \"pay\"])\r\nasync def start_command_with_params(message, params):\r\n chat_id = message.chat_id\r\n from_user_name = message.from_user.all_name\r\n await bot.send_message(chat_id, f\"\u0420\u045f\u0421\u0402\u0420\u0451\u0420\u0406\u0421\u2013\u0421\u201a, {from_user_name}! \u0420\u00a6\u0420\u00b5 \u0421\u0403\u0421\u201a\u0420\u00b0\u0421\u0402\u0421\u201a\u0420\u0455\u0420\u0406\u0420\u00b0 \u0420\u0454\u0420\u0455\u0420\u0458\u0420\u00b0\u0420\u0405\u0420\u0491\u0420\u00b0 \u0420\u00b7 \u0420\u0457\u0420\u00b0\u0421\u0402\u0420\u00b0\u0420\u0458\u0420\u00b5\u0421\u201a\u0421\u0402\u0420\u00b0\u0420\u0458\u0420\u0451 {params}.\")\r\n\r\n@bot.messages_text(messages_txt=[\"Hello\"], caps_ignore=True)\r\nasync def message_handler(message):\r\n chat_id = message.chat_id\r\n from_user_name = message.from_user.all_name\r\n await bot.send_message(chat_id, f\"\u0420\u045f\u0421\u0402\u0420\u0451\u0420\u0406\u0421\u2013\u0421\u201a, {from_user_name}! \u0420\u201d\u0421\u040f\u0420\u0454\u0421\u0453\u0421\u040b \u0420\u00b7\u0420\u00b0 \u0421\u201a\u0420\u00b0\u0420\u0454\u0421\u0453 \u0420\u0457\u0421\u0402\u0420\u0451\u0420\u0406\u0421\u2013\u0421\u201a\u0420\u0405\u0421\u2013\u0421\u0403\u0421\u201a\u0421\u040a.\")\r\n\r\n@bot.command(commands=[\"/donate\"], caps_ignore=False)\r\nasync def donate_command(message):\r\n user_id = message.chat_id\r\n title = '\u0420\u045c\u0420\u00b0 \u0421\u0402\u0420\u0455\u0420\u00b7\u0420\u0406\u0420\u0451\u0421\u201a\u0420\u0455\u0420\u0454 \u0420\u0458\u0420\u0455\u0420\u0491\u0421\u0453\u0420\u00bb\u0421\u040f'\r\n description = '\u0420\u045c\u0421\u040f, \u0420\u0405\u0420\u00b0\u0421\u0403\u0420\u0457\u0421\u0402\u0420\u00b0\u0420\u0406\u0420\u0491\u0421\u2013 \u0421\u2020\u0421\u2013 \u0420\u0454\u0420\u0455\u0421\u20ac\u0421\u201a\u0420\u0451 \u0420\u0457\u0421\u2013\u0420\u0491\u0421\u0453\u0421\u201a\u0421\u040a \u0420\u0405\u0420\u00b0 \u0420\u0454\u0420\u00b0\u0420\u0406\u0421\u0453 \u0421\u0402\u0420\u0455\u0420\u00b7\u0421\u0402\u0420\u0455\u0420\u00b1\u0420\u0405\u0420\u0451\u0420\u0454\u0421\u0453 \u041a\u2022\u0432\u0402\u045e\u041c\u0403\u0431\u0491\u0490\u0432\u0402\u045e\u041c\u0402\u041a\u201d\u0433\u0403\u0408'\r\n payload = 'new_donate'\r\n currency = 'XTR'\r\n prices = ['Donates', 10]\r\n await bot.send_pay(user_id, title, description, payload, currency, prices, in_support=False)\r\n\r\n@bot.pay_pre(currency=\"XTR\", prices=[10, 20])\r\nasync def handle_xtr_payment(query_data):\r\n await bot.ok_pay(query_data)\r\n\r\n@bot.successful_payment(currency=\"XTR\", prices=[10, 20])\r\nasync def handle_successful_xtr_payment(payment_data):\r\n chat_id = payment_data.chat_id\r\n await bot.send_message(chat_id,\r\n f\"\"\"\u0420\u201d\u0421\u040f\u0420\u0454\u0421\u0453\u0421\u040b \u0420\u00b7\u0420\u00b0 \u0420\u0454\u0421\u0402\u0421\u0453\u0420\u00b6\u0420\u00b5\u0421\u2021\u0420\u0454\u0421\u0453 \u0420\u0454\u0420\u00b0\u0420\u0406\u0420\u0451, \u0421\u201a\u0420\u00b5\u0420\u0457\u0420\u00b5\u0421\u0402 \u0420\u0405\u0420\u00b0 \u0421\u0453 \u0420\u0458\u0420\u00b5\u0420\u0405\u0420\u00b5 \u0420\u0405\u0420\u00b0 \u0420\u0455\u0420\u0491\u0420\u0405\u0421\u0453 \u0420\u0454\u0421\u0402\u0421\u0453\u0420\u00b6\u0420\u0454\u0421\u0453 \u0420\u00b1\u0421\u2013\u0420\u00bb\u0421\u040a\u0421\u20ac\u0420\u00b5!\r\n \u043f\u0458\u20ac\u0433\u0403\u0408\u043f\u0458\u0455\u0432\u2013\u0457\u043f\u0458\u0455\u043f\u0458\u2030\\n\u0431\u2022\u2122(^\u0432\u2013\u0457^-\u0431\u2022\u2122) {payment_data.total_amount}{payment_data.currency}\"\"\")\r\n\r\nif __name__ == \"__main__\":\r\n asyncio.run(bot.run_polling())\r\n```\r\n\r\n\r\n## Links\r\n[Telegram Chat](https://t.me/Flastele) \r\n[PyPI](https://pypi.org/project/Flastel/) \r\n[Wiki](https://github.com/DepyXa/Flastel/wiki)\r\n\r\n\r\n## Support\r\n\r\nFor support, email gosdepyxa@gmail.com.\r\n\r\n",
"bugtrack_url": null,
"license": null,
"summary": "Flastel \u2013 Telegram Bot API.",
"version": "0.0.14.5.post1",
"project_urls": {
"GitHub": "https://github.com/DepyXa",
"Homepage": "https://github.com/DepyXa/Flastel"
},
"split_keywords": [
"telegram",
"bot",
"api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "413ad219ff2fdb18d798ccbb1380e9db9965c65c876cf0ba343843ad41d1ebc9",
"md5": "582f1c3cc08ef8aa8e8e90e77c03b888",
"sha256": "eae4c13312a81baeae54c52a54367cb5a2f4887a7c44884cf3f96d1338a8af28"
},
"downloads": -1,
"filename": "Flastel-0.0.14.5.post1-py3-none-any.whl",
"has_sig": false,
"md5_digest": "582f1c3cc08ef8aa8e8e90e77c03b888",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": ">=3.6",
"size": 17448,
"upload_time": "2024-10-03T13:59:39",
"upload_time_iso_8601": "2024-10-03T13:59:39.036370Z",
"url": "https://files.pythonhosted.org/packages/41/3a/d219ff2fdb18d798ccbb1380e9db9965c65c876cf0ba343843ad41d1ebc9/Flastel-0.0.14.5.post1-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "77b252fafad22a6fd59f73c6de5b2417065e40a8e4ae50960d103f87c1184b34",
"md5": "bc387bf0750bb0a0760358dfe91f5dfb",
"sha256": "1a0120c3b3504c926d09e7a9ee538308b434c22178998ab34a17094421fa255b"
},
"downloads": -1,
"filename": "flastel-0.0.14.5.post1.tar.gz",
"has_sig": false,
"md5_digest": "bc387bf0750bb0a0760358dfe91f5dfb",
"packagetype": "sdist",
"python_version": "source",
"requires_python": ">=3.6",
"size": 16502,
"upload_time": "2024-10-03T13:59:40",
"upload_time_iso_8601": "2024-10-03T13:59:40.468057Z",
"url": "https://files.pythonhosted.org/packages/77/b2/52fafad22a6fd59f73c6de5b2417065e40a8e4ae50960d103f87c1184b34/flastel-0.0.14.5.post1.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-10-03 13:59:40",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "DepyXa",
"github_project": "Flastel",
"travis_ci": false,
"coveralls": false,
"github_actions": false,
"lcname": "flastel"
}