RubigramClient 1.6.5__tar.gz → 1.6.6__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.
Potentially problematic release.
This version of RubigramClient might be problematic. Click here for more details.
- {rubigramclient-1.6.5 → rubigramclient-1.6.6}/PKG-INFO +2 -1
- {rubigramclient-1.6.5 → rubigramclient-1.6.6}/RubigramClient.egg-info/PKG-INFO +2 -1
- {rubigramclient-1.6.5 → rubigramclient-1.6.6}/RubigramClient.egg-info/requires.txt +1 -0
- {rubigramclient-1.6.5 → rubigramclient-1.6.6}/pyproject.toml +3 -2
- {rubigramclient-1.6.5 → rubigramclient-1.6.6}/rubigram/__init__.py +0 -2
- {rubigramclient-1.6.5 → rubigramclient-1.6.6}/rubigram/method.py +16 -16
- {rubigramclient-1.6.5 → rubigramclient-1.6.6}/rubigram/types.py +92 -220
- {rubigramclient-1.6.5 → rubigramclient-1.6.6}/LICENSE +0 -0
- {rubigramclient-1.6.5 → rubigramclient-1.6.6}/README.md +0 -0
- {rubigramclient-1.6.5 → rubigramclient-1.6.6}/RubigramClient.egg-info/SOURCES.txt +0 -0
- {rubigramclient-1.6.5 → rubigramclient-1.6.6}/RubigramClient.egg-info/dependency_links.txt +0 -0
- {rubigramclient-1.6.5 → rubigramclient-1.6.6}/RubigramClient.egg-info/top_level.txt +0 -0
- {rubigramclient-1.6.5 → rubigramclient-1.6.6}/rubigram/client.py +0 -0
- {rubigramclient-1.6.5 → rubigramclient-1.6.6}/rubigram/enums.py +0 -0
- {rubigramclient-1.6.5 → rubigramclient-1.6.6}/rubigram/filters.py +0 -0
- {rubigramclient-1.6.5 → rubigramclient-1.6.6}/rubigram/network.py +0 -0
- {rubigramclient-1.6.5 → rubigramclient-1.6.6}/rubigram/state.py +0 -0
- {rubigramclient-1.6.5 → rubigramclient-1.6.6}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: RubigramClient
|
|
3
|
-
Version: 1.6.
|
|
3
|
+
Version: 1.6.6
|
|
4
4
|
Summary: A simple and flexible Python library for building advanced Rubika bots with powerful message handling, inline buttons, and custom filters.
|
|
5
5
|
Author-email: Javad RZ <MrJavad.Email@gmail.com>
|
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -11,6 +11,7 @@ Description-Content-Type: text/markdown
|
|
|
11
11
|
License-File: LICENSE
|
|
12
12
|
Requires-Dist: aiohttp
|
|
13
13
|
Requires-Dist: aiofiles
|
|
14
|
+
Requires-Dist: pydantic
|
|
14
15
|
Dynamic: license-file
|
|
15
16
|
|
|
16
17
|
# Rubigram
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: RubigramClient
|
|
3
|
-
Version: 1.6.
|
|
3
|
+
Version: 1.6.6
|
|
4
4
|
Summary: A simple and flexible Python library for building advanced Rubika bots with powerful message handling, inline buttons, and custom filters.
|
|
5
5
|
Author-email: Javad RZ <MrJavad.Email@gmail.com>
|
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -11,6 +11,7 @@ Description-Content-Type: text/markdown
|
|
|
11
11
|
License-File: LICENSE
|
|
12
12
|
Requires-Dist: aiohttp
|
|
13
13
|
Requires-Dist: aiofiles
|
|
14
|
+
Requires-Dist: pydantic
|
|
14
15
|
Dynamic: license-file
|
|
15
16
|
|
|
16
17
|
# Rubigram
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "RubigramClient"
|
|
3
|
-
version = "1.6.
|
|
3
|
+
version = "1.6.6"
|
|
4
4
|
description = "A simple and flexible Python library for building advanced Rubika bots with powerful message handling, inline buttons, and custom filters."
|
|
5
5
|
readme = "README.md"
|
|
6
6
|
requires-python = ">=3.7"
|
|
@@ -15,5 +15,6 @@ classifiers = [
|
|
|
15
15
|
]
|
|
16
16
|
dependencies = [
|
|
17
17
|
"aiohttp",
|
|
18
|
-
"aiofiles",
|
|
18
|
+
"aiofiles",
|
|
19
|
+
"pydantic"
|
|
19
20
|
]
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
from .network import Network
|
|
2
|
-
from
|
|
2
|
+
from rubigram import enums
|
|
3
3
|
from typing import Optional
|
|
4
4
|
from rubigram.types import Bot, Chat, Keypad, MessageId, Updates, BotCommand
|
|
5
5
|
|
|
@@ -28,7 +28,7 @@ class Method(Network):
|
|
|
28
28
|
return response["download_url"]
|
|
29
29
|
|
|
30
30
|
async def set_command(self, commands: list[BotCommand]):
|
|
31
|
-
response = await self.request("setCommands", {"bot_commands": [command.
|
|
31
|
+
response = await self.request("setCommands", {"bot_commands": [command.asdict() for command in commands]})
|
|
32
32
|
return response
|
|
33
33
|
|
|
34
34
|
async def update_bot_endpoint(self, url: str, type: enums.UpdateEndpointType):
|
|
@@ -42,10 +42,10 @@ class Method(Network):
|
|
|
42
42
|
await self.request("editChatKeypad", {"chat_id": chat_id, "chat_keypad_type": "Remove"})
|
|
43
43
|
|
|
44
44
|
async def edit_chat_keypad(self, chat_id: str, chat_keypad: Keypad):
|
|
45
|
-
await self.request("editChatKeypad", {"chat_id": chat_id, "chat_keypad_type": "New", "chat_keypad": chat_keypad.
|
|
45
|
+
await self.request("editChatKeypad", {"chat_id": chat_id, "chat_keypad_type": "New", "chat_keypad": chat_keypad.asdict()})
|
|
46
46
|
|
|
47
47
|
async def edit_message_keypad(self, chat_id: str, message_id: str, inline_keypad: Keypad):
|
|
48
|
-
await self.request("editMessageKeypad", {"chat_id": chat_id, "message_id": message_id, "inline_keypad": inline_keypad.
|
|
48
|
+
await self.request("editMessageKeypad", {"chat_id": chat_id, "message_id": message_id, "inline_keypad": inline_keypad.asdict()})
|
|
49
49
|
|
|
50
50
|
async def edit_message_text(self, chat_id: str, message_id: str, text: str):
|
|
51
51
|
await self.request("editMessageText", {"chat_id": chat_id, "message_id": message_id, "text": text})
|
|
@@ -71,8 +71,8 @@ class Method(Network):
|
|
|
71
71
|
data = {
|
|
72
72
|
"chat_id": chat_id,
|
|
73
73
|
"text": text,
|
|
74
|
-
"chat_keypad": chat_keypad.
|
|
75
|
-
"inline_keypad": inline_keypad.
|
|
74
|
+
"chat_keypad": chat_keypad.asdict() if chat_keypad else None,
|
|
75
|
+
"inline_keypad": inline_keypad.asdict() if inline_keypad else None,
|
|
76
76
|
"chat_keypad_type": chat_keypad_type,
|
|
77
77
|
"disable_notification": disable_notification,
|
|
78
78
|
"reply_to_message_id": reply_to_message_id
|
|
@@ -98,8 +98,8 @@ class Method(Network):
|
|
|
98
98
|
"chat_id": chat_id,
|
|
99
99
|
"question": question,
|
|
100
100
|
"options": options,
|
|
101
|
-
"chat_keypad": chat_keypad.
|
|
102
|
-
"inline_keypad": inline_keypad.
|
|
101
|
+
"chat_keypad": chat_keypad.asdict() if chat_keypad else None,
|
|
102
|
+
"inline_keypad": inline_keypad.asdict() if inline_keypad else None,
|
|
103
103
|
"disable_notification": disable_notification,
|
|
104
104
|
"reply_to_message_id": reply_to_message_id,
|
|
105
105
|
"chat_keypad_type": chat_keypad_type
|
|
@@ -125,8 +125,8 @@ class Method(Network):
|
|
|
125
125
|
"chat_id": chat_id,
|
|
126
126
|
"latitude": latitude,
|
|
127
127
|
"longitude": longitude,
|
|
128
|
-
"chat_keypad": chat_keypad.
|
|
129
|
-
"inline_keypad": inline_keypad.
|
|
128
|
+
"chat_keypad": chat_keypad.asdict() if chat_keypad else None,
|
|
129
|
+
"inline_keypad": inline_keypad.asdict() if inline_keypad else None,
|
|
130
130
|
"disable_notification": disable_notification,
|
|
131
131
|
"reply_to_message_id": reply_to_message_id,
|
|
132
132
|
"chat_keypad_type": chat_keypad_type
|
|
@@ -154,8 +154,8 @@ class Method(Network):
|
|
|
154
154
|
"first_name": first_name,
|
|
155
155
|
"last_name": last_name,
|
|
156
156
|
"phone_number": phone_number,
|
|
157
|
-
"chat_keypad": chat_keypad.
|
|
158
|
-
"inline_keypad": inline_keypad.
|
|
157
|
+
"chat_keypad": chat_keypad.asdict() if chat_keypad else None,
|
|
158
|
+
"inline_keypad": inline_keypad.asdict() if inline_keypad else None,
|
|
159
159
|
"disable_notification": disable_notification,
|
|
160
160
|
"reply_to_message_id": reply_to_message_id,
|
|
161
161
|
"chat_keypad_type": chat_keypad_type
|
|
@@ -179,8 +179,8 @@ class Method(Network):
|
|
|
179
179
|
data = {
|
|
180
180
|
"chat_id": chat_id,
|
|
181
181
|
"sticker_id": sticker_id,
|
|
182
|
-
"chat_keypad": chat_keypad.
|
|
183
|
-
"inline_keypad": inline_keypad.
|
|
182
|
+
"chat_keypad": chat_keypad.asdict() if chat_keypad else None,
|
|
183
|
+
"inline_keypad": inline_keypad.asdict() if inline_keypad else None,
|
|
184
184
|
"disable_notification": disable_notification,
|
|
185
185
|
"reply_to_message_id": reply_to_message_id,
|
|
186
186
|
"chat_keypad_type": chat_keypad_type
|
|
@@ -223,8 +223,8 @@ class Method(Network):
|
|
|
223
223
|
"chat_id": chat_id,
|
|
224
224
|
"file_id": file_id,
|
|
225
225
|
"text": caption,
|
|
226
|
-
"chat_keypad": chat_keypad.
|
|
227
|
-
"inline_keypad": inline_keypad.
|
|
226
|
+
"chat_keypad": chat_keypad.asdict() if chat_keypad else None,
|
|
227
|
+
"inline_keypad": inline_keypad.asdict() if inline_keypad else None,
|
|
228
228
|
"disable_notification": disable_notification,
|
|
229
229
|
"reply_to_message_id": reply_to_message_id,
|
|
230
230
|
"chat_keypad_type": chat_keypad_type,
|
|
@@ -1,82 +1,24 @@
|
|
|
1
|
-
from
|
|
2
|
-
from
|
|
3
|
-
from
|
|
4
|
-
from enum import Enum
|
|
5
|
-
from . import enums
|
|
6
|
-
import rubigram
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
T = TypeVar("T", bound="DataManager")
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
@dataclass
|
|
13
|
-
class DataManager:
|
|
14
|
-
def to_dict(self) -> dict:
|
|
15
|
-
data = {}
|
|
16
|
-
for field in fields(self):
|
|
17
|
-
value = getattr(self, field.name)
|
|
18
|
-
if isinstance(value, Enum):
|
|
19
|
-
data[field.name] = value.value
|
|
20
|
-
elif is_dataclass(value):
|
|
21
|
-
data[field.name] = value.to_dict()
|
|
22
|
-
elif isinstance(value, list):
|
|
23
|
-
data[field.name] = [i.to_dict() if is_dataclass(i) else i for i in value]
|
|
24
|
-
else:
|
|
25
|
-
data[field.name] = value
|
|
26
|
-
return data
|
|
1
|
+
from typing import Optional, Any
|
|
2
|
+
from pydantic import BaseModel
|
|
3
|
+
from rubigram import enums
|
|
27
4
|
|
|
28
5
|
|
|
6
|
+
class DataManager(BaseModel):
|
|
7
|
+
class Config:
|
|
8
|
+
use_enum_values = True
|
|
9
|
+
arbitrary_types_allowed = True
|
|
10
|
+
|
|
29
11
|
@classmethod
|
|
30
|
-
def from_dict(
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
init_data[field.name] = field_type.from_dict(value)
|
|
41
|
-
|
|
42
|
-
elif origin == list:
|
|
43
|
-
inner_type = get_args(field_type)[0]
|
|
44
|
-
if isinstance(inner_type, type) and issubclass(inner_type, DataManager):
|
|
45
|
-
init_data[field.name] = [inner_type.from_dict(
|
|
46
|
-
v) if isinstance(v, dict) else v for v in (value or [])]
|
|
47
|
-
else:
|
|
48
|
-
init_data[field.name] = value or []
|
|
49
|
-
|
|
50
|
-
elif origin == Union:
|
|
51
|
-
args = get_args(field_type)
|
|
52
|
-
dict_type = next((a for a in args if isinstance(
|
|
53
|
-
a, type) and issubclass(a, DataManager)), None)
|
|
54
|
-
if dict_type and isinstance(value, dict):
|
|
55
|
-
init_data[field.name] = dict_type.from_dict(value)
|
|
56
|
-
else:
|
|
57
|
-
init_data[field.name] = value
|
|
58
|
-
|
|
59
|
-
else:
|
|
60
|
-
init_data[field.name] = value
|
|
61
|
-
|
|
62
|
-
return Class(**init_data)
|
|
63
|
-
|
|
64
|
-
def json(self):
|
|
65
|
-
def clear(object):
|
|
66
|
-
if isinstance(object, dict):
|
|
67
|
-
return {key: clear(value) for key, value in object.items() if value is not None}
|
|
68
|
-
elif isinstance(object, list):
|
|
69
|
-
return [clear(i) for i in object if i is not None]
|
|
70
|
-
else:
|
|
71
|
-
return object
|
|
72
|
-
|
|
73
|
-
data = self.to_dict()
|
|
74
|
-
data.pop("client", None)
|
|
75
|
-
clean_data = clear(data)
|
|
76
|
-
return dumps(clean_data, ensure_ascii=False, indent=4)
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
@dataclass
|
|
12
|
+
def from_dict(cls, data: dict):
|
|
13
|
+
return cls.model_validate(data or {})
|
|
14
|
+
|
|
15
|
+
def asdict(self, exclude_none: bool = True) -> dict:
|
|
16
|
+
return self.model_dump(exclude_none=exclude_none, exclude={"client"})
|
|
17
|
+
|
|
18
|
+
def asjson(self, exclude_none: bool = True) -> str:
|
|
19
|
+
return self.model_dump_json(indent=4, exclude_none=exclude_none, exclude={"client"})
|
|
20
|
+
|
|
21
|
+
|
|
80
22
|
class Chat(DataManager):
|
|
81
23
|
chat_id: Optional[str] = None
|
|
82
24
|
chat_type: Optional[enums.ChatType] = None
|
|
@@ -86,50 +28,30 @@ class Chat(DataManager):
|
|
|
86
28
|
title: Optional[str] = None
|
|
87
29
|
username: Optional[str] = None
|
|
88
30
|
|
|
89
|
-
def __repr__(self):
|
|
90
|
-
return self.json()
|
|
91
|
-
|
|
92
31
|
|
|
93
|
-
@dataclass
|
|
94
32
|
class File(DataManager):
|
|
95
33
|
file_id: Optional[str] = None
|
|
96
34
|
file_name: Optional[str] = None
|
|
97
35
|
size: Optional[str] = None
|
|
98
36
|
|
|
99
|
-
def __repr__(self):
|
|
100
|
-
return self.json()
|
|
101
37
|
|
|
102
|
-
|
|
103
|
-
@dataclass
|
|
104
38
|
class ForwardedFrom(DataManager):
|
|
105
39
|
type_from: Optional[enums.ForwardedFrom] = None
|
|
106
40
|
message_id: Optional[str] = None
|
|
107
41
|
from_chat_id: Optional[str] = None
|
|
108
42
|
from_sender_id: Optional[str] = None
|
|
109
43
|
|
|
110
|
-
def __repr__(self):
|
|
111
|
-
return self.json()
|
|
112
|
-
|
|
113
44
|
|
|
114
|
-
@dataclass
|
|
115
45
|
class PaymentStatus(DataManager):
|
|
116
46
|
payment_id: Optional[str] = None
|
|
117
47
|
status: Optional[enums.PaymentStatus] = None
|
|
118
48
|
|
|
119
|
-
def __repr__(self):
|
|
120
|
-
return self.json()
|
|
121
|
-
|
|
122
49
|
|
|
123
|
-
@dataclass
|
|
124
50
|
class MessageTextUpdate(DataManager):
|
|
125
51
|
message_id: Optional[str] = None
|
|
126
52
|
text: Optional[str] = None
|
|
127
53
|
|
|
128
|
-
def __repr__(self):
|
|
129
|
-
return self.json()
|
|
130
54
|
|
|
131
|
-
|
|
132
|
-
@dataclass
|
|
133
55
|
class Bot(DataManager):
|
|
134
56
|
bot_id: Optional[str] = None
|
|
135
57
|
bot_title: Optional[str] = None
|
|
@@ -139,40 +61,24 @@ class Bot(DataManager):
|
|
|
139
61
|
start_message: Optional[str] = None
|
|
140
62
|
share_url: Optional[str] = None
|
|
141
63
|
|
|
142
|
-
def __repr__(self):
|
|
143
|
-
return self.json()
|
|
144
|
-
|
|
145
64
|
|
|
146
|
-
@dataclass
|
|
147
65
|
class BotCommand(DataManager):
|
|
148
66
|
command: Optional[str] = None
|
|
149
67
|
description: Optional[str] = None
|
|
150
68
|
|
|
151
|
-
def __repr__(self):
|
|
152
|
-
return self.json()
|
|
153
|
-
|
|
154
69
|
|
|
155
|
-
@dataclass
|
|
156
70
|
class Sticker(DataManager):
|
|
157
71
|
sticker_id: Optional[str] = None
|
|
158
72
|
file: Optional[File] = None
|
|
159
73
|
emoji_character: Optional[str] = None
|
|
160
74
|
|
|
161
|
-
def __repr__(self):
|
|
162
|
-
return self.json()
|
|
163
75
|
|
|
164
|
-
|
|
165
|
-
@dataclass
|
|
166
76
|
class ContactMessage(DataManager):
|
|
167
77
|
phone_number: Optional[str] = None
|
|
168
78
|
first_name: Optional[str] = None
|
|
169
79
|
last_name: Optional[str] = None
|
|
170
80
|
|
|
171
|
-
def __repr__(self):
|
|
172
|
-
return self.json()
|
|
173
|
-
|
|
174
81
|
|
|
175
|
-
@dataclass
|
|
176
82
|
class PollStatus(DataManager):
|
|
177
83
|
state: Optional[enums.PollStatus] = None
|
|
178
84
|
selection_index: Optional[int] = None
|
|
@@ -180,30 +86,18 @@ class PollStatus(DataManager):
|
|
|
180
86
|
total_vote: Optional[int] = None
|
|
181
87
|
show_total_votes: Optional[bool] = None
|
|
182
88
|
|
|
183
|
-
def __repr__(self):
|
|
184
|
-
return self.json()
|
|
185
|
-
|
|
186
89
|
|
|
187
|
-
@dataclass
|
|
188
90
|
class Poll(DataManager):
|
|
189
91
|
question: Optional[str] = None
|
|
190
92
|
options: Optional[list[str]] = None
|
|
191
93
|
poll_status: Optional[PollStatus] = None
|
|
192
94
|
|
|
193
|
-
def __repr__(self):
|
|
194
|
-
return self.json()
|
|
195
95
|
|
|
196
|
-
|
|
197
|
-
@dataclass
|
|
198
96
|
class Location(DataManager):
|
|
199
97
|
longitude: Optional[str] = None
|
|
200
98
|
latitude: Optional[str] = None
|
|
201
99
|
|
|
202
|
-
def __repr__(self):
|
|
203
|
-
return self.json()
|
|
204
|
-
|
|
205
100
|
|
|
206
|
-
@dataclass
|
|
207
101
|
class LiveLocation(DataManager):
|
|
208
102
|
start_time: Optional[str] = None
|
|
209
103
|
live_period: Optional[int] = None
|
|
@@ -212,21 +106,13 @@ class LiveLocation(DataManager):
|
|
|
212
106
|
status: Optional[enums.LiveLocationStatus] = None
|
|
213
107
|
last_update_time: Optional[str] = None
|
|
214
108
|
|
|
215
|
-
def __repr__(self):
|
|
216
|
-
return self.json()
|
|
217
|
-
|
|
218
109
|
|
|
219
|
-
@dataclass
|
|
220
110
|
class ButtonSelectionItem(DataManager):
|
|
221
111
|
text: Optional[str] = None
|
|
222
112
|
image_url: Optional[str] = None
|
|
223
113
|
type: Optional[enums.ButtonSelectionType] = None
|
|
224
114
|
|
|
225
|
-
def __repr__(self):
|
|
226
|
-
return self.json()
|
|
227
115
|
|
|
228
|
-
|
|
229
|
-
@dataclass
|
|
230
116
|
class ButtonSelection(DataManager):
|
|
231
117
|
selection_id: Optional[str] = None
|
|
232
118
|
search_type: Optional[str] = None
|
|
@@ -236,11 +122,7 @@ class ButtonSelection(DataManager):
|
|
|
236
122
|
columns_count: Optional[str] = None
|
|
237
123
|
title: Optional[str] = None
|
|
238
124
|
|
|
239
|
-
def __repr__(self):
|
|
240
|
-
return self.json()
|
|
241
|
-
|
|
242
125
|
|
|
243
|
-
@dataclass
|
|
244
126
|
class ButtonCalendar(DataManager):
|
|
245
127
|
default_value: Optional[str] = None
|
|
246
128
|
type: Optional[enums.ButtonCalendarType] = None
|
|
@@ -248,32 +130,20 @@ class ButtonCalendar(DataManager):
|
|
|
248
130
|
max_year: Optional[str] = None
|
|
249
131
|
title: Optional[str] = None
|
|
250
132
|
|
|
251
|
-
def __repr__(self):
|
|
252
|
-
return self.json()
|
|
253
|
-
|
|
254
133
|
|
|
255
|
-
@dataclass
|
|
256
134
|
class ButtonNumberPicker(DataManager):
|
|
257
135
|
min_value: Optional[str] = None
|
|
258
136
|
max_value: Optional[str] = None
|
|
259
137
|
default_value: Optional[str] = None
|
|
260
138
|
title: Optional[str] = None
|
|
261
139
|
|
|
262
|
-
def __repr__(self):
|
|
263
|
-
return self.json()
|
|
264
140
|
|
|
265
|
-
|
|
266
|
-
@dataclass
|
|
267
141
|
class ButtonStringPicker(DataManager):
|
|
268
142
|
items: Optional[list[str]] = None
|
|
269
143
|
default_value: Optional[str] = None
|
|
270
144
|
title: Optional[str] = None
|
|
271
145
|
|
|
272
|
-
def __repr__(self):
|
|
273
|
-
return self.json()
|
|
274
|
-
|
|
275
146
|
|
|
276
|
-
@dataclass
|
|
277
147
|
class ButtonTextbox(DataManager):
|
|
278
148
|
type_line: Optional[enums.ButtonTextboxTypeLine] = None
|
|
279
149
|
type_keypad: Optional[enums.ButtonTextboxTypeKeypad] = None
|
|
@@ -281,11 +151,7 @@ class ButtonTextbox(DataManager):
|
|
|
281
151
|
title: Optional[str] = None
|
|
282
152
|
default_value: Optional[str] = None
|
|
283
153
|
|
|
284
|
-
def __repr__(self):
|
|
285
|
-
return self.json()
|
|
286
154
|
|
|
287
|
-
|
|
288
|
-
@dataclass
|
|
289
155
|
class ButtonLocation(DataManager):
|
|
290
156
|
default_pointer_location: Optional[Location] = None
|
|
291
157
|
default_map_location: Optional[Location] = None
|
|
@@ -293,49 +159,29 @@ class ButtonLocation(DataManager):
|
|
|
293
159
|
title: Optional[str] = None
|
|
294
160
|
location_image_url: Optional[str] = None
|
|
295
161
|
|
|
296
|
-
def __repr__(self):
|
|
297
|
-
return self.json()
|
|
298
|
-
|
|
299
162
|
|
|
300
|
-
@dataclass
|
|
301
163
|
class OpenChatData(DataManager):
|
|
302
164
|
object_guid: Optional[str] = None
|
|
303
165
|
object_type: Optional[enums.ChatType] = None
|
|
304
166
|
|
|
305
|
-
def __repr__(self):
|
|
306
|
-
return self.json()
|
|
307
|
-
|
|
308
167
|
|
|
309
|
-
@dataclass
|
|
310
168
|
class JoinChannelData(DataManager):
|
|
311
169
|
username: Optional[str] = None
|
|
312
170
|
ask_join: bool = False
|
|
313
171
|
|
|
314
|
-
def __repr__(self):
|
|
315
|
-
return self.json()
|
|
316
172
|
|
|
317
|
-
|
|
318
|
-
@dataclass
|
|
319
173
|
class ButtonLink(DataManager):
|
|
320
174
|
type: Optional[enums.ButtonLinkType] = None
|
|
321
175
|
link_url: Optional[str] = None
|
|
322
176
|
joinchannel_data: Optional[JoinChannelData] = None
|
|
323
177
|
open_chat_data: Optional[OpenChatData] = None
|
|
324
178
|
|
|
325
|
-
def __repr__(self):
|
|
326
|
-
return self.json()
|
|
327
|
-
|
|
328
179
|
|
|
329
|
-
@dataclass
|
|
330
180
|
class AuxData(DataManager):
|
|
331
181
|
start_id: Optional[str] = None
|
|
332
182
|
button_id: Optional[str] = None
|
|
333
183
|
|
|
334
|
-
def __repr__(self):
|
|
335
|
-
return self.json()
|
|
336
|
-
|
|
337
184
|
|
|
338
|
-
@dataclass
|
|
339
185
|
class Button(DataManager):
|
|
340
186
|
id: Optional[str] = None
|
|
341
187
|
button_text: Optional[str] = None
|
|
@@ -349,34 +195,21 @@ class Button(DataManager):
|
|
|
349
195
|
button_link: Optional[ButtonLink] = None
|
|
350
196
|
|
|
351
197
|
|
|
352
|
-
@dataclass
|
|
353
198
|
class KeypadRow(DataManager):
|
|
354
199
|
buttons: list[Button]
|
|
355
200
|
|
|
356
|
-
def __repr__(self):
|
|
357
|
-
return self.json()
|
|
358
201
|
|
|
359
|
-
|
|
360
|
-
@dataclass
|
|
361
202
|
class Keypad(DataManager):
|
|
362
203
|
rows: list[KeypadRow]
|
|
363
204
|
resize_keyboard: bool = True
|
|
364
205
|
on_time_keyboard: bool = False
|
|
365
206
|
|
|
366
|
-
def __repr__(self):
|
|
367
|
-
return self.json()
|
|
368
|
-
|
|
369
207
|
|
|
370
|
-
@dataclass
|
|
371
208
|
class MessageKeypadUpdate(DataManager):
|
|
372
209
|
message_id: Optional[str] = None
|
|
373
210
|
inline_keypad: Optional[Keypad] = None
|
|
374
211
|
|
|
375
|
-
def __repr__(self):
|
|
376
|
-
return self.json()
|
|
377
|
-
|
|
378
212
|
|
|
379
|
-
@dataclass
|
|
380
213
|
class Message(DataManager):
|
|
381
214
|
message_id: Optional[str] = None
|
|
382
215
|
text: Optional[str] = None
|
|
@@ -395,19 +228,12 @@ class Message(DataManager):
|
|
|
395
228
|
poll: Optional[Poll] = None
|
|
396
229
|
live_location: Optional[LiveLocation] = None
|
|
397
230
|
|
|
398
|
-
def __repr__(self):
|
|
399
|
-
return self.json()
|
|
400
231
|
|
|
401
|
-
|
|
402
|
-
@dataclass
|
|
403
232
|
class MessageId(DataManager):
|
|
404
233
|
message_id: Optional[str] = None
|
|
405
234
|
file_id: Optional[str] = None
|
|
406
235
|
chat_id: Optional[str] = None
|
|
407
|
-
client: Optional[
|
|
408
|
-
|
|
409
|
-
def __repr__(self):
|
|
410
|
-
return self.json()
|
|
236
|
+
client: Optional[Any] = None
|
|
411
237
|
|
|
412
238
|
async def delete(self):
|
|
413
239
|
return await self.client.delete_message(self.chat_id, self.message_id)
|
|
@@ -422,9 +248,8 @@ class MessageId(DataManager):
|
|
|
422
248
|
return await self.client.forward_message(self.chat_id, self.message_id, chat_id)
|
|
423
249
|
|
|
424
250
|
|
|
425
|
-
@dataclass
|
|
426
251
|
class Update(DataManager):
|
|
427
|
-
client: Optional[
|
|
252
|
+
client: Optional[Any] = None
|
|
428
253
|
type: Optional[enums.UpdateType] = None
|
|
429
254
|
chat_id: Optional[str] = None
|
|
430
255
|
removed_message_id: Optional[str] = None
|
|
@@ -432,12 +257,12 @@ class Update(DataManager):
|
|
|
432
257
|
updated_message: Optional[Message] = None
|
|
433
258
|
updated_payment: Optional[PaymentStatus] = None
|
|
434
259
|
|
|
435
|
-
def __repr__(self):
|
|
436
|
-
return self.json()
|
|
437
|
-
|
|
438
260
|
async def download(self, file_name: str):
|
|
439
261
|
return await self.client.download_file(self.new_message.file.file_id, file_name)
|
|
440
262
|
|
|
263
|
+
async def forward(self, chat_id: str):
|
|
264
|
+
return await self.client.forward_message(self.chat_id, self.new_message.message_id, chat_id)
|
|
265
|
+
|
|
441
266
|
async def reply(
|
|
442
267
|
self,
|
|
443
268
|
text: str,
|
|
@@ -446,8 +271,16 @@ class Update(DataManager):
|
|
|
446
271
|
chat_keypad_type: Optional[enums.ChatKeypadType] = None,
|
|
447
272
|
disable_notification: bool = None,
|
|
448
273
|
) -> "MessageId":
|
|
449
|
-
return await self.client.send_message(
|
|
450
|
-
|
|
274
|
+
return await self.client.send_message(
|
|
275
|
+
self.chat_id,
|
|
276
|
+
text,
|
|
277
|
+
chat_keypad,
|
|
278
|
+
inline_keypad,
|
|
279
|
+
chat_keypad_type,
|
|
280
|
+
disable_notification,
|
|
281
|
+
self.new_message.message_id,
|
|
282
|
+
)
|
|
283
|
+
|
|
451
284
|
async def reply_poll(
|
|
452
285
|
self,
|
|
453
286
|
question: str,
|
|
@@ -455,10 +288,19 @@ class Update(DataManager):
|
|
|
455
288
|
chat_keypad: Keypad = None,
|
|
456
289
|
inline_keypad: Keypad = None,
|
|
457
290
|
chat_keypad_type: Optional[enums.ChatKeypadType] = None,
|
|
458
|
-
disable_notification: bool = False
|
|
291
|
+
disable_notification: bool = False,
|
|
459
292
|
) -> "MessageId":
|
|
460
|
-
return await self.client.send_poll(
|
|
461
|
-
|
|
293
|
+
return await self.client.send_poll(
|
|
294
|
+
self.chat_id,
|
|
295
|
+
question,
|
|
296
|
+
options,
|
|
297
|
+
chat_keypad,
|
|
298
|
+
inline_keypad,
|
|
299
|
+
chat_keypad_type,
|
|
300
|
+
disable_notification,
|
|
301
|
+
self.new_message.message_id,
|
|
302
|
+
)
|
|
303
|
+
|
|
462
304
|
async def reply_location(
|
|
463
305
|
self,
|
|
464
306
|
latitude: str,
|
|
@@ -468,8 +310,17 @@ class Update(DataManager):
|
|
|
468
310
|
chat_keypad_type: Optional[enums.ChatKeypadType] = None,
|
|
469
311
|
disable_notification: bool = False,
|
|
470
312
|
) -> "MessageId":
|
|
471
|
-
return await self.client.send_location(
|
|
472
|
-
|
|
313
|
+
return await self.client.send_location(
|
|
314
|
+
self.chat_id,
|
|
315
|
+
latitude,
|
|
316
|
+
longitude,
|
|
317
|
+
chat_keypad,
|
|
318
|
+
inline_keypad,
|
|
319
|
+
chat_keypad_type,
|
|
320
|
+
disable_notification,
|
|
321
|
+
self.new_message.message_id,
|
|
322
|
+
)
|
|
323
|
+
|
|
473
324
|
async def reply_contact(
|
|
474
325
|
self,
|
|
475
326
|
first_name: str,
|
|
@@ -480,8 +331,18 @@ class Update(DataManager):
|
|
|
480
331
|
chat_keypad_type: Optional[enums.ChatKeypadType] = None,
|
|
481
332
|
disable_notification: bool = False,
|
|
482
333
|
) -> "MessageId":
|
|
483
|
-
return await self.client.send_location(
|
|
484
|
-
|
|
334
|
+
return await self.client.send_location(
|
|
335
|
+
self.chat_id,
|
|
336
|
+
first_name,
|
|
337
|
+
last_name,
|
|
338
|
+
phone_number,
|
|
339
|
+
chat_keypad,
|
|
340
|
+
inline_keypad,
|
|
341
|
+
chat_keypad_type,
|
|
342
|
+
disable_notification,
|
|
343
|
+
self.new_message.message_id,
|
|
344
|
+
)
|
|
345
|
+
|
|
485
346
|
async def reply_sticker(
|
|
486
347
|
self,
|
|
487
348
|
sticker_id: str,
|
|
@@ -490,7 +351,15 @@ class Update(DataManager):
|
|
|
490
351
|
chat_keypad_type: Optional[enums.ChatKeypadType] = None,
|
|
491
352
|
disable_notification: bool = False,
|
|
492
353
|
) -> "MessageId":
|
|
493
|
-
return await self.client.send_message(
|
|
354
|
+
return await self.client.send_message(
|
|
355
|
+
self.chat_id,
|
|
356
|
+
sticker_id,
|
|
357
|
+
chat_keypad,
|
|
358
|
+
inline_keypad,
|
|
359
|
+
chat_keypad_type,
|
|
360
|
+
disable_notification,
|
|
361
|
+
self.new_message.message_id,
|
|
362
|
+
)
|
|
494
363
|
|
|
495
364
|
async def reply_file(
|
|
496
365
|
self,
|
|
@@ -503,7 +372,18 @@ class Update(DataManager):
|
|
|
503
372
|
chat_keypad_type: Optional[enums.ChatKeypadType] = None,
|
|
504
373
|
disable_notification: bool = False,
|
|
505
374
|
) -> "MessageId":
|
|
506
|
-
return await self.client.send_file(
|
|
375
|
+
return await self.client.send_file(
|
|
376
|
+
self.chat_id,
|
|
377
|
+
file,
|
|
378
|
+
file_name,
|
|
379
|
+
caption,
|
|
380
|
+
type,
|
|
381
|
+
chat_keypad,
|
|
382
|
+
inline_keypad,
|
|
383
|
+
chat_keypad_type,
|
|
384
|
+
disable_notification,
|
|
385
|
+
self.new_message.message_id,
|
|
386
|
+
)
|
|
507
387
|
|
|
508
388
|
async def reply_document(self, document: str, name: str, caption: Optional[str] = None, **kwargs) -> "MessageId":
|
|
509
389
|
return await self.reply_file(document, name, caption, "File", **kwargs)
|
|
@@ -524,25 +404,17 @@ class Update(DataManager):
|
|
|
524
404
|
return await self.reply_file(voice, name, caption, "Voice", **kwargs)
|
|
525
405
|
|
|
526
406
|
|
|
527
|
-
@dataclass
|
|
528
407
|
class Updates(DataManager):
|
|
529
|
-
updates: list[Update] = None
|
|
408
|
+
updates: Optional[list[Update]] = None
|
|
530
409
|
next_offset_id: Optional[str] = None
|
|
531
410
|
|
|
532
|
-
def __repr__(self):
|
|
533
|
-
return self.json()
|
|
534
|
-
|
|
535
411
|
|
|
536
|
-
@dataclass
|
|
537
412
|
class InlineMessage(DataManager):
|
|
538
|
-
client: Optional[
|
|
413
|
+
client: Optional[Any] = None
|
|
539
414
|
sender_id: Optional[str] = None
|
|
540
415
|
text: Optional[str] = None
|
|
541
416
|
message_id: Optional[str] = None
|
|
542
417
|
chat_id: Optional[str] = None
|
|
543
418
|
file: Optional[File] = None
|
|
544
419
|
location: Optional[Location] = None
|
|
545
|
-
aux_data: Optional[AuxData] = None
|
|
546
|
-
|
|
547
|
-
def __repr__(self):
|
|
548
|
-
return self.json()
|
|
420
|
+
aux_data: Optional[AuxData] = None
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|