Pytdbot


NamePytdbot JSON
Version 0.8.8 PyPI version JSON
download
home_pagehttps://github.com/pytdbot/client
SummaryEasy-to-use asynchronous TDLib wrapper for Python.
upload_time2024-05-26 17:29:29
maintainerNone
docs_urlNone
authorAYMEN Mohammed
requires_python>=3.9
licenseMIT
keywords telegram tdlib bot telegram-client telegram-bot bot-api telegram-bot tdlib-python tdlib-bot
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # Pytdbot [![Version](https://img.shields.io/pypi/v/Pytdbot?style=flat&logo=pypi)](https://pypi.org/project/Pytdbot) [![TDLib version](https://img.shields.io/badge/TDLib-v1.8.29-blue?logo=telegram)](https://github.com/tdlib/td) [![Downloads](https://static.pepy.tech/personalized-badge/pytdbot?period=month&units=none&left_color=grey&right_color=brightgreen&left_text=Downloads)](https://pepy.tech/project/pytdbot)

Pytdbot (Python TDLib) is an asynchronous [**TDLib**](https://github.com/tdlib/td) wrapper for **Telegram** users/bots written in **Python**.  

### Features
- Easy, **Fast** and **Powerful**
- Fully **asynchronous**
- **Decorator** based update handler
- **Bound** methods
- Supports **userbots**, **Plugins**, [**Filters**](https://github.com/pytdbot/client/blob/ad33d05d3e48bc8842b3986613ad2d99480a1fa8/pytdbot/filters.py#L23), [**TDLib**](https://github.com/tdlib/td) functions and much more.


### Requirements

- Python 3.9+
- Telegram [API key](https://my.telegram.org/apps)
- [tdjson](https://github.com/tdlib/td#building)
- [deepdiff](https://github.com/seperman/deepdiff)

### Installation
> For better performance, it's recommended to install [orjson](https://github.com/ijl/orjson#install) or [ujson](https://github.com/ultrajson/ultrajson#ultrajson).

You can install Pytdbot using pip:
```bash
pip install pytdbot
```
To install the development version from Github, use the following command:
```bash
pip install git+https://github.com/pytdbot/client.git
```

### Examples
Basic example:
```python

from pytdbot import Client, utils
from pytdbot.types import LogStreamFile, Update

client = Client(
    api_id=0,  
    api_hash="API_HASH",  
    database_encryption_key="1234echobot$",
    token="1088394097:AAQX2DnWiw4ihwiJUhIHOGog8gGOI",  # Your bot token or phone number if you want to login as user
    files_directory="BotDB",  # Path where to store TDLib files
    lib_path="/path/to/libtdjson.so", # Path to TDjson shared library
    td_log=LogStreamFile("tdlib.log"),  # Set TDLib log file path
    td_verbosity=2,  # TDLib verbosity level
)


@client.on_updateNewMessage()
async def print_message(c: Client, message: Update):
    print(message)


@client.on_updateNewMessage()
async def simple_message(c: Client, message: Update):
    if message.is_private:
        await message.reply_text('Hi! i am simple bot')

    if message.is_self and message.text: # Works only for userbots.
        if message.text == "!id":
            await message.edit_text(
                "\\- Current chat ID: {}\n\\- {} ID: {}".format(
                    utils.code(str(message.chat_id)),
                    utils.bold(c.me["first_name"]),
                    utils.code(str(message.from_id)),
                ),
                parse_mode="markdownv2",
            )



# Run the client
client.run()

```
For more examples, check the [examples](https://github.com/pytdbot/client/tree/main/examples) folder.

# Thanks to
- You for viewing or using this project.

- [@levlam](https://github.com/levlam) for maintaining [TDLib](https://github.com/tdlib/td) and for the help to create [Pytdbot](https://github.com/pytdbot/client).
# License

MIT [License](https://github.com/pytdbot/client/blob/main/LICENSE)



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/pytdbot/client",
    "name": "Pytdbot",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.9",
    "maintainer_email": null,
    "keywords": "telegram, tdlib, bot, telegram-client, telegram-bot, bot-api, telegram-bot, tdlib-python, tdlib-bot",
    "author": "AYMEN Mohammed",
    "author_email": "let.me.code.safe@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/f0/23/aba5cae8321df85dab61c92556ac8e0b22efbd9653c1474e12dd2753085b/Pytdbot-0.8.8.tar.gz",
    "platform": null,
    "description": "# Pytdbot [![Version](https://img.shields.io/pypi/v/Pytdbot?style=flat&logo=pypi)](https://pypi.org/project/Pytdbot) [![TDLib version](https://img.shields.io/badge/TDLib-v1.8.29-blue?logo=telegram)](https://github.com/tdlib/td) [![Downloads](https://static.pepy.tech/personalized-badge/pytdbot?period=month&units=none&left_color=grey&right_color=brightgreen&left_text=Downloads)](https://pepy.tech/project/pytdbot)\n\nPytdbot (Python TDLib) is an asynchronous [**TDLib**](https://github.com/tdlib/td) wrapper for **Telegram** users/bots written in **Python**.  \n\n### Features\n- Easy, **Fast** and **Powerful**\n- Fully **asynchronous**\n- **Decorator** based update handler\n- **Bound** methods\n- Supports **userbots**, **Plugins**, [**Filters**](https://github.com/pytdbot/client/blob/ad33d05d3e48bc8842b3986613ad2d99480a1fa8/pytdbot/filters.py#L23), [**TDLib**](https://github.com/tdlib/td) functions and much more.\n\n\n### Requirements\n\n- Python 3.9+\n- Telegram [API key](https://my.telegram.org/apps)\n- [tdjson](https://github.com/tdlib/td#building)\n- [deepdiff](https://github.com/seperman/deepdiff)\n\n### Installation\n> For better performance, it's recommended to install [orjson](https://github.com/ijl/orjson#install) or [ujson](https://github.com/ultrajson/ultrajson#ultrajson).\n\nYou can install Pytdbot using pip:\n```bash\npip install pytdbot\n```\nTo install the development version from Github, use the following command:\n```bash\npip install git+https://github.com/pytdbot/client.git\n```\n\n### Examples\nBasic example:\n```python\n\nfrom pytdbot import Client, utils\nfrom pytdbot.types import LogStreamFile, Update\n\nclient = Client(\n    api_id=0,  \n    api_hash=\"API_HASH\",  \n    database_encryption_key=\"1234echobot$\",\n    token=\"1088394097:AAQX2DnWiw4ihwiJUhIHOGog8gGOI\",  # Your bot token or phone number if you want to login as user\n    files_directory=\"BotDB\",  # Path where to store TDLib files\n    lib_path=\"/path/to/libtdjson.so\", # Path to TDjson shared library\n    td_log=LogStreamFile(\"tdlib.log\"),  # Set TDLib log file path\n    td_verbosity=2,  # TDLib verbosity level\n)\n\n\n@client.on_updateNewMessage()\nasync def print_message(c: Client, message: Update):\n    print(message)\n\n\n@client.on_updateNewMessage()\nasync def simple_message(c: Client, message: Update):\n    if message.is_private:\n        await message.reply_text('Hi! i am simple bot')\n\n    if message.is_self and message.text: # Works only for userbots.\n        if message.text == \"!id\":\n            await message.edit_text(\n                \"\\\\- Current chat ID: {}\\n\\\\- {} ID: {}\".format(\n                    utils.code(str(message.chat_id)),\n                    utils.bold(c.me[\"first_name\"]),\n                    utils.code(str(message.from_id)),\n                ),\n                parse_mode=\"markdownv2\",\n            )\n\n\n\n# Run the client\nclient.run()\n\n```\nFor more examples, check the [examples](https://github.com/pytdbot/client/tree/main/examples) folder.\n\n# Thanks to\n- You for viewing or using this project.\n\n- [@levlam](https://github.com/levlam) for maintaining [TDLib](https://github.com/tdlib/td) and for the help to create [Pytdbot](https://github.com/pytdbot/client).\n# License\n\nMIT [License](https://github.com/pytdbot/client/blob/main/LICENSE)\n\n\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "Easy-to-use asynchronous TDLib wrapper for Python.",
    "version": "0.8.8",
    "project_urls": {
        "Homepage": "https://github.com/pytdbot/client",
        "Source": "https://github.com/pytdbot/client",
        "Tracker": "https://github.com/pytdbot/client/issues"
    },
    "split_keywords": [
        "telegram",
        " tdlib",
        " bot",
        " telegram-client",
        " telegram-bot",
        " bot-api",
        " telegram-bot",
        " tdlib-python",
        " tdlib-bot"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f023aba5cae8321df85dab61c92556ac8e0b22efbd9653c1474e12dd2753085b",
                "md5": "2ca60562900fcc49ed58bca077ad57ae",
                "sha256": "6ee8fb06d2e28818f5869936794666e94c2e8d07a5edf52d20bc3e51f15a5c44"
            },
            "downloads": -1,
            "filename": "Pytdbot-0.8.8.tar.gz",
            "has_sig": false,
            "md5_digest": "2ca60562900fcc49ed58bca077ad57ae",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.9",
            "size": 439066,
            "upload_time": "2024-05-26T17:29:29",
            "upload_time_iso_8601": "2024-05-26T17:29:29.881162Z",
            "url": "https://files.pythonhosted.org/packages/f0/23/aba5cae8321df85dab61c92556ac8e0b22efbd9653c1474e12dd2753085b/Pytdbot-0.8.8.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-26 17:29:29",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "pytdbot",
    "github_project": "client",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "requirements": [],
    "lcname": "pytdbot"
}
        
Elapsed time: 0.40957s