Pytdbot 0.8.8__tar.gz → 0.9.0.dev1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {Pytdbot-0.8.8 → Pytdbot-0.9.0.dev1}/PKG-INFO +31 -29
- {Pytdbot-0.8.8 → Pytdbot-0.9.0.dev1}/Pytdbot.egg-info/PKG-INFO +31 -29
- Pytdbot-0.9.0.dev1/Pytdbot.egg-info/SOURCES.txt +37 -0
- {Pytdbot-0.8.8 → Pytdbot-0.9.0.dev1}/Pytdbot.egg-info/requires.txt +1 -0
- {Pytdbot-0.8.8 → Pytdbot-0.9.0.dev1}/README.md +30 -28
- {Pytdbot-0.8.8 → Pytdbot-0.9.0.dev1}/pytdbot/__init__.py +3 -1
- {Pytdbot-0.8.8 → Pytdbot-0.9.0.dev1}/pytdbot/client.py +359 -228
- {Pytdbot-0.8.8 → Pytdbot-0.9.0.dev1}/pytdbot/handlers/decorators.py +38 -1
- {Pytdbot-0.8.8 → Pytdbot-0.9.0.dev1}/pytdbot/handlers/handler.py +3 -1
- Pytdbot-0.8.8/pytdbot/handlers/updates.py → Pytdbot-0.9.0.dev1/pytdbot/handlers/td_updates.py +450 -144
- Pytdbot-0.9.0.dev1/pytdbot/methods/methods.py +1396 -0
- Pytdbot-0.9.0.dev1/pytdbot/methods/td_functions.py +19071 -0
- {Pytdbot-0.8.8 → Pytdbot-0.9.0.dev1}/pytdbot/tdjson/tdjson.py +11 -25
- Pytdbot-0.9.0.dev1/pytdbot/types/__init__.py +3597 -0
- Pytdbot-0.9.0.dev1/pytdbot/types/td_types/__init__.py +1 -0
- Pytdbot-0.9.0.dev1/pytdbot/types/td_types/bound_methods/__init__.py +3 -0
- {Pytdbot-0.8.8/pytdbot/types/update → Pytdbot-0.9.0.dev1/pytdbot/types/td_types/bound_methods}/chatActions.py +50 -17
- Pytdbot-0.9.0.dev1/pytdbot/types/td_types/bound_methods/file.py +32 -0
- Pytdbot-0.9.0.dev1/pytdbot/types/td_types/bound_methods/message.py +772 -0
- Pytdbot-0.9.0.dev1/pytdbot/types/td_types/types.py +79148 -0
- {Pytdbot-0.8.8 → Pytdbot-0.9.0.dev1}/pytdbot/utils/__init__.py +14 -0
- Pytdbot-0.9.0.dev1/pytdbot/utils/json_utils.py +23 -0
- Pytdbot-0.9.0.dev1/pytdbot/utils/obj_encoder.py +38 -0
- Pytdbot-0.9.0.dev1/pytdbot/utils/strings.py +33 -0
- {Pytdbot-0.8.8 → Pytdbot-0.9.0.dev1}/pytdbot/utils/text_format.py +38 -12
- {Pytdbot-0.8.8 → Pytdbot-0.9.0.dev1}/requirements.txt +1 -0
- Pytdbot-0.8.8/Pytdbot.egg-info/SOURCES.txt +0 -55
- Pytdbot-0.8.8/pytdbot/generate_files.py +0 -145
- Pytdbot-0.8.8/pytdbot/generate_json.py +0 -92
- Pytdbot-0.8.8/pytdbot/methods/methods.py +0 -1789
- Pytdbot-0.8.8/pytdbot/methods/tdlibfunctions.py +0 -17709
- Pytdbot-0.8.8/pytdbot/td_api.json +0 -36311
- Pytdbot-0.8.8/pytdbot/td_api.tl +0 -10841
- Pytdbot-0.8.8/pytdbot/types/__init__.py +0 -45
- Pytdbot-0.8.8/pytdbot/types/buttons/__init__.py +0 -15
- Pytdbot-0.8.8/pytdbot/types/buttons/base.py +0 -4
- Pytdbot-0.8.8/pytdbot/types/buttons/force_reply.py +0 -33
- Pytdbot-0.8.8/pytdbot/types/buttons/inline_keyboard.py +0 -228
- Pytdbot-0.8.8/pytdbot/types/buttons/remove_keyboard.py +0 -25
- Pytdbot-0.8.8/pytdbot/types/buttons/show_keyboard.py +0 -254
- Pytdbot-0.8.8/pytdbot/types/inputfile/__init__.py +0 -15
- Pytdbot-0.8.8/pytdbot/types/inputfile/base.py +0 -6
- Pytdbot-0.8.8/pytdbot/types/inputfile/input_file_generated.py +0 -39
- Pytdbot-0.8.8/pytdbot/types/inputfile/input_file_id.py +0 -14
- Pytdbot-0.8.8/pytdbot/types/inputfile/input_file_local.py +0 -21
- Pytdbot-0.8.8/pytdbot/types/inputfile/input_file_remote.py +0 -14
- Pytdbot-0.8.8/pytdbot/types/inputfile/input_thumbnail.py +0 -29
- Pytdbot-0.8.8/pytdbot/types/logstream/__init__.py +0 -7
- Pytdbot-0.8.8/pytdbot/types/logstream/base.py +0 -8
- Pytdbot-0.8.8/pytdbot/types/logstream/log_stream_default.py +0 -8
- Pytdbot-0.8.8/pytdbot/types/logstream/log_stream_empty.py +0 -8
- Pytdbot-0.8.8/pytdbot/types/logstream/log_stream_file.py +0 -40
- Pytdbot-0.8.8/pytdbot/types/result/__init__.py +0 -3
- Pytdbot-0.8.8/pytdbot/types/result/result.py +0 -100
- Pytdbot-0.8.8/pytdbot/types/update/__init__.py +0 -4
- Pytdbot-0.8.8/pytdbot/types/update/update.py +0 -1736
- {Pytdbot-0.8.8 → Pytdbot-0.9.0.dev1}/LICENSE +0 -0
- {Pytdbot-0.8.8 → Pytdbot-0.9.0.dev1}/MANIFEST.in +0 -0
- {Pytdbot-0.8.8 → Pytdbot-0.9.0.dev1}/Pytdbot.egg-info/dependency_links.txt +0 -0
- {Pytdbot-0.8.8 → Pytdbot-0.9.0.dev1}/Pytdbot.egg-info/top_level.txt +0 -0
- {Pytdbot-0.8.8 → Pytdbot-0.9.0.dev1}/pytdbot/exception/__init__.py +0 -0
- {Pytdbot-0.8.8 → Pytdbot-0.9.0.dev1}/pytdbot/filters.py +0 -0
- {Pytdbot-0.8.8 → Pytdbot-0.9.0.dev1}/pytdbot/handlers/__init__.py +0 -0
- {Pytdbot-0.8.8 → Pytdbot-0.9.0.dev1}/pytdbot/methods/__init__.py +0 -0
- {Pytdbot-0.8.8 → Pytdbot-0.9.0.dev1}/pytdbot/tdjson/__init__.py +0 -0
- {Pytdbot-0.8.8 → Pytdbot-0.9.0.dev1}/pytdbot/types/plugins/__init__.py +0 -0
- {Pytdbot-0.8.8 → Pytdbot-0.9.0.dev1}/pytdbot/utils/escape.py +0 -0
- {Pytdbot-0.8.8 → Pytdbot-0.9.0.dev1}/setup.cfg +0 -0
- {Pytdbot-0.8.8 → Pytdbot-0.9.0.dev1}/setup.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: Pytdbot
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.9.0.dev1
|
|
4
4
|
Summary: Easy-to-use asynchronous TDLib wrapper for Python.
|
|
5
5
|
Home-page: https://github.com/pytdbot/client
|
|
6
6
|
Author: AYMEN Mohammed
|
|
@@ -14,16 +14,23 @@ Requires-Python: >=3.9
|
|
|
14
14
|
Description-Content-Type: text/markdown
|
|
15
15
|
License-File: LICENSE
|
|
16
16
|
|
|
17
|
-
# Pytdbot [](https://pypi.org/project/Pytdbot) [](https://pypi.org/project/Pytdbot) [](https://github.com/tdlib/td) [](https://pepy.tech/project/pytdbot)
|
|
18
18
|
|
|
19
19
|
Pytdbot (Python TDLib) is an asynchronous [**TDLib**](https://github.com/tdlib/td) wrapper for **Telegram** users/bots written in **Python**.
|
|
20
20
|
|
|
21
21
|
### Features
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
- **
|
|
26
|
-
-
|
|
22
|
+
|
|
23
|
+
``Pytdbot`` offers numerous advantages, including:
|
|
24
|
+
|
|
25
|
+
- **Easy to Use**: Designed with simplicity in mind, making it accessible for developers
|
|
26
|
+
- **Performance**: Fast and powerful, making it ready to fight
|
|
27
|
+
- **Asynchronous**: Fully asynchronous that allows for non-blocking requests and improved responsiveness
|
|
28
|
+
- **Scalable**: Easily scalable using [TDLib Server](https://github.com/pytdbot/tdlib-server)
|
|
29
|
+
- **Well-typed**: Provides clear and well-defined methods and types to enhance developer experience
|
|
30
|
+
- **Decorator-Based Updates**: Simplifies the implementation of update handlers through a decorator pattern
|
|
31
|
+
- **Bound Methods**: Features types bound methods for improved usability
|
|
32
|
+
- **Unlimited Support**: Supports **Userbots**, **Plugins**, [**filters**](pytdbot/filters.py#L23), [**TDLib**](https://github.com/tdlib/td) types/functions and much more
|
|
33
|
+
|
|
27
34
|
|
|
28
35
|
|
|
29
36
|
### Requirements
|
|
@@ -32,6 +39,7 @@ Pytdbot (Python TDLib) is an asynchronous [**TDLib**](https://github.com/tdlib/t
|
|
|
32
39
|
- Telegram [API key](https://my.telegram.org/apps)
|
|
33
40
|
- [tdjson](https://github.com/tdlib/td#building)
|
|
34
41
|
- [deepdiff](https://github.com/seperman/deepdiff)
|
|
42
|
+
- [aio-pika](https://github.com/mosquito/aio-pika)
|
|
35
43
|
|
|
36
44
|
### Installation
|
|
37
45
|
> For better performance, it's recommended to install [orjson](https://github.com/ijl/orjson#install) or [ujson](https://github.com/ultrajson/ultrajson#ultrajson).
|
|
@@ -49,41 +57,35 @@ pip install git+https://github.com/pytdbot/client.git
|
|
|
49
57
|
Basic example:
|
|
50
58
|
```python
|
|
51
59
|
|
|
52
|
-
|
|
53
|
-
|
|
60
|
+
import asyncio
|
|
61
|
+
|
|
62
|
+
from pytdbot import Client, types
|
|
54
63
|
|
|
55
64
|
client = Client(
|
|
65
|
+
token="1088394097:AAQX2DnWiw4ihwiJUhIHOGog8gGOI", # Your bot token or phone number if you want to login as user
|
|
56
66
|
api_id=0,
|
|
57
67
|
api_hash="API_HASH",
|
|
58
|
-
database_encryption_key="1234echobot$",
|
|
59
|
-
token="1088394097:AAQX2DnWiw4ihwiJUhIHOGog8gGOI", # Your bot token or phone number if you want to login as user
|
|
60
|
-
files_directory="BotDB", # Path where to store TDLib files
|
|
61
68
|
lib_path="/path/to/libtdjson.so", # Path to TDjson shared library
|
|
62
|
-
|
|
69
|
+
files_directory="BotDB", # Path where to store TDLib files
|
|
70
|
+
database_encryption_key="1234echobot$",
|
|
63
71
|
td_verbosity=2, # TDLib verbosity level
|
|
72
|
+
td_log=types.LogStreamFile("tdlib.log", 104857600), # Set TDLib log file path
|
|
64
73
|
)
|
|
65
74
|
|
|
66
75
|
|
|
67
76
|
@client.on_updateNewMessage()
|
|
68
|
-
async def print_message(c: Client, message:
|
|
77
|
+
async def print_message(c: Client, message: types.UpdateNewMessage):
|
|
69
78
|
print(message)
|
|
70
79
|
|
|
71
80
|
|
|
72
|
-
@client.
|
|
73
|
-
async def
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
"\\- Current chat ID: {}\n\\- {} ID: {}".format(
|
|
81
|
-
utils.code(str(message.chat_id)),
|
|
82
|
-
utils.bold(c.me["first_name"]),
|
|
83
|
-
utils.code(str(message.from_id)),
|
|
84
|
-
),
|
|
85
|
-
parse_mode="markdownv2",
|
|
86
|
-
)
|
|
81
|
+
@client.on_message()
|
|
82
|
+
async def say_hello(c: Client, message: types.Message):
|
|
83
|
+
msg = await message.reply_text(f"Hey {await message.mention(parse_mode='html')}! I'm cooking up a surprise... 🍳👨🍳", parse_mode="html")
|
|
84
|
+
|
|
85
|
+
async with message.action("choose_sticker"):
|
|
86
|
+
await asyncio.sleep(5)
|
|
87
|
+
|
|
88
|
+
await msg.edit_text("Boo! 👻 Just kidding.")
|
|
87
89
|
|
|
88
90
|
|
|
89
91
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.1
|
|
2
2
|
Name: Pytdbot
|
|
3
|
-
Version: 0.
|
|
3
|
+
Version: 0.9.0.dev1
|
|
4
4
|
Summary: Easy-to-use asynchronous TDLib wrapper for Python.
|
|
5
5
|
Home-page: https://github.com/pytdbot/client
|
|
6
6
|
Author: AYMEN Mohammed
|
|
@@ -14,16 +14,23 @@ Requires-Python: >=3.9
|
|
|
14
14
|
Description-Content-Type: text/markdown
|
|
15
15
|
License-File: LICENSE
|
|
16
16
|
|
|
17
|
-
# Pytdbot [](https://pypi.org/project/Pytdbot) [](https://pypi.org/project/Pytdbot) [](https://github.com/tdlib/td) [](https://pepy.tech/project/pytdbot)
|
|
18
18
|
|
|
19
19
|
Pytdbot (Python TDLib) is an asynchronous [**TDLib**](https://github.com/tdlib/td) wrapper for **Telegram** users/bots written in **Python**.
|
|
20
20
|
|
|
21
21
|
### Features
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
- **
|
|
26
|
-
-
|
|
22
|
+
|
|
23
|
+
``Pytdbot`` offers numerous advantages, including:
|
|
24
|
+
|
|
25
|
+
- **Easy to Use**: Designed with simplicity in mind, making it accessible for developers
|
|
26
|
+
- **Performance**: Fast and powerful, making it ready to fight
|
|
27
|
+
- **Asynchronous**: Fully asynchronous that allows for non-blocking requests and improved responsiveness
|
|
28
|
+
- **Scalable**: Easily scalable using [TDLib Server](https://github.com/pytdbot/tdlib-server)
|
|
29
|
+
- **Well-typed**: Provides clear and well-defined methods and types to enhance developer experience
|
|
30
|
+
- **Decorator-Based Updates**: Simplifies the implementation of update handlers through a decorator pattern
|
|
31
|
+
- **Bound Methods**: Features types bound methods for improved usability
|
|
32
|
+
- **Unlimited Support**: Supports **Userbots**, **Plugins**, [**filters**](pytdbot/filters.py#L23), [**TDLib**](https://github.com/tdlib/td) types/functions and much more
|
|
33
|
+
|
|
27
34
|
|
|
28
35
|
|
|
29
36
|
### Requirements
|
|
@@ -32,6 +39,7 @@ Pytdbot (Python TDLib) is an asynchronous [**TDLib**](https://github.com/tdlib/t
|
|
|
32
39
|
- Telegram [API key](https://my.telegram.org/apps)
|
|
33
40
|
- [tdjson](https://github.com/tdlib/td#building)
|
|
34
41
|
- [deepdiff](https://github.com/seperman/deepdiff)
|
|
42
|
+
- [aio-pika](https://github.com/mosquito/aio-pika)
|
|
35
43
|
|
|
36
44
|
### Installation
|
|
37
45
|
> For better performance, it's recommended to install [orjson](https://github.com/ijl/orjson#install) or [ujson](https://github.com/ultrajson/ultrajson#ultrajson).
|
|
@@ -49,41 +57,35 @@ pip install git+https://github.com/pytdbot/client.git
|
|
|
49
57
|
Basic example:
|
|
50
58
|
```python
|
|
51
59
|
|
|
52
|
-
|
|
53
|
-
|
|
60
|
+
import asyncio
|
|
61
|
+
|
|
62
|
+
from pytdbot import Client, types
|
|
54
63
|
|
|
55
64
|
client = Client(
|
|
65
|
+
token="1088394097:AAQX2DnWiw4ihwiJUhIHOGog8gGOI", # Your bot token or phone number if you want to login as user
|
|
56
66
|
api_id=0,
|
|
57
67
|
api_hash="API_HASH",
|
|
58
|
-
database_encryption_key="1234echobot$",
|
|
59
|
-
token="1088394097:AAQX2DnWiw4ihwiJUhIHOGog8gGOI", # Your bot token or phone number if you want to login as user
|
|
60
|
-
files_directory="BotDB", # Path where to store TDLib files
|
|
61
68
|
lib_path="/path/to/libtdjson.so", # Path to TDjson shared library
|
|
62
|
-
|
|
69
|
+
files_directory="BotDB", # Path where to store TDLib files
|
|
70
|
+
database_encryption_key="1234echobot$",
|
|
63
71
|
td_verbosity=2, # TDLib verbosity level
|
|
72
|
+
td_log=types.LogStreamFile("tdlib.log", 104857600), # Set TDLib log file path
|
|
64
73
|
)
|
|
65
74
|
|
|
66
75
|
|
|
67
76
|
@client.on_updateNewMessage()
|
|
68
|
-
async def print_message(c: Client, message:
|
|
77
|
+
async def print_message(c: Client, message: types.UpdateNewMessage):
|
|
69
78
|
print(message)
|
|
70
79
|
|
|
71
80
|
|
|
72
|
-
@client.
|
|
73
|
-
async def
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
"\\- Current chat ID: {}\n\\- {} ID: {}".format(
|
|
81
|
-
utils.code(str(message.chat_id)),
|
|
82
|
-
utils.bold(c.me["first_name"]),
|
|
83
|
-
utils.code(str(message.from_id)),
|
|
84
|
-
),
|
|
85
|
-
parse_mode="markdownv2",
|
|
86
|
-
)
|
|
81
|
+
@client.on_message()
|
|
82
|
+
async def say_hello(c: Client, message: types.Message):
|
|
83
|
+
msg = await message.reply_text(f"Hey {await message.mention(parse_mode='html')}! I'm cooking up a surprise... 🍳👨🍳", parse_mode="html")
|
|
84
|
+
|
|
85
|
+
async with message.action("choose_sticker"):
|
|
86
|
+
await asyncio.sleep(5)
|
|
87
|
+
|
|
88
|
+
await msg.edit_text("Boo! 👻 Just kidding.")
|
|
87
89
|
|
|
88
90
|
|
|
89
91
|
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
LICENSE
|
|
2
|
+
MANIFEST.in
|
|
3
|
+
README.md
|
|
4
|
+
requirements.txt
|
|
5
|
+
setup.py
|
|
6
|
+
Pytdbot.egg-info/PKG-INFO
|
|
7
|
+
Pytdbot.egg-info/SOURCES.txt
|
|
8
|
+
Pytdbot.egg-info/dependency_links.txt
|
|
9
|
+
Pytdbot.egg-info/requires.txt
|
|
10
|
+
Pytdbot.egg-info/top_level.txt
|
|
11
|
+
pytdbot/__init__.py
|
|
12
|
+
pytdbot/client.py
|
|
13
|
+
pytdbot/filters.py
|
|
14
|
+
pytdbot/exception/__init__.py
|
|
15
|
+
pytdbot/handlers/__init__.py
|
|
16
|
+
pytdbot/handlers/decorators.py
|
|
17
|
+
pytdbot/handlers/handler.py
|
|
18
|
+
pytdbot/handlers/td_updates.py
|
|
19
|
+
pytdbot/methods/__init__.py
|
|
20
|
+
pytdbot/methods/methods.py
|
|
21
|
+
pytdbot/methods/td_functions.py
|
|
22
|
+
pytdbot/tdjson/__init__.py
|
|
23
|
+
pytdbot/tdjson/tdjson.py
|
|
24
|
+
pytdbot/types/__init__.py
|
|
25
|
+
pytdbot/types/plugins/__init__.py
|
|
26
|
+
pytdbot/types/td_types/__init__.py
|
|
27
|
+
pytdbot/types/td_types/types.py
|
|
28
|
+
pytdbot/types/td_types/bound_methods/__init__.py
|
|
29
|
+
pytdbot/types/td_types/bound_methods/chatActions.py
|
|
30
|
+
pytdbot/types/td_types/bound_methods/file.py
|
|
31
|
+
pytdbot/types/td_types/bound_methods/message.py
|
|
32
|
+
pytdbot/utils/__init__.py
|
|
33
|
+
pytdbot/utils/escape.py
|
|
34
|
+
pytdbot/utils/json_utils.py
|
|
35
|
+
pytdbot/utils/obj_encoder.py
|
|
36
|
+
pytdbot/utils/strings.py
|
|
37
|
+
pytdbot/utils/text_format.py
|
|
@@ -1,13 +1,20 @@
|
|
|
1
|
-
# Pytdbot [](https://pypi.org/project/Pytdbot) [](https://pypi.org/project/Pytdbot) [](https://github.com/tdlib/td) [](https://pepy.tech/project/pytdbot)
|
|
2
2
|
|
|
3
3
|
Pytdbot (Python TDLib) is an asynchronous [**TDLib**](https://github.com/tdlib/td) wrapper for **Telegram** users/bots written in **Python**.
|
|
4
4
|
|
|
5
5
|
### Features
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
- **
|
|
10
|
-
-
|
|
6
|
+
|
|
7
|
+
``Pytdbot`` offers numerous advantages, including:
|
|
8
|
+
|
|
9
|
+
- **Easy to Use**: Designed with simplicity in mind, making it accessible for developers
|
|
10
|
+
- **Performance**: Fast and powerful, making it ready to fight
|
|
11
|
+
- **Asynchronous**: Fully asynchronous that allows for non-blocking requests and improved responsiveness
|
|
12
|
+
- **Scalable**: Easily scalable using [TDLib Server](https://github.com/pytdbot/tdlib-server)
|
|
13
|
+
- **Well-typed**: Provides clear and well-defined methods and types to enhance developer experience
|
|
14
|
+
- **Decorator-Based Updates**: Simplifies the implementation of update handlers through a decorator pattern
|
|
15
|
+
- **Bound Methods**: Features types bound methods for improved usability
|
|
16
|
+
- **Unlimited Support**: Supports **Userbots**, **Plugins**, [**filters**](pytdbot/filters.py#L23), [**TDLib**](https://github.com/tdlib/td) types/functions and much more
|
|
17
|
+
|
|
11
18
|
|
|
12
19
|
|
|
13
20
|
### Requirements
|
|
@@ -16,6 +23,7 @@ Pytdbot (Python TDLib) is an asynchronous [**TDLib**](https://github.com/tdlib/t
|
|
|
16
23
|
- Telegram [API key](https://my.telegram.org/apps)
|
|
17
24
|
- [tdjson](https://github.com/tdlib/td#building)
|
|
18
25
|
- [deepdiff](https://github.com/seperman/deepdiff)
|
|
26
|
+
- [aio-pika](https://github.com/mosquito/aio-pika)
|
|
19
27
|
|
|
20
28
|
### Installation
|
|
21
29
|
> For better performance, it's recommended to install [orjson](https://github.com/ijl/orjson#install) or [ujson](https://github.com/ultrajson/ultrajson#ultrajson).
|
|
@@ -33,41 +41,35 @@ pip install git+https://github.com/pytdbot/client.git
|
|
|
33
41
|
Basic example:
|
|
34
42
|
```python
|
|
35
43
|
|
|
36
|
-
|
|
37
|
-
|
|
44
|
+
import asyncio
|
|
45
|
+
|
|
46
|
+
from pytdbot import Client, types
|
|
38
47
|
|
|
39
48
|
client = Client(
|
|
49
|
+
token="1088394097:AAQX2DnWiw4ihwiJUhIHOGog8gGOI", # Your bot token or phone number if you want to login as user
|
|
40
50
|
api_id=0,
|
|
41
51
|
api_hash="API_HASH",
|
|
42
|
-
database_encryption_key="1234echobot$",
|
|
43
|
-
token="1088394097:AAQX2DnWiw4ihwiJUhIHOGog8gGOI", # Your bot token or phone number if you want to login as user
|
|
44
|
-
files_directory="BotDB", # Path where to store TDLib files
|
|
45
52
|
lib_path="/path/to/libtdjson.so", # Path to TDjson shared library
|
|
46
|
-
|
|
53
|
+
files_directory="BotDB", # Path where to store TDLib files
|
|
54
|
+
database_encryption_key="1234echobot$",
|
|
47
55
|
td_verbosity=2, # TDLib verbosity level
|
|
56
|
+
td_log=types.LogStreamFile("tdlib.log", 104857600), # Set TDLib log file path
|
|
48
57
|
)
|
|
49
58
|
|
|
50
59
|
|
|
51
60
|
@client.on_updateNewMessage()
|
|
52
|
-
async def print_message(c: Client, message:
|
|
61
|
+
async def print_message(c: Client, message: types.UpdateNewMessage):
|
|
53
62
|
print(message)
|
|
54
63
|
|
|
55
64
|
|
|
56
|
-
@client.
|
|
57
|
-
async def
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
"\\- Current chat ID: {}\n\\- {} ID: {}".format(
|
|
65
|
-
utils.code(str(message.chat_id)),
|
|
66
|
-
utils.bold(c.me["first_name"]),
|
|
67
|
-
utils.code(str(message.from_id)),
|
|
68
|
-
),
|
|
69
|
-
parse_mode="markdownv2",
|
|
70
|
-
)
|
|
65
|
+
@client.on_message()
|
|
66
|
+
async def say_hello(c: Client, message: types.Message):
|
|
67
|
+
msg = await message.reply_text(f"Hey {await message.mention(parse_mode='html')}! I'm cooking up a surprise... 🍳👨🍳", parse_mode="html")
|
|
68
|
+
|
|
69
|
+
async with message.action("choose_sticker"):
|
|
70
|
+
await asyncio.sleep(5)
|
|
71
|
+
|
|
72
|
+
await msg.edit_text("Boo! 👻 Just kidding.")
|
|
71
73
|
|
|
72
74
|
|
|
73
75
|
|
|
@@ -2,7 +2,9 @@ from . import types, utils, filters, exception
|
|
|
2
2
|
from .tdjson import TdJson
|
|
3
3
|
from .client import Client
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
__all__ = ["types", "utils", "filters", "exception", "TdJson", "Client"]
|
|
6
|
+
|
|
7
|
+
__version__ = "0.9.0dev1"
|
|
6
8
|
__copyright__ = "Copyright (c) 2022-2023 AYMEN Mohammed ~ https://github.com/AYMENJD"
|
|
7
9
|
__license__ = "MIT License"
|
|
8
10
|
|