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/admin.py
ADDED
|
@@ -0,0 +1,744 @@
|
|
|
1
|
+
"""Group and channel administration: members, invites, topics, logs, stats.
|
|
2
|
+
|
|
3
|
+
The shapes here are what the `chat member/admin/invite/topic/permission`,
|
|
4
|
+
`chat setting`, `chat stats` and `boost` operations answer with. Three
|
|
5
|
+
decisions run through the whole file.
|
|
6
|
+
|
|
7
|
+
* **A participant is never flattened into a user.** v1's `chat members`
|
|
8
|
+
returned `{id, first_name, username, is_bot}` and threw away the
|
|
9
|
+
`ChannelParticipant*` wrapper, so "who promoted this admin", "when did they
|
|
10
|
+
join", "what may they do" and "are they banned or merely restricted" were
|
|
11
|
+
all unanswerable. `Participant` keeps the wrapper: `status`, `rank`,
|
|
12
|
+
`date`, `inviter_id`, `promoted_by`, `kicked_by` and both rights masks.
|
|
13
|
+
* **Rights are always allow-polarity.** Telegram stores banned rights
|
|
14
|
+
inverted (`send_messages=True` means *cannot* send). `Rights` normalises
|
|
15
|
+
once, in `models/peer.py`, so every mask in this file reads the same way
|
|
16
|
+
and `chat permission get` round-trips into `chat permission set --allow`.
|
|
17
|
+
* **A graph is emitted verbatim.** `stats.*` answers with Telegram's own
|
|
18
|
+
chart specification; tlgr reports it as the API's JSON and never tries to
|
|
19
|
+
draw it, because a redrawn chart is a chart that can be wrong.
|
|
20
|
+
"""
|
|
21
|
+
|
|
22
|
+
from __future__ import annotations
|
|
23
|
+
|
|
24
|
+
from typing import Any
|
|
25
|
+
|
|
26
|
+
from tlgr.models.base import Model
|
|
27
|
+
from tlgr.models.message import Message
|
|
28
|
+
from tlgr.models.peer import Peer, Rights
|
|
29
|
+
|
|
30
|
+
__all__ = [
|
|
31
|
+
"AdminLogEvent",
|
|
32
|
+
"AdminResult",
|
|
33
|
+
"AffiliateBot",
|
|
34
|
+
"AffiliateResult",
|
|
35
|
+
"AntiSpamReport",
|
|
36
|
+
"Boost",
|
|
37
|
+
"BoostApplied",
|
|
38
|
+
"BoostStatus",
|
|
39
|
+
"ChatEditResult",
|
|
40
|
+
"ChatPhotoResult",
|
|
41
|
+
"ChatStats",
|
|
42
|
+
"CommunityResult",
|
|
43
|
+
"CommunityRow",
|
|
44
|
+
"CreatedChat",
|
|
45
|
+
"DirectBanResult",
|
|
46
|
+
"DirectDialog",
|
|
47
|
+
"DiscussionCandidate",
|
|
48
|
+
"DiscussionResult",
|
|
49
|
+
"Graph",
|
|
50
|
+
"Invite",
|
|
51
|
+
"InviteDeleted",
|
|
52
|
+
"InviteInfo",
|
|
53
|
+
"InvitePeek",
|
|
54
|
+
"InviteRevoked",
|
|
55
|
+
"JoinRequest",
|
|
56
|
+
"JoinResult",
|
|
57
|
+
"MemberResult",
|
|
58
|
+
"MembersAdded",
|
|
59
|
+
"MigrateResult",
|
|
60
|
+
"MissingInvitee",
|
|
61
|
+
"Participant",
|
|
62
|
+
"PermissionResult",
|
|
63
|
+
"PermissionView",
|
|
64
|
+
"PublicForward",
|
|
65
|
+
"RequestResult",
|
|
66
|
+
"RevenueSummary",
|
|
67
|
+
"RevenueTransaction",
|
|
68
|
+
"RightInfo",
|
|
69
|
+
"SendAsPeer",
|
|
70
|
+
"SendAsResult",
|
|
71
|
+
"SettingResult",
|
|
72
|
+
"SettingsView",
|
|
73
|
+
"SimilarChat",
|
|
74
|
+
"SponsoredReport",
|
|
75
|
+
"StatValue",
|
|
76
|
+
"SuggestedPostResult",
|
|
77
|
+
"SuggestionResult",
|
|
78
|
+
"Topic",
|
|
79
|
+
"TopicPinResult",
|
|
80
|
+
"TopicReadResult",
|
|
81
|
+
"TopicResult",
|
|
82
|
+
"TransferResult",
|
|
83
|
+
"UsernameCheck",
|
|
84
|
+
"UsernameResult",
|
|
85
|
+
"VerificationResult",
|
|
86
|
+
"WelcomeMessage",
|
|
87
|
+
"WelcomeResult",
|
|
88
|
+
]
|
|
89
|
+
|
|
90
|
+
|
|
91
|
+
# ---------------------------------------------------------------------------
|
|
92
|
+
# Rights vocabulary
|
|
93
|
+
# ---------------------------------------------------------------------------
|
|
94
|
+
|
|
95
|
+
|
|
96
|
+
class RightInfo(Model):
|
|
97
|
+
"""One entry of the canonical right vocabulary (`chat permission list`).
|
|
98
|
+
|
|
99
|
+
`supported` is False for a flag the installed Telethon layer cannot
|
|
100
|
+
express; naming it anyway is what lets an agent discover that the gap
|
|
101
|
+
exists instead of guessing why a right was silently dropped.
|
|
102
|
+
"""
|
|
103
|
+
|
|
104
|
+
name: str
|
|
105
|
+
mask: str
|
|
106
|
+
tl_flag: str
|
|
107
|
+
polarity: str
|
|
108
|
+
supported: bool = True
|
|
109
|
+
since_layer: int | None = None
|
|
110
|
+
peer_types: list[str] = []
|
|
111
|
+
grantable: bool | None = None
|
|
112
|
+
summary: str = ""
|
|
113
|
+
|
|
114
|
+
|
|
115
|
+
# ---------------------------------------------------------------------------
|
|
116
|
+
# Members and admins
|
|
117
|
+
# ---------------------------------------------------------------------------
|
|
118
|
+
|
|
119
|
+
|
|
120
|
+
class Participant(Model):
|
|
121
|
+
"""One row of a member listing, with the participant wrapper intact."""
|
|
122
|
+
|
|
123
|
+
id: int
|
|
124
|
+
user_id: int = 0
|
|
125
|
+
chat_id: int = 0
|
|
126
|
+
peer: Peer | None = None
|
|
127
|
+
username: str | None = None
|
|
128
|
+
name: str = ""
|
|
129
|
+
is_bot: bool = False
|
|
130
|
+
#: creator | admin | member | self | restricted | banned | left
|
|
131
|
+
status: str = "member"
|
|
132
|
+
rank: str | None = None
|
|
133
|
+
date: str | None = None
|
|
134
|
+
date_unix: int | None = None
|
|
135
|
+
inviter_id: int | None = None
|
|
136
|
+
promoted_by: int | None = None
|
|
137
|
+
kicked_by: int | None = None
|
|
138
|
+
via_request: bool | None = None
|
|
139
|
+
subscription_until_date: str | None = None
|
|
140
|
+
admin_rights: Rights | None = None
|
|
141
|
+
banned_rights: Rights | None = None
|
|
142
|
+
effective_permissions: Rights | None = None
|
|
143
|
+
can_edit: bool | None = None
|
|
144
|
+
#: Only on `--via-link` rows: the invite the member came through.
|
|
145
|
+
via_link: str | None = None
|
|
146
|
+
approved_by: int | None = None
|
|
147
|
+
about: str | None = None
|
|
148
|
+
|
|
149
|
+
|
|
150
|
+
class MissingInvitee(Model):
|
|
151
|
+
"""Someone `messages.invitedUsers` refused to add, and why.
|
|
152
|
+
|
|
153
|
+
Reported verbatim rather than dropped: "added 3 of 5" with no names is
|
|
154
|
+
not an answer anybody can act on.
|
|
155
|
+
"""
|
|
156
|
+
|
|
157
|
+
user_id: int
|
|
158
|
+
#: privacy-restricted | premium-would-allow-invite | premium-required-for-pm
|
|
159
|
+
reason: str
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
class MembersAdded(Model):
|
|
163
|
+
chat_id: int
|
|
164
|
+
added: list[int] = []
|
|
165
|
+
missing: list[MissingInvitee] = []
|
|
166
|
+
invited_by_link: list[int] = []
|
|
167
|
+
|
|
168
|
+
|
|
169
|
+
class MemberResult(Model):
|
|
170
|
+
"""The answer to a moderation verb applied to one member."""
|
|
171
|
+
|
|
172
|
+
chat_id: int
|
|
173
|
+
user_id: int
|
|
174
|
+
removed: bool | None = None
|
|
175
|
+
banned: bool | None = None
|
|
176
|
+
until: str | None = None
|
|
177
|
+
until_unix: int | None = None
|
|
178
|
+
allow: list[str] = []
|
|
179
|
+
deny: list[str] = []
|
|
180
|
+
purged_messages: int | None = None
|
|
181
|
+
deleted: int | None = None
|
|
182
|
+
reported: bool | None = None
|
|
183
|
+
rank: str | None = None
|
|
184
|
+
free_messages: bool | None = None
|
|
185
|
+
already: bool = False
|
|
186
|
+
|
|
187
|
+
|
|
188
|
+
class AdminResult(Model):
|
|
189
|
+
chat_id: int
|
|
190
|
+
user_id: int
|
|
191
|
+
admin_rights: Rights | None = None
|
|
192
|
+
rank: str | None = None
|
|
193
|
+
dropped: list[str] = []
|
|
194
|
+
already: bool = False
|
|
195
|
+
|
|
196
|
+
|
|
197
|
+
class PermissionView(Model):
|
|
198
|
+
chat_id: int
|
|
199
|
+
allow: list[str] = []
|
|
200
|
+
deny: list[str] = []
|
|
201
|
+
rights: Rights | None = None
|
|
202
|
+
|
|
203
|
+
|
|
204
|
+
class PermissionResult(Model):
|
|
205
|
+
chat_id: int
|
|
206
|
+
allow: list[str] = []
|
|
207
|
+
deny: list[str] = []
|
|
208
|
+
changed: bool = False
|
|
209
|
+
already: bool = False
|
|
210
|
+
|
|
211
|
+
|
|
212
|
+
# ---------------------------------------------------------------------------
|
|
213
|
+
# Invites and join requests
|
|
214
|
+
# ---------------------------------------------------------------------------
|
|
215
|
+
|
|
216
|
+
|
|
217
|
+
class Invite(Model):
|
|
218
|
+
link: str
|
|
219
|
+
title: str | None = None
|
|
220
|
+
permanent: bool = False
|
|
221
|
+
revoked: bool = False
|
|
222
|
+
request_needed: bool = False
|
|
223
|
+
admin_id: int | None = None
|
|
224
|
+
date: str | None = None
|
|
225
|
+
date_unix: int | None = None
|
|
226
|
+
start_date: str | None = None
|
|
227
|
+
expire_date: str | None = None
|
|
228
|
+
usage_limit: int | None = None
|
|
229
|
+
usage: int | None = None
|
|
230
|
+
requested: int | None = None
|
|
231
|
+
subscription_pricing: dict[str, int] | None = None
|
|
232
|
+
subscription_expired: int | None = None
|
|
233
|
+
replaced_link: str | None = None
|
|
234
|
+
#: `--by-admin` rows: how many links this admin has made, and revoked.
|
|
235
|
+
invites_count: int | None = None
|
|
236
|
+
revoked_invites_count: int | None = None
|
|
237
|
+
|
|
238
|
+
|
|
239
|
+
class InviteInfo(Invite):
|
|
240
|
+
"""`chat invite get`: our own link, or a preview of somebody else's."""
|
|
241
|
+
|
|
242
|
+
chat: Peer | None = None
|
|
243
|
+
chat_title: str = ""
|
|
244
|
+
members_count: int | None = None
|
|
245
|
+
already_member: bool | None = None
|
|
246
|
+
peek_expires: str | None = None
|
|
247
|
+
about: str | None = None
|
|
248
|
+
public: bool | None = None
|
|
249
|
+
qr: str | None = None
|
|
250
|
+
png: str | None = None
|
|
251
|
+
|
|
252
|
+
|
|
253
|
+
class InviteDeleted(Model):
|
|
254
|
+
chat_id: int
|
|
255
|
+
deleted: int = 0
|
|
256
|
+
|
|
257
|
+
|
|
258
|
+
class InviteRevoked(Model):
|
|
259
|
+
link: str
|
|
260
|
+
revoked: bool = True
|
|
261
|
+
replaced_link: str | None = None
|
|
262
|
+
|
|
263
|
+
|
|
264
|
+
class JoinRequest(Model):
|
|
265
|
+
user_id: int
|
|
266
|
+
username: str | None = None
|
|
267
|
+
name: str = ""
|
|
268
|
+
date: str | None = None
|
|
269
|
+
date_unix: int | None = None
|
|
270
|
+
about: str | None = None
|
|
271
|
+
via_link: str | None = None
|
|
272
|
+
approved_by: int | None = None
|
|
273
|
+
|
|
274
|
+
|
|
275
|
+
class RequestResult(Model):
|
|
276
|
+
chat_id: int
|
|
277
|
+
approved: list[int] = []
|
|
278
|
+
denied: list[int] = []
|
|
279
|
+
failed: list[MissingInvitee] = []
|
|
280
|
+
all: bool = False
|
|
281
|
+
|
|
282
|
+
|
|
283
|
+
class InvitePeek(Model):
|
|
284
|
+
chat: Peer | None = None
|
|
285
|
+
chat_title: str = ""
|
|
286
|
+
peek_expires: str | None = None
|
|
287
|
+
messages: list[Message] = []
|
|
288
|
+
|
|
289
|
+
|
|
290
|
+
class JoinResult(Model):
|
|
291
|
+
chat_id: int
|
|
292
|
+
title: str = ""
|
|
293
|
+
joined: bool = False
|
|
294
|
+
pending_approval: bool = False
|
|
295
|
+
already: bool = False
|
|
296
|
+
#: A layer-229 join that needs a web view tlgr cannot open.
|
|
297
|
+
needs_web_view: str | None = None
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
# ---------------------------------------------------------------------------
|
|
301
|
+
# Topics
|
|
302
|
+
# ---------------------------------------------------------------------------
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
class Topic(Model):
|
|
306
|
+
id: int
|
|
307
|
+
chat_id: int = 0
|
|
308
|
+
title: str = ""
|
|
309
|
+
icon_emoji_id: int | None = None
|
|
310
|
+
icon_color: int | None = None
|
|
311
|
+
closed: bool = False
|
|
312
|
+
pinned: bool = False
|
|
313
|
+
hidden: bool = False
|
|
314
|
+
my: bool = False
|
|
315
|
+
top_message: int | None = None
|
|
316
|
+
unread_count: int = 0
|
|
317
|
+
unread_mentions_count: int = 0
|
|
318
|
+
unread_reactions_count: int = 0
|
|
319
|
+
from_id: int | None = None
|
|
320
|
+
muted: bool | None = None
|
|
321
|
+
link: str | None = None
|
|
322
|
+
date: str | None = None
|
|
323
|
+
date_unix: int | None = None
|
|
324
|
+
deleted: bool = False
|
|
325
|
+
|
|
326
|
+
|
|
327
|
+
class TopicResult(Model):
|
|
328
|
+
chat_id: int
|
|
329
|
+
topic_id: int
|
|
330
|
+
title: str | None = None
|
|
331
|
+
icon_emoji_id: int | None = None
|
|
332
|
+
closed: bool | None = None
|
|
333
|
+
hidden: bool | None = None
|
|
334
|
+
deleted: bool | None = None
|
|
335
|
+
mute_until: str | None = None
|
|
336
|
+
silent: bool | None = None
|
|
337
|
+
previews: bool | None = None
|
|
338
|
+
changed: list[str] = []
|
|
339
|
+
already: bool = False
|
|
340
|
+
|
|
341
|
+
|
|
342
|
+
class TopicPinResult(Model):
|
|
343
|
+
chat_id: int
|
|
344
|
+
pinned: list[int] = []
|
|
345
|
+
unpinned: list[int] = []
|
|
346
|
+
already: bool = False
|
|
347
|
+
|
|
348
|
+
|
|
349
|
+
class TopicReadResult(Model):
|
|
350
|
+
chat_id: int
|
|
351
|
+
topic_id: int
|
|
352
|
+
unread_count: int = 0
|
|
353
|
+
unread_mentions_count: int = 0
|
|
354
|
+
unread_reactions_count: int = 0
|
|
355
|
+
max_id: int | None = None
|
|
356
|
+
items: list[Message] = []
|
|
357
|
+
|
|
358
|
+
|
|
359
|
+
# ---------------------------------------------------------------------------
|
|
360
|
+
# The admin log
|
|
361
|
+
# ---------------------------------------------------------------------------
|
|
362
|
+
|
|
363
|
+
|
|
364
|
+
class AdminLogEvent(Model):
|
|
365
|
+
"""One `channelAdminLogEvent`, normalised but never lossy.
|
|
366
|
+
|
|
367
|
+
Telegram has 50-odd `channelAdminLogEventAction*` constructors. They are
|
|
368
|
+
reduced to `{action, prev, new}` so a script can switch on one string,
|
|
369
|
+
and `raw_type` keeps the TL name so nothing that was in the reply is
|
|
370
|
+
unavailable.
|
|
371
|
+
"""
|
|
372
|
+
|
|
373
|
+
id: int
|
|
374
|
+
date: str | None = None
|
|
375
|
+
date_unix: int | None = None
|
|
376
|
+
user_id: int = 0
|
|
377
|
+
action: str = ""
|
|
378
|
+
raw_type: str = ""
|
|
379
|
+
prev: Any = None
|
|
380
|
+
new: Any = None
|
|
381
|
+
chat_id: int = 0
|
|
382
|
+
|
|
383
|
+
|
|
384
|
+
class AntiSpamReport(Model):
|
|
385
|
+
chat_id: int
|
|
386
|
+
msg_id: int
|
|
387
|
+
reported: bool = True
|
|
388
|
+
|
|
389
|
+
|
|
390
|
+
# ---------------------------------------------------------------------------
|
|
391
|
+
# Creation, editing, settings
|
|
392
|
+
# ---------------------------------------------------------------------------
|
|
393
|
+
|
|
394
|
+
|
|
395
|
+
class CreatedChat(Model):
|
|
396
|
+
id: int
|
|
397
|
+
type: str = ""
|
|
398
|
+
title: str = ""
|
|
399
|
+
username: str | None = None
|
|
400
|
+
invite_link: str | None = None
|
|
401
|
+
added: list[int] = []
|
|
402
|
+
missing: list[MissingInvitee] = []
|
|
403
|
+
|
|
404
|
+
|
|
405
|
+
class ChatEditResult(Model):
|
|
406
|
+
id: int
|
|
407
|
+
changed: list[str] = []
|
|
408
|
+
already: bool = False
|
|
409
|
+
palettes: list[dict[str, Any]] = []
|
|
410
|
+
|
|
411
|
+
|
|
412
|
+
class MigrateResult(Model):
|
|
413
|
+
old_chat_id: int
|
|
414
|
+
chat_id: int
|
|
415
|
+
type: str = ""
|
|
416
|
+
|
|
417
|
+
|
|
418
|
+
class TransferResult(Model):
|
|
419
|
+
chat_id: int
|
|
420
|
+
new_owner_id: int
|
|
421
|
+
|
|
422
|
+
|
|
423
|
+
class SettingsView(Model):
|
|
424
|
+
"""Every administrable toggle, keyed the way `chat setting set` spells it."""
|
|
425
|
+
|
|
426
|
+
chat_id: int = 0
|
|
427
|
+
slow_mode: int | None = None
|
|
428
|
+
prehistory: str | None = None
|
|
429
|
+
join_to_send: bool | None = None
|
|
430
|
+
join_request: bool | None = None
|
|
431
|
+
guard_bot: int | None = None
|
|
432
|
+
noforwards: bool | None = None
|
|
433
|
+
antispam: bool | None = None
|
|
434
|
+
hidden_members: bool | None = None
|
|
435
|
+
signatures: bool | None = None
|
|
436
|
+
signature_profiles: bool | None = None
|
|
437
|
+
forum: bool | None = None
|
|
438
|
+
forum_tabs: str | None = None
|
|
439
|
+
view_as: str | None = None
|
|
440
|
+
autotranslate: bool | None = None
|
|
441
|
+
ads: bool | None = None
|
|
442
|
+
reactions: str | None = None
|
|
443
|
+
reactions_list: list[str] = []
|
|
444
|
+
reactions_limit: int | None = None
|
|
445
|
+
paid_reactions: bool | None = None
|
|
446
|
+
sticker_set: str | None = None
|
|
447
|
+
emoji_set: str | None = None
|
|
448
|
+
paid_messages_stars: int | None = None
|
|
449
|
+
direct_messages: bool | None = None
|
|
450
|
+
gift_notifications: bool | None = None
|
|
451
|
+
#: key → may I change it here
|
|
452
|
+
available: dict[str, bool] = {}
|
|
453
|
+
#: key → the capability flag or boost level that blocks it
|
|
454
|
+
gated_by: dict[str, str] = {}
|
|
455
|
+
|
|
456
|
+
|
|
457
|
+
class SettingResult(Model):
|
|
458
|
+
chat_id: int
|
|
459
|
+
changed: list[str] = []
|
|
460
|
+
already: list[str] = []
|
|
461
|
+
failed: dict[str, str] = {}
|
|
462
|
+
|
|
463
|
+
|
|
464
|
+
class UsernameCheck(Model):
|
|
465
|
+
username: str
|
|
466
|
+
#: available | occupied | invalid | purchasable
|
|
467
|
+
status: str = ""
|
|
468
|
+
available: bool = False
|
|
469
|
+
collectible: dict[str, Any] | None = None
|
|
470
|
+
|
|
471
|
+
|
|
472
|
+
class UsernameResult(Model):
|
|
473
|
+
chat_id: int
|
|
474
|
+
username: str | None = None
|
|
475
|
+
link: str | None = None
|
|
476
|
+
usernames: list[str] = []
|
|
477
|
+
invite_link: str | None = None
|
|
478
|
+
already: bool = False
|
|
479
|
+
|
|
480
|
+
|
|
481
|
+
class ChatPhotoResult(Model):
|
|
482
|
+
chat_id: int
|
|
483
|
+
photo_id: int | None = None
|
|
484
|
+
ok: bool = True
|
|
485
|
+
|
|
486
|
+
|
|
487
|
+
class SendAsPeer(Model):
|
|
488
|
+
id: int
|
|
489
|
+
type: str = ""
|
|
490
|
+
title: str = ""
|
|
491
|
+
premium_required: bool = False
|
|
492
|
+
default: bool = False
|
|
493
|
+
|
|
494
|
+
|
|
495
|
+
class SendAsResult(Model):
|
|
496
|
+
chat_id: int
|
|
497
|
+
send_as: int
|
|
498
|
+
|
|
499
|
+
|
|
500
|
+
class DiscussionCandidate(Model):
|
|
501
|
+
id: int
|
|
502
|
+
title: str = ""
|
|
503
|
+
type: str = ""
|
|
504
|
+
needs_migration: bool = False
|
|
505
|
+
prehistory_hidden: bool | None = None
|
|
506
|
+
|
|
507
|
+
|
|
508
|
+
class DiscussionResult(Model):
|
|
509
|
+
channel_id: int
|
|
510
|
+
linked_chat_id: int | None = None
|
|
511
|
+
already: bool = False
|
|
512
|
+
|
|
513
|
+
|
|
514
|
+
class SimilarChat(Model):
|
|
515
|
+
id: int
|
|
516
|
+
title: str = ""
|
|
517
|
+
username: str | None = None
|
|
518
|
+
participants_count: int | None = None
|
|
519
|
+
|
|
520
|
+
|
|
521
|
+
class SponsoredReport(Model):
|
|
522
|
+
#: reported | choose-option | premium-required
|
|
523
|
+
result: str = ""
|
|
524
|
+
title: str = ""
|
|
525
|
+
options: list[dict[str, str]] = []
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
class SuggestionResult(Model):
|
|
529
|
+
chat_id: int
|
|
530
|
+
key: str = ""
|
|
531
|
+
pending_suggestions: list[str] = []
|
|
532
|
+
already: bool = False
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
class SuggestedPostResult(Model):
|
|
536
|
+
channel_id: int
|
|
537
|
+
msg_id: int
|
|
538
|
+
approved: bool | None = None
|
|
539
|
+
rejected: bool | None = None
|
|
540
|
+
schedule_date: str | None = None
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
class VerificationResult(Model):
|
|
544
|
+
chat_id: int
|
|
545
|
+
bot_id: int | None = None
|
|
546
|
+
enabled: bool = False
|
|
547
|
+
|
|
548
|
+
|
|
549
|
+
class AffiliateBot(Model):
|
|
550
|
+
bot_id: int
|
|
551
|
+
url: str = ""
|
|
552
|
+
commission_permille: int = 0
|
|
553
|
+
duration_months: int | None = None
|
|
554
|
+
participants: int | None = None
|
|
555
|
+
revenue: int | None = None
|
|
556
|
+
date: str | None = None
|
|
557
|
+
date_unix: int | None = None
|
|
558
|
+
|
|
559
|
+
|
|
560
|
+
class AffiliateResult(Model):
|
|
561
|
+
chat_id: int
|
|
562
|
+
bot_id: int | None = None
|
|
563
|
+
url: str = ""
|
|
564
|
+
commission_permille: int = 0
|
|
565
|
+
revoked: bool = False
|
|
566
|
+
|
|
567
|
+
|
|
568
|
+
class DirectDialog(Model):
|
|
569
|
+
saved_peer_id: int
|
|
570
|
+
name: str = ""
|
|
571
|
+
top_message: int | None = None
|
|
572
|
+
unread_count: int = 0
|
|
573
|
+
unread_reactions_count: int = 0
|
|
574
|
+
date: str | None = None
|
|
575
|
+
date_unix: int | None = None
|
|
576
|
+
nopaid_messages_exception: bool | None = None
|
|
577
|
+
|
|
578
|
+
|
|
579
|
+
class DirectBanResult(Model):
|
|
580
|
+
channel_id: int
|
|
581
|
+
monoforum_id: int | None = None
|
|
582
|
+
user_id: int = 0
|
|
583
|
+
banned: bool = False
|
|
584
|
+
|
|
585
|
+
|
|
586
|
+
class CommunityRow(Model):
|
|
587
|
+
"""A layer-229 community. Reserved until Telethon speaks the layer."""
|
|
588
|
+
|
|
589
|
+
id: int
|
|
590
|
+
title: str = ""
|
|
591
|
+
type: str = ""
|
|
592
|
+
visible: bool | None = None
|
|
593
|
+
collapsed: bool | None = None
|
|
594
|
+
requested_by: int | None = None
|
|
595
|
+
date: str | None = None
|
|
596
|
+
date_unix: int | None = None
|
|
597
|
+
chats: list[int] = []
|
|
598
|
+
|
|
599
|
+
|
|
600
|
+
class CommunityResult(Model):
|
|
601
|
+
community_id: int = 0
|
|
602
|
+
chat_id: int | None = None
|
|
603
|
+
user_id: int | None = None
|
|
604
|
+
title: str = ""
|
|
605
|
+
state: str = ""
|
|
606
|
+
banned: bool | None = None
|
|
607
|
+
linked_peers: list[int] = []
|
|
608
|
+
|
|
609
|
+
|
|
610
|
+
class WelcomeMessage(Model):
|
|
611
|
+
id: int
|
|
612
|
+
text: str = ""
|
|
613
|
+
entities: list[dict[str, Any]] = []
|
|
614
|
+
media: str | None = None
|
|
615
|
+
date: str | None = None
|
|
616
|
+
date_unix: int | None = None
|
|
617
|
+
|
|
618
|
+
|
|
619
|
+
class WelcomeResult(Model):
|
|
620
|
+
chat_id: int
|
|
621
|
+
id: int | None = None
|
|
622
|
+
text: str = ""
|
|
623
|
+
deleted: int = 0
|
|
624
|
+
|
|
625
|
+
|
|
626
|
+
# ---------------------------------------------------------------------------
|
|
627
|
+
# Statistics, revenue and boosts
|
|
628
|
+
# ---------------------------------------------------------------------------
|
|
629
|
+
|
|
630
|
+
|
|
631
|
+
class StatValue(Model):
|
|
632
|
+
current: float = 0.0
|
|
633
|
+
previous: float = 0.0
|
|
634
|
+
growth: float = 0.0
|
|
635
|
+
|
|
636
|
+
|
|
637
|
+
class Graph(Model):
|
|
638
|
+
"""One chart. Either resolved JSON, an async token, or an error."""
|
|
639
|
+
|
|
640
|
+
name: str
|
|
641
|
+
token: str | None = None
|
|
642
|
+
zoom_token: str | None = None
|
|
643
|
+
json: Any = None
|
|
644
|
+
error: str | None = None
|
|
645
|
+
path: str | None = None
|
|
646
|
+
|
|
647
|
+
|
|
648
|
+
class ChatStats(Model):
|
|
649
|
+
chat_id: int = 0
|
|
650
|
+
#: broadcast | megagroup | message | story | poll
|
|
651
|
+
type: str = ""
|
|
652
|
+
period: dict[str, str] = {}
|
|
653
|
+
followers: StatValue | None = None
|
|
654
|
+
views_per_post: StatValue | None = None
|
|
655
|
+
shares_per_post: StatValue | None = None
|
|
656
|
+
reactions_per_post: StatValue | None = None
|
|
657
|
+
enabled_notifications: StatValue | None = None
|
|
658
|
+
members: StatValue | None = None
|
|
659
|
+
messages: StatValue | None = None
|
|
660
|
+
viewers: StatValue | None = None
|
|
661
|
+
posters: StatValue | None = None
|
|
662
|
+
views: int | None = None
|
|
663
|
+
forwards: int | None = None
|
|
664
|
+
reactions: int | None = None
|
|
665
|
+
graphs: list[Graph] = []
|
|
666
|
+
recent_posts: list[dict[str, Any]] = []
|
|
667
|
+
|
|
668
|
+
|
|
669
|
+
class PublicForward(Model):
|
|
670
|
+
chat_id: int = 0
|
|
671
|
+
chat_title: str = ""
|
|
672
|
+
msg_id: int | None = None
|
|
673
|
+
story_id: int | None = None
|
|
674
|
+
views: int | None = None
|
|
675
|
+
date: str | None = None
|
|
676
|
+
date_unix: int | None = None
|
|
677
|
+
|
|
678
|
+
|
|
679
|
+
class RevenueSummary(Model):
|
|
680
|
+
chat_id: int
|
|
681
|
+
currency: str = "stars"
|
|
682
|
+
current_balance: int = 0
|
|
683
|
+
available_balance: int = 0
|
|
684
|
+
overall_revenue: int = 0
|
|
685
|
+
withdrawal_enabled: bool = False
|
|
686
|
+
next_withdrawal_at: str | None = None
|
|
687
|
+
usd_rate: float | None = None
|
|
688
|
+
graphs: list[Graph] = []
|
|
689
|
+
from_user_revenue: int | None = None
|
|
690
|
+
|
|
691
|
+
|
|
692
|
+
class RevenueTransaction(Model):
|
|
693
|
+
id: str
|
|
694
|
+
date: str | None = None
|
|
695
|
+
date_unix: int | None = None
|
|
696
|
+
amount: int = 0
|
|
697
|
+
currency: str = "stars"
|
|
698
|
+
peer: str = ""
|
|
699
|
+
title: str = ""
|
|
700
|
+
refund: bool = False
|
|
701
|
+
pending: bool = False
|
|
702
|
+
failed: bool = False
|
|
703
|
+
subscription_period: int | None = None
|
|
704
|
+
|
|
705
|
+
|
|
706
|
+
class Boost(Model):
|
|
707
|
+
id: str = ""
|
|
708
|
+
slot: int | None = None
|
|
709
|
+
user_id: int | None = None
|
|
710
|
+
chat_id: int | None = None
|
|
711
|
+
gift: bool = False
|
|
712
|
+
giveaway: bool = False
|
|
713
|
+
unclaimed: bool = False
|
|
714
|
+
multiplier: int | None = None
|
|
715
|
+
stars: int | None = None
|
|
716
|
+
date: str | None = None
|
|
717
|
+
date_unix: int | None = None
|
|
718
|
+
expires: str | None = None
|
|
719
|
+
cooldown_until_date: str | None = None
|
|
720
|
+
|
|
721
|
+
|
|
722
|
+
class BoostStatus(Model):
|
|
723
|
+
chat_id: int = 0
|
|
724
|
+
level: int = 0
|
|
725
|
+
boosts: int = 0
|
|
726
|
+
current_level_boosts: int = 0
|
|
727
|
+
next_level_boosts: int | None = None
|
|
728
|
+
premium_audience: dict[str, float] | None = None
|
|
729
|
+
boost_url: str = ""
|
|
730
|
+
my_boost: bool = False
|
|
731
|
+
boosts_applied: int | None = None
|
|
732
|
+
prepaid_giveaways: list[dict[str, Any]] = []
|
|
733
|
+
features: list[dict[str, Any]] = []
|
|
734
|
+
|
|
735
|
+
|
|
736
|
+
class BoostApplied(Model):
|
|
737
|
+
chat_id: int
|
|
738
|
+
level: int = 0
|
|
739
|
+
boosts: int = 0
|
|
740
|
+
my_boost: bool = True
|
|
741
|
+
already: bool = False
|
|
742
|
+
peer: str = ""
|
|
743
|
+
slots: list[int] = []
|
|
744
|
+
cooldown_until_date: str | None = None
|