# Simple Telegram Bot
A simple and easy-to-use Python library for Telegram bots. This library allows you to send messages, edit messages, fetch updates, and handle messages easily.
## Installation
Installation using pip (a Python package manager):
```
pip install simple-telegram-api
```
## Example
A simple echo bot:
```python
from simple_telegram_api import TelegramBot
BOT_TOKEN = "BOT_TOKEN"
bot = TelegramBot(BOT_TOKEN)
# Skip old messages before bot is running.
bot.reset_updates()
print("Bot is running.")
while True:
updates = bot.get_updates()
# Check if it's empty.
if updates:
print(updates)
bot.reset_updates(updates=updates)
# For multiple coming up messages.
for update in updates["result"]:
chat_id = update["message"]["chat"]["id"]
message_id = update["message"]["message_id"]
user_text = update["message"]["text"]
bot_message = bot.send_message(chat_id=chat_id, text=user_text)
```
## Recommendations
If `updates` is not provided in `reset_updates()`, new updates will be fetched automatically. Use the result from `get_updates()` as `updates`, as shown in the example.
## License
[MIT](https://choosealicense.com/licenses/mit/)
Raw data
{
"_id": null,
"home_page": null,
"name": "simple-telegram-api",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "python, telegram, telegram api, bot api, bot, api",
"author": "Ahmet Burhan Kayal\u0131",
"author_email": "ahmetburhan1703@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/02/e1/397ae79a1ca3a17a875a03c64273aeb8d5846c0d73a924a1f240b13e2c1a/simple_telegram_api-0.1.6.tar.gz",
"platform": null,
"description": "# Simple Telegram Bot\r\n\r\nA simple and easy-to-use Python library for Telegram bots. This library allows you to send messages, edit messages, fetch updates, and handle messages easily.\r\n\r\n## Installation\r\n\r\nInstallation using pip (a Python package manager):\r\n\r\n```\r\npip install simple-telegram-api\r\n```\r\n\r\n## Example\r\n\r\nA simple echo bot:\r\n\r\n```python\r\nfrom simple_telegram_api import TelegramBot\r\n\r\nBOT_TOKEN = \"BOT_TOKEN\"\r\n\r\nbot = TelegramBot(BOT_TOKEN)\r\n\r\n# Skip old messages before bot is running.\r\nbot.reset_updates()\r\n\r\nprint(\"Bot is running.\")\r\nwhile True:\r\n updates = bot.get_updates()\r\n\r\n # Check if it's empty.\r\n if updates:\r\n print(updates)\r\n bot.reset_updates(updates=updates)\r\n\r\n # For multiple coming up messages.\r\n for update in updates[\"result\"]:\r\n chat_id = update[\"message\"][\"chat\"][\"id\"]\r\n message_id = update[\"message\"][\"message_id\"]\r\n user_text = update[\"message\"][\"text\"]\r\n \r\n bot_message = bot.send_message(chat_id=chat_id, text=user_text)\r\n```\r\n\r\n## Recommendations\r\n\r\nIf `updates` is not provided in `reset_updates()`, new updates will be fetched automatically. Use the result from `get_updates()` as `updates`, as shown in the example.\r\n\r\n## License\r\n\r\n[MIT](https://choosealicense.com/licenses/mit/)\r\n\r\n",
"bugtrack_url": null,
"license": null,
"summary": "A simple telegram bot api",
"version": "0.1.6",
"project_urls": null,
"split_keywords": [
"python",
" telegram",
" telegram api",
" bot api",
" bot",
" api"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "287350a8877293ba365fdbe414b5d425fba7faab98b63bbe94e765306fd1d3a3",
"md5": "0ca7c183eab31a456d69d40db4f33255",
"sha256": "b2fad5f3c585fe83eed5d185bbc73a8cead1091be8bdfddd8c23668c909eb214"
},
"downloads": -1,
"filename": "simple_telegram_api-0.1.6-py3-none-any.whl",
"has_sig": false,
"md5_digest": "0ca7c183eab31a456d69d40db4f33255",
"packagetype": "bdist_wheel",
"python_version": "py3",
"requires_python": null,
"size": 3094,
"upload_time": "2024-08-16T17:37:25",
"upload_time_iso_8601": "2024-08-16T17:37:25.312556Z",
"url": "https://files.pythonhosted.org/packages/28/73/50a8877293ba365fdbe414b5d425fba7faab98b63bbe94e765306fd1d3a3/simple_telegram_api-0.1.6-py3-none-any.whl",
"yanked": false,
"yanked_reason": null
},
{
"comment_text": "",
"digests": {
"blake2b_256": "02e1397ae79a1ca3a17a875a03c64273aeb8d5846c0d73a924a1f240b13e2c1a",
"md5": "da87883a202df85f7034115dd7f95cf0",
"sha256": "bbc2b254697eab505846f854bc0f25726eb2c5e740b4a5fe6eeb807890b53c62"
},
"downloads": -1,
"filename": "simple_telegram_api-0.1.6.tar.gz",
"has_sig": false,
"md5_digest": "da87883a202df85f7034115dd7f95cf0",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 2655,
"upload_time": "2024-08-16T17:37:26",
"upload_time_iso_8601": "2024-08-16T17:37:26.731639Z",
"url": "https://files.pythonhosted.org/packages/02/e1/397ae79a1ca3a17a875a03c64273aeb8d5846c0d73a924a1f240b13e2c1a/simple_telegram_api-0.1.6.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2024-08-16 17:37:26",
"github": false,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"lcname": "simple-telegram-api"
}