tlgr-cli 2.0.1__py3-none-any.whl
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.
- tlgr/__init__.py +3 -0
- tlgr/__main__.py +6 -0
- tlgr/actions/__init__.py +45 -0
- tlgr/actions/forward.py +74 -0
- tlgr/actions/reply.py +32 -0
- tlgr/cli/__init__.py +259 -0
- tlgr/cli/confirm.py +55 -0
- tlgr/cli/errors.py +84 -0
- tlgr/cli/gen.py +690 -0
- tlgr/cli/globals.py +273 -0
- tlgr/cli/introspect.py +170 -0
- tlgr/cli/params.py +189 -0
- tlgr/cli/render.py +418 -0
- tlgr/core/__init__.py +0 -0
- tlgr/core/accounts.py +384 -0
- tlgr/core/config.py +358 -0
- tlgr/core/custom_tl.py +170 -0
- tlgr/core/errors.py +687 -0
- tlgr/core/eventtypes.py +1170 -0
- tlgr/core/identity.py +127 -0
- tlgr/core/launchd.py +122 -0
- tlgr/core/logging.py +194 -0
- tlgr/core/media.py +134 -0
- tlgr/core/output.py +251 -0
- tlgr/core/pagination.py +227 -0
- tlgr/core/paths.py +360 -0
- tlgr/core/peers.py +427 -0
- tlgr/core/process.py +138 -0
- tlgr/core/signing.py +38 -0
- tlgr/core/systemd.py +96 -0
- tlgr/core/telethon_compat.py +295 -0
- tlgr/core/text.py +211 -0
- tlgr/core/timefmt.py +199 -0
- tlgr/core/tl.py +98 -0
- tlgr/daemon/__init__.py +0 -0
- tlgr/daemon/app.py +869 -0
- tlgr/daemon/dispatch.py +446 -0
- tlgr/daemon/events.py +723 -0
- tlgr/daemon/files.py +431 -0
- tlgr/daemon/idle.py +119 -0
- tlgr/daemon/jobs.py +68 -0
- tlgr/daemon/main.py +161 -0
- tlgr/daemon/peercred.py +75 -0
- tlgr/daemon/policy.py +113 -0
- tlgr/daemon/preauth.py +366 -0
- tlgr/daemon/ratelimit.py +391 -0
- tlgr/daemon/server.py +24 -0
- tlgr/daemon/session.py +648 -0
- tlgr/daemon/sessions.py +274 -0
- tlgr/daemon/singleton.py +114 -0
- tlgr/daemon/stream.py +193 -0
- tlgr/daemon/transfers.py +219 -0
- tlgr/daemon/webhook.py +390 -0
- tlgr/data/catalog_index.json +1 -0
- tlgr/data/parity_waivers.toml +90 -0
- tlgr/filters/__init__.py +42 -0
- tlgr/filters/compose.py +121 -0
- tlgr/filters/content.py +85 -0
- tlgr/filters/context.py +114 -0
- tlgr/filters/message.py +161 -0
- tlgr/filters/temporal.py +87 -0
- tlgr/filters/user.py +36 -0
- tlgr/gateway/__init__.py +1 -0
- tlgr/gateway/config.py +161 -0
- tlgr/gateway/engine.py +215 -0
- tlgr/gateway/event.py +22 -0
- tlgr/jobs/__init__.py +0 -0
- tlgr/jobs/base.py +81 -0
- tlgr/jobs/client.py +37 -0
- tlgr/models/__init__.py +1220 -0
- tlgr/models/admin.py +744 -0
- tlgr/models/auth.py +510 -0
- tlgr/models/base.py +81 -0
- tlgr/models/bot.py +576 -0
- tlgr/models/business.py +265 -0
- tlgr/models/call.py +586 -0
- tlgr/models/config.py +101 -0
- tlgr/models/contact.py +481 -0
- tlgr/models/daemon.py +336 -0
- tlgr/models/dialog.py +626 -0
- tlgr/models/envelope.py +68 -0
- tlgr/models/error.py +30 -0
- tlgr/models/event.py +79 -0
- tlgr/models/export.py +66 -0
- tlgr/models/gift.py +275 -0
- tlgr/models/inline.py +84 -0
- tlgr/models/location.py +115 -0
- tlgr/models/media.py +507 -0
- tlgr/models/message.py +584 -0
- tlgr/models/net.py +232 -0
- tlgr/models/notify.py +105 -0
- tlgr/models/page.py +32 -0
- tlgr/models/payment.py +172 -0
- tlgr/models/peer.py +400 -0
- tlgr/models/poll.py +119 -0
- tlgr/models/premium.py +161 -0
- tlgr/models/privacy.py +93 -0
- tlgr/models/profile.py +217 -0
- tlgr/models/reaction.py +160 -0
- tlgr/models/resolve.py +175 -0
- tlgr/models/settings.py +103 -0
- tlgr/models/stars.py +101 -0
- tlgr/models/sticker.py +243 -0
- tlgr/models/story.py +467 -0
- tlgr/models/sync.py +105 -0
- tlgr/models/todo.py +36 -0
- tlgr/models/webapp.py +89 -0
- tlgr/ops/__init__.py +63 -0
- tlgr/ops/_admin.py +313 -0
- tlgr/ops/_auth.py +599 -0
- tlgr/ops/_bots.py +586 -0
- tlgr/ops/_calls.py +535 -0
- tlgr/ops/_common.py +160 -0
- tlgr/ops/_layer.py +46 -0
- tlgr/ops/_media.py +592 -0
- tlgr/ops/_params.py +212 -0
- tlgr/ops/_rights.py +402 -0
- tlgr/ops/_send.py +593 -0
- tlgr/ops/_serialize.py +667 -0
- tlgr/ops/_settings.py +306 -0
- tlgr/ops/_spec.py +167 -0
- tlgr/ops/_story.py +743 -0
- tlgr/ops/account.py +2604 -0
- tlgr/ops/agent.py +937 -0
- tlgr/ops/auth.py +1282 -0
- tlgr/ops/bot.py +4880 -0
- tlgr/ops/business.py +1520 -0
- tlgr/ops/call.py +1610 -0
- tlgr/ops/chat.py +4025 -0
- tlgr/ops/chat_admin.py +929 -0
- tlgr/ops/chat_extra.py +1061 -0
- tlgr/ops/chat_invite.py +716 -0
- tlgr/ops/chat_manage.py +1691 -0
- tlgr/ops/chat_member.py +1357 -0
- tlgr/ops/chat_stats.py +902 -0
- tlgr/ops/chat_topic.py +905 -0
- tlgr/ops/conference.py +791 -0
- tlgr/ops/config.py +1698 -0
- tlgr/ops/contact.py +2330 -0
- tlgr/ops/daemon.py +1397 -0
- tlgr/ops/draft.py +299 -0
- tlgr/ops/emoji.py +343 -0
- tlgr/ops/events.py +1327 -0
- tlgr/ops/export.py +596 -0
- tlgr/ops/folder.py +1322 -0
- tlgr/ops/gif.py +522 -0
- tlgr/ops/gift.py +1546 -0
- tlgr/ops/giveaway.py +541 -0
- tlgr/ops/inline.py +773 -0
- tlgr/ops/job.py +799 -0
- tlgr/ops/location.py +917 -0
- tlgr/ops/media.py +4495 -0
- tlgr/ops/message.py +3769 -0
- tlgr/ops/net.py +536 -0
- tlgr/ops/notify.py +840 -0
- tlgr/ops/passport.py +464 -0
- tlgr/ops/payment.py +907 -0
- tlgr/ops/poll.py +1078 -0
- tlgr/ops/premium.py +488 -0
- tlgr/ops/privacy.py +794 -0
- tlgr/ops/profile.py +1481 -0
- tlgr/ops/proxy.py +750 -0
- tlgr/ops/reaction.py +1475 -0
- tlgr/ops/resolve.py +1140 -0
- tlgr/ops/search.py +521 -0
- tlgr/ops/settings.py +1066 -0
- tlgr/ops/stars.py +594 -0
- tlgr/ops/sticker.py +1602 -0
- tlgr/ops/story.py +3216 -0
- tlgr/ops/sync.py +788 -0
- tlgr/ops/todo.py +514 -0
- tlgr/ops/user.py +1406 -0
- tlgr/ops/vc.py +2351 -0
- tlgr/ops/webapp.py +717 -0
- tlgr/ops/webhook.py +418 -0
- tlgr/parity.py +386 -0
- tlgr/processors/__init__.py +125 -0
- tlgr/processors/regex.py +26 -0
- tlgr/processors/text.py +56 -0
- tlgr/registry.py +519 -0
- tlgr/schema.py +173 -0
- tlgr/transport/__init__.py +30 -0
- tlgr/transport/autostart.py +293 -0
- tlgr/transport/client.py +805 -0
- tlgr/transport/ndjson.py +44 -0
- tlgr/version.py +31 -0
- tlgr_cli-2.0.1.dist-info/METADATA +957 -0
- tlgr_cli-2.0.1.dist-info/RECORD +192 -0
- tlgr_cli-2.0.1.dist-info/WHEEL +5 -0
- tlgr_cli-2.0.1.dist-info/entry_points.txt +2 -0
- tlgr_cli-2.0.1.dist-info/licenses/LICENSE +21 -0
- tlgr_cli-2.0.1.dist-info/top_level.txt +1 -0
tlgr/models/business.py
ADDED
|
@@ -0,0 +1,265 @@
|
|
|
1
|
+
"""Telegram Business: opening hours, location, intro, quick replies, links,
|
|
2
|
+
and the chatbot that may act on the account's behalf.
|
|
3
|
+
|
|
4
|
+
Two of these carry real risk and the models say so out loud.
|
|
5
|
+
|
|
6
|
+
* **`BotRights` is a full enumeration, never a mask.** Connecting a business
|
|
7
|
+
bot hands another program the ability to read, reply, edit the profile and
|
|
8
|
+
move Stars. A right that is absent from the model is a right nobody can
|
|
9
|
+
audit, so every flag of `businessBotRights` is named.
|
|
10
|
+
* **Opening hours are minutes-of-week, and that arithmetic is lossy.**
|
|
11
|
+
`BusinessOpen` keeps the server's raw minute offsets *and* the human
|
|
12
|
+
spelling, because "mon 09:00-18:00" cannot represent an interval that
|
|
13
|
+
crosses Sunday midnight and the server's vector can.
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
from __future__ import annotations
|
|
17
|
+
|
|
18
|
+
from typing import Any
|
|
19
|
+
|
|
20
|
+
from tlgr.models.base import Model
|
|
21
|
+
from tlgr.models.message import MessageEntity
|
|
22
|
+
from tlgr.models.peer import Peer
|
|
23
|
+
|
|
24
|
+
__all__ = [
|
|
25
|
+
"BotConnection",
|
|
26
|
+
"BotPaused",
|
|
27
|
+
"BotRights",
|
|
28
|
+
"BusinessAway",
|
|
29
|
+
"BusinessGreeting",
|
|
30
|
+
"BusinessIntro",
|
|
31
|
+
"BusinessLocation",
|
|
32
|
+
"BusinessMessage",
|
|
33
|
+
"BusinessOpen",
|
|
34
|
+
"BusinessProfile",
|
|
35
|
+
"BusinessRecipients",
|
|
36
|
+
"BusinessSet",
|
|
37
|
+
"ChatLink",
|
|
38
|
+
"ChatLinkSet",
|
|
39
|
+
"QuickReply",
|
|
40
|
+
"QuickReplyMessage",
|
|
41
|
+
"QuickReplySent",
|
|
42
|
+
"QuickReplySet",
|
|
43
|
+
"StarsTransferQuote",
|
|
44
|
+
"WorkHours",
|
|
45
|
+
]
|
|
46
|
+
|
|
47
|
+
|
|
48
|
+
class BusinessOpen(Model):
|
|
49
|
+
"""One opening interval.
|
|
50
|
+
|
|
51
|
+
`start_minute`/`end_minute` are minutes since Monday 00:00 in the
|
|
52
|
+
business's own timezone, which is what the server stores; `day` and the
|
|
53
|
+
two clock strings are the same interval said the way a human wrote it.
|
|
54
|
+
"""
|
|
55
|
+
|
|
56
|
+
start_minute: int
|
|
57
|
+
end_minute: int
|
|
58
|
+
day: str = ""
|
|
59
|
+
open: str = ""
|
|
60
|
+
close: str = ""
|
|
61
|
+
|
|
62
|
+
|
|
63
|
+
class WorkHours(Model):
|
|
64
|
+
timezone_id: str = ""
|
|
65
|
+
weekly_open: list[BusinessOpen] = []
|
|
66
|
+
#: Server-set and never sent back: whether the business is open right now.
|
|
67
|
+
open_now: bool | None = None
|
|
68
|
+
|
|
69
|
+
|
|
70
|
+
class BusinessLocation(Model):
|
|
71
|
+
address: str = ""
|
|
72
|
+
lat: float | None = None
|
|
73
|
+
lon: float | None = None
|
|
74
|
+
|
|
75
|
+
|
|
76
|
+
class BusinessIntro(Model):
|
|
77
|
+
title: str = ""
|
|
78
|
+
description: str = ""
|
|
79
|
+
sticker_id: int | None = None
|
|
80
|
+
|
|
81
|
+
|
|
82
|
+
class BusinessRecipients(Model):
|
|
83
|
+
"""Who a greeting/away message or a connected bot applies to."""
|
|
84
|
+
|
|
85
|
+
contacts: bool = False
|
|
86
|
+
non_contacts: bool = False
|
|
87
|
+
existing_chats: bool = False
|
|
88
|
+
new_chats: bool = False
|
|
89
|
+
exclude_selected: bool = False
|
|
90
|
+
users: list[int] = []
|
|
91
|
+
exclude_users: list[int] = []
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
class BusinessGreeting(Model):
|
|
95
|
+
shortcut_id: int = 0
|
|
96
|
+
shortcut: str | None = None
|
|
97
|
+
no_activity_days: int = 0
|
|
98
|
+
recipients: BusinessRecipients | None = None
|
|
99
|
+
enabled: bool = True
|
|
100
|
+
|
|
101
|
+
|
|
102
|
+
class BusinessAway(Model):
|
|
103
|
+
shortcut_id: int = 0
|
|
104
|
+
shortcut: str | None = None
|
|
105
|
+
#: always | outside-hours | custom
|
|
106
|
+
schedule: str = "always"
|
|
107
|
+
since: str | None = None
|
|
108
|
+
until: str | None = None
|
|
109
|
+
offline_only: bool = False
|
|
110
|
+
recipients: BusinessRecipients | None = None
|
|
111
|
+
enabled: bool = True
|
|
112
|
+
|
|
113
|
+
|
|
114
|
+
class BusinessMessage(Model):
|
|
115
|
+
"""`business message set`, whichever of the two it configured.
|
|
116
|
+
|
|
117
|
+
One shape for both, because a caller that just switched a greeting on
|
|
118
|
+
should not have to know that the away message answers with a different
|
|
119
|
+
struct — and the difference between them is two fields, not two ideas.
|
|
120
|
+
"""
|
|
121
|
+
|
|
122
|
+
#: greeting | away
|
|
123
|
+
kind: str
|
|
124
|
+
enabled: bool
|
|
125
|
+
shortcut_id: int = 0
|
|
126
|
+
shortcut: str | None = None
|
|
127
|
+
#: away only: always | outside-hours | custom
|
|
128
|
+
schedule: str | None = None
|
|
129
|
+
since: str | None = None
|
|
130
|
+
until: str | None = None
|
|
131
|
+
offline_only: bool = False
|
|
132
|
+
#: greeting only.
|
|
133
|
+
no_activity_days: int | None = None
|
|
134
|
+
recipients: BusinessRecipients | None = None
|
|
135
|
+
|
|
136
|
+
|
|
137
|
+
class BotRights(Model):
|
|
138
|
+
"""`businessBotRights`, every flag named. Absent means "not granted"."""
|
|
139
|
+
|
|
140
|
+
reply: bool = False
|
|
141
|
+
read_messages: bool = False
|
|
142
|
+
delete_sent_messages: bool = False
|
|
143
|
+
delete_received_messages: bool = False
|
|
144
|
+
edit_name: bool = False
|
|
145
|
+
edit_bio: bool = False
|
|
146
|
+
edit_username: bool = False
|
|
147
|
+
edit_profile_photo: bool = False
|
|
148
|
+
view_gifts: bool = False
|
|
149
|
+
sell_gifts: bool = False
|
|
150
|
+
change_gift_settings: bool = False
|
|
151
|
+
transfer_and_upgrade_gifts: bool = False
|
|
152
|
+
transfer_stars: bool = False
|
|
153
|
+
manage_stories: bool = False
|
|
154
|
+
|
|
155
|
+
|
|
156
|
+
class BotConnection(Model):
|
|
157
|
+
"""A chatbot connected to (or pending on) this account."""
|
|
158
|
+
|
|
159
|
+
bot_id: int = 0
|
|
160
|
+
bot: Peer | None = None
|
|
161
|
+
connection_id: str | None = None
|
|
162
|
+
recipients: BusinessRecipients | None = None
|
|
163
|
+
rights: BotRights | None = None
|
|
164
|
+
paused: bool = False
|
|
165
|
+
#: layer 229: a connection stays inert until the user confirms it.
|
|
166
|
+
confirmed: bool = True
|
|
167
|
+
disabled: bool = False
|
|
168
|
+
deleted: bool = False
|
|
169
|
+
date: str | None = None
|
|
170
|
+
dc_id: int | None = None
|
|
171
|
+
|
|
172
|
+
|
|
173
|
+
class BotPaused(Model):
|
|
174
|
+
chat_id: int
|
|
175
|
+
paused: bool | None = None
|
|
176
|
+
removed: bool = False
|
|
177
|
+
already: bool = False
|
|
178
|
+
|
|
179
|
+
|
|
180
|
+
class ChatLink(Model):
|
|
181
|
+
slug: str = ""
|
|
182
|
+
link: str = ""
|
|
183
|
+
title: str | None = None
|
|
184
|
+
message: str = ""
|
|
185
|
+
entities: list[MessageEntity] = []
|
|
186
|
+
views: int | None = None
|
|
187
|
+
|
|
188
|
+
|
|
189
|
+
class ChatLinkSet(Model):
|
|
190
|
+
slug: str | None = None
|
|
191
|
+
link: str | None = None
|
|
192
|
+
title: str | None = None
|
|
193
|
+
message: str | None = None
|
|
194
|
+
deleted: bool = False
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
class QuickReplyMessage(Model):
|
|
198
|
+
id: int
|
|
199
|
+
text: str = ""
|
|
200
|
+
entities: list[MessageEntity] = []
|
|
201
|
+
media: str | None = None
|
|
202
|
+
date: str | None = None
|
|
203
|
+
|
|
204
|
+
|
|
205
|
+
class QuickReply(Model):
|
|
206
|
+
shortcut_id: int
|
|
207
|
+
shortcut: str = ""
|
|
208
|
+
count: int = 0
|
|
209
|
+
top_message: int | None = None
|
|
210
|
+
messages: list[QuickReplyMessage] = []
|
|
211
|
+
|
|
212
|
+
|
|
213
|
+
class QuickReplySet(Model):
|
|
214
|
+
shortcut_id: int | None = None
|
|
215
|
+
shortcut: str | None = None
|
|
216
|
+
msg_id: int | None = None
|
|
217
|
+
msg_ids: list[int] = []
|
|
218
|
+
deleted: int = 0
|
|
219
|
+
order: list[int] = []
|
|
220
|
+
already: bool = False
|
|
221
|
+
|
|
222
|
+
|
|
223
|
+
class QuickReplySent(Model):
|
|
224
|
+
chat_id: int
|
|
225
|
+
shortcut_id: int = 0
|
|
226
|
+
message_ids: list[int] = []
|
|
227
|
+
|
|
228
|
+
|
|
229
|
+
class BusinessProfile(Model):
|
|
230
|
+
"""`business get`: the whole Business screen in one object."""
|
|
231
|
+
|
|
232
|
+
work_hours: WorkHours | None = None
|
|
233
|
+
open_now: bool | None = None
|
|
234
|
+
location: BusinessLocation | None = None
|
|
235
|
+
greeting: BusinessGreeting | None = None
|
|
236
|
+
away: BusinessAway | None = None
|
|
237
|
+
intro: BusinessIntro | None = None
|
|
238
|
+
sponsored_enabled: bool | None = None
|
|
239
|
+
connected_bots: list[BotConnection] = []
|
|
240
|
+
chat_links: list[ChatLink] = []
|
|
241
|
+
timezones: list[dict[str, Any]] = []
|
|
242
|
+
premium: bool = False
|
|
243
|
+
|
|
244
|
+
|
|
245
|
+
class BusinessSet(Model):
|
|
246
|
+
work_hours: WorkHours | None = None
|
|
247
|
+
location: BusinessLocation | None = None
|
|
248
|
+
intro: BusinessIntro | None = None
|
|
249
|
+
changed: list[str] = []
|
|
250
|
+
already: bool = False
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
class StarsTransferQuote(Model):
|
|
254
|
+
"""What a Stars transfer to a business bot *would* cost.
|
|
255
|
+
|
|
256
|
+
`ok` is false and `reason` says why: tlgr reads the payment form and
|
|
257
|
+
never signs it (see `ops/payment.py`).
|
|
258
|
+
"""
|
|
259
|
+
|
|
260
|
+
bot_id: int
|
|
261
|
+
ok: bool
|
|
262
|
+
stars: int = 0
|
|
263
|
+
currency: str = "XTR"
|
|
264
|
+
reason: str = ""
|
|
265
|
+
form_id: int | None = None
|