DryGram 1.0.0__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.
- drygram/__init__.py +173 -0
- drygram/bridge/__init__.py +7 -0
- drygram/bridge/adapter.py +53 -0
- drygram/bridge/client.py +24 -0
- drygram/client.py +2609 -0
- drygram/commands/__init__.py +100 -0
- drygram/commands/aliases.py +26 -0
- drygram/commands/analytics.py +44 -0
- drygram/commands/arguments.py +30 -0
- drygram/commands/autocomplete.py +25 -0
- drygram/commands/categories.py +13 -0
- drygram/commands/checks.py +21 -0
- drygram/commands/completion.py +19 -0
- drygram/commands/context.py +38 -0
- drygram/commands/converters.py +75 -0
- drygram/commands/cooldown.py +41 -0
- drygram/commands/decorators.py +63 -0
- drygram/commands/executor.py +78 -0
- drygram/commands/formatter.py +304 -0
- drygram/commands/groups.py +22 -0
- drygram/commands/help.py +56 -0
- drygram/commands/history.py +49 -0
- drygram/commands/matcher.py +40 -0
- drygram/commands/parser.py +48 -0
- drygram/commands/permissions.py +63 -0
- drygram/commands/prefixes.py +51 -0
- drygram/commands/registry.py +89 -0
- drygram/commands/router.py +134 -0
- drygram/commands/syntax.py +25 -0
- drygram/commands/validator.py +5 -0
- drygram/commands/validators.py +31 -0
- drygram/compat.py +395 -0
- drygram/crypto/cipher.py +126 -0
- drygram/dispatch/dispatcher.py +137 -0
- drygram/dispatch/gate.py +584 -0
- drygram/dispatch/pipeline.py +44 -0
- drygram/dispatch/queue.py +51 -0
- drygram/dispatch/scheduler.py +146 -0
- drygram/dispatch/watcher.py +68 -0
- drygram/errors/rpc.py +548 -0
- drygram/network/connection.py +56 -0
- drygram/network/core.py +91 -0
- drygram/network/pool.py +175 -0
- drygram/network/proxy.py +113 -0
- drygram/network/transport.py +233 -0
- drygram/parsers/html.py +80 -0
- drygram/parsers/markdown.py +81 -0
- drygram/plugins/loader.py +131 -0
- drygram/raw/__init__.py +26 -0
- drygram/raw/functions.py +58 -0
- drygram/raw/parser.py +252 -0
- drygram/raw/types.py +81 -0
- drygram/sessions/__init__.py +28 -0
- drygram/sessions/base.py +52 -0
- drygram/sessions/binary.py +66 -0
- drygram/sessions/custom.py +43 -0
- drygram/sessions/encrypted.py +107 -0
- drygram/sessions/json.py +121 -0
- drygram/sessions/memory.py +22 -0
- drygram/sessions/mongo.py +87 -0
- drygram/sessions/postgres.py +102 -0
- drygram/sessions/redis.py +82 -0
- drygram/sessions/session.py +527 -0
- drygram/sessions/sqlite.py +187 -0
- drygram/types/base.py +8 -0
- drygram/types/business.py +34 -0
- drygram/types/chat.py +104 -0
- drygram/types/emoji.py +172 -0
- drygram/types/markup.py +101 -0
- drygram/types/media.py +103 -0
- drygram/types/message.py +87 -0
- drygram/types/premium.py +40 -0
- drygram/types/story.py +30 -0
- drygram/version.py +155 -0
- drygram-1.0.0.dist-info/METADATA +257 -0
- drygram-1.0.0.dist-info/RECORD +81 -0
- drygram-1.0.0.dist-info/WHEEL +5 -0
- drygram-1.0.0.dist-info/licenses/COPYING +624 -0
- drygram-1.0.0.dist-info/licenses/LICENSE +19 -0
- drygram-1.0.0.dist-info/licenses/NOTICE +6 -0
- drygram-1.0.0.dist-info/top_level.txt +1 -0
drygram/__init__.py
ADDED
|
@@ -0,0 +1,173 @@
|
|
|
1
|
+
# DryGram Developed By Santhu
|
|
2
|
+
# mail: telegramsanthu@gmail.com
|
|
3
|
+
from drygram.client import DryClient
|
|
4
|
+
from drygram.bridge import BridgeClient, BridgeAdapter
|
|
5
|
+
from drygram.sessions.base import BaseSession
|
|
6
|
+
from drygram.sessions.session import Session
|
|
7
|
+
from drygram.sessions.memory import MemorySession
|
|
8
|
+
from drygram.sessions.sqlite import SQLiteSession
|
|
9
|
+
from drygram.sessions.binary import BinarySession
|
|
10
|
+
from drygram.sessions.encrypted import EncryptedSession
|
|
11
|
+
from drygram.sessions.json import JSONSession
|
|
12
|
+
from drygram.sessions.custom import CustomSession
|
|
13
|
+
from drygram.sessions.postgres import PostgresSession
|
|
14
|
+
from drygram.sessions.redis import RedisSession
|
|
15
|
+
from drygram.sessions.mongo import MongoSession
|
|
16
|
+
from drygram.dispatch.gate import Gate, Gates
|
|
17
|
+
from drygram.dispatch.watcher import Watcher
|
|
18
|
+
from drygram.dispatch.scheduler import TaskScheduler, ScheduledTask
|
|
19
|
+
from drygram.types.chat import User, Chat, Topic, Folder
|
|
20
|
+
from drygram.types.message import Message, MessageEffect, CloudDraft
|
|
21
|
+
from drygram.types.media import Photo, Video, Document, Audio, VoiceNote, VideoNote, Location, LiveLocation, WebApp, MiniApp, Poll, Quiz, MediaGroup, PollOption
|
|
22
|
+
from drygram.types.markup import KeyboardButton, InlineKeyboardButton, ReplyKeyboardMarkup, InlineKeyboardMarkup
|
|
23
|
+
from drygram.types.story import Story, StoryReaction, StoryPrivacy, StoryArchive
|
|
24
|
+
from drygram.types.business import BusinessConnection, BusinessLink, BusinessGreeting, BusinessAway, BusinessReply
|
|
25
|
+
from drygram.types.premium import StarPayment, Gift, GiftUpgrade, Collectible, PremiumEmojiStatus
|
|
26
|
+
from drygram.types.emoji import Emoji, EmojiCategory, EmojiLookup, EmojiParser, EmojiFormatter, EmojiDatabase
|
|
27
|
+
from drygram.errors.rpc import (
|
|
28
|
+
DryError, RPCError, FloodWait, SessionError, NetworkError, AuthError,
|
|
29
|
+
SlowModeWait, PhoneMigrate, UserMigrate, FileMigrate, BadRequest,
|
|
30
|
+
Unauthorized, Forbidden, NotFound, NotAcceptable, Flood,
|
|
31
|
+
InternalServerError, RetryAfter, UnknownRPCError, from_rpc_error
|
|
32
|
+
)
|
|
33
|
+
from drygram.parsers.markdown import MarkdownParser
|
|
34
|
+
from drygram.parsers.html import HTMLParser
|
|
35
|
+
from drygram.version import VERSION
|
|
36
|
+
from drygram.compat import (
|
|
37
|
+
SessionManager, MediaUploader, MediaDownloader, BusinessManager,
|
|
38
|
+
StoryManager, PremiumManager, StickerManager, EmojiManager,
|
|
39
|
+
GiftManager, StarsManager, VoiceCallManager, VideoCallManager,
|
|
40
|
+
Router, Signal, Channel, Group, KeyboardBuilder, Button,
|
|
41
|
+
InlineKeyboard, ReplyKeyboard, CallbackButton, Logger, Cache, Storage,
|
|
42
|
+
SignalListener, MediaListener, BusinessListener, StoryListener,
|
|
43
|
+
VoiceListener, VideoListener, CallbackListener, InlineListener,
|
|
44
|
+
TopicListener, SchedulerListener, PluginListener, ConnectionListener,
|
|
45
|
+
UpdateListener
|
|
46
|
+
)
|
|
47
|
+
|
|
48
|
+
__all__ = [
|
|
49
|
+
"VERSION",
|
|
50
|
+
"DryClient",
|
|
51
|
+
"BridgeClient",
|
|
52
|
+
"BridgeAdapter",
|
|
53
|
+
"BaseSession",
|
|
54
|
+
"Session",
|
|
55
|
+
"MemorySession",
|
|
56
|
+
"SQLiteSession",
|
|
57
|
+
"BinarySession",
|
|
58
|
+
"EncryptedSession",
|
|
59
|
+
"JSONSession",
|
|
60
|
+
"CustomSession",
|
|
61
|
+
"PostgresSession",
|
|
62
|
+
"RedisSession",
|
|
63
|
+
"MongoSession",
|
|
64
|
+
"Gate",
|
|
65
|
+
"Gates",
|
|
66
|
+
"Watcher",
|
|
67
|
+
"TaskScheduler",
|
|
68
|
+
"ScheduledTask",
|
|
69
|
+
"User",
|
|
70
|
+
"Chat",
|
|
71
|
+
"Topic",
|
|
72
|
+
"Folder",
|
|
73
|
+
"Message",
|
|
74
|
+
"MessageEffect",
|
|
75
|
+
"CloudDraft",
|
|
76
|
+
"Photo",
|
|
77
|
+
"Video",
|
|
78
|
+
"Document",
|
|
79
|
+
"Audio",
|
|
80
|
+
"VoiceNote",
|
|
81
|
+
"VideoNote",
|
|
82
|
+
"Location",
|
|
83
|
+
"LiveLocation",
|
|
84
|
+
"WebApp",
|
|
85
|
+
"MiniApp",
|
|
86
|
+
"Poll",
|
|
87
|
+
"PollOption",
|
|
88
|
+
"Quiz",
|
|
89
|
+
"MediaGroup",
|
|
90
|
+
"KeyboardButton",
|
|
91
|
+
"InlineKeyboardButton",
|
|
92
|
+
"ReplyKeyboardMarkup",
|
|
93
|
+
"InlineKeyboardMarkup",
|
|
94
|
+
"Story",
|
|
95
|
+
"StoryReaction",
|
|
96
|
+
"StoryPrivacy",
|
|
97
|
+
"StoryArchive",
|
|
98
|
+
"BusinessConnection",
|
|
99
|
+
"BusinessLink",
|
|
100
|
+
"BusinessGreeting",
|
|
101
|
+
"BusinessAway",
|
|
102
|
+
"BusinessReply",
|
|
103
|
+
"StarPayment",
|
|
104
|
+
"Gift",
|
|
105
|
+
"GiftUpgrade",
|
|
106
|
+
"Collectible",
|
|
107
|
+
"PremiumEmojiStatus",
|
|
108
|
+
"Emoji",
|
|
109
|
+
"EmojiCategory",
|
|
110
|
+
"EmojiLookup",
|
|
111
|
+
"EmojiParser",
|
|
112
|
+
"EmojiFormatter",
|
|
113
|
+
"EmojiDatabase",
|
|
114
|
+
"DryError",
|
|
115
|
+
"RPCError",
|
|
116
|
+
"FloodWait",
|
|
117
|
+
"SlowModeWait",
|
|
118
|
+
"PhoneMigrate",
|
|
119
|
+
"UserMigrate",
|
|
120
|
+
"FileMigrate",
|
|
121
|
+
"BadRequest",
|
|
122
|
+
"Unauthorized",
|
|
123
|
+
"Forbidden",
|
|
124
|
+
"NotFound",
|
|
125
|
+
"NotAcceptable",
|
|
126
|
+
"Flood",
|
|
127
|
+
"InternalServerError",
|
|
128
|
+
"RetryAfter",
|
|
129
|
+
"UnknownRPCError",
|
|
130
|
+
"from_rpc_error",
|
|
131
|
+
"SessionError",
|
|
132
|
+
"NetworkError",
|
|
133
|
+
"AuthError",
|
|
134
|
+
"MarkdownParser",
|
|
135
|
+
"HTMLParser",
|
|
136
|
+
"SessionManager",
|
|
137
|
+
"MediaUploader",
|
|
138
|
+
"MediaDownloader",
|
|
139
|
+
"BusinessManager",
|
|
140
|
+
"StoryManager",
|
|
141
|
+
"PremiumManager",
|
|
142
|
+
"StickerManager",
|
|
143
|
+
"EmojiManager",
|
|
144
|
+
"GiftManager",
|
|
145
|
+
"StarsManager",
|
|
146
|
+
"VoiceCallManager",
|
|
147
|
+
"VideoCallManager",
|
|
148
|
+
"Router",
|
|
149
|
+
"Signal",
|
|
150
|
+
"Channel",
|
|
151
|
+
"Group",
|
|
152
|
+
"KeyboardBuilder",
|
|
153
|
+
"Button",
|
|
154
|
+
"InlineKeyboard",
|
|
155
|
+
"ReplyKeyboard",
|
|
156
|
+
"CallbackButton",
|
|
157
|
+
"Logger",
|
|
158
|
+
"Cache",
|
|
159
|
+
"Storage",
|
|
160
|
+
"SignalListener",
|
|
161
|
+
"MediaListener",
|
|
162
|
+
"BusinessListener",
|
|
163
|
+
"StoryListener",
|
|
164
|
+
"VoiceListener",
|
|
165
|
+
"VideoListener",
|
|
166
|
+
"CallbackListener",
|
|
167
|
+
"InlineListener",
|
|
168
|
+
"TopicListener",
|
|
169
|
+
"SchedulerListener",
|
|
170
|
+
"PluginListener",
|
|
171
|
+
"ConnectionListener",
|
|
172
|
+
"UpdateListener"
|
|
173
|
+
]
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
# DryGram Developed By Santhu
|
|
2
|
+
# mail: telegramsanthu@gmail.com
|
|
3
|
+
|
|
4
|
+
from typing import Any
|
|
5
|
+
from drygram.bridge.client import BridgeClient
|
|
6
|
+
|
|
7
|
+
class BridgeAdapter:
|
|
8
|
+
"""
|
|
9
|
+
Adapter class assisting external voice libraries in interfacing with DryClient/BridgeClient.
|
|
10
|
+
"""
|
|
11
|
+
def __init__(self, client: BridgeClient):
|
|
12
|
+
self.client = client
|
|
13
|
+
|
|
14
|
+
@property
|
|
15
|
+
def mtproto(self):
|
|
16
|
+
"""Access the underlying MTProto engine."""
|
|
17
|
+
return self.client.mtproto
|
|
18
|
+
|
|
19
|
+
@property
|
|
20
|
+
def session(self):
|
|
21
|
+
"""Access the current session instance."""
|
|
22
|
+
return self.client.session
|
|
23
|
+
|
|
24
|
+
@property
|
|
25
|
+
def loop(self):
|
|
26
|
+
"""Access the asyncio event loop."""
|
|
27
|
+
return self.client.loop
|
|
28
|
+
|
|
29
|
+
@property
|
|
30
|
+
def dispatcher(self):
|
|
31
|
+
"""Access the update dispatcher."""
|
|
32
|
+
return self.client.dispatcher
|
|
33
|
+
|
|
34
|
+
@property
|
|
35
|
+
def network(self):
|
|
36
|
+
"""Access the network layer."""
|
|
37
|
+
return self.client.network
|
|
38
|
+
|
|
39
|
+
async def invoke(self, query: Any) -> Any:
|
|
40
|
+
"""Send a raw MTProto TL request."""
|
|
41
|
+
return await self.client.invoke(query)
|
|
42
|
+
|
|
43
|
+
async def export_session(self) -> str:
|
|
44
|
+
"""Export the active session as a serialized string."""
|
|
45
|
+
return await self.client.export_session()
|
|
46
|
+
|
|
47
|
+
async def reconnect(self) -> None:
|
|
48
|
+
"""Helper to trigger network reconnection."""
|
|
49
|
+
await self.client.reconnect()
|
|
50
|
+
|
|
51
|
+
async def synchronize_updates(self) -> None:
|
|
52
|
+
"""Helper to synchronize update streams."""
|
|
53
|
+
await self.client.synchronize_updates()
|
drygram/bridge/client.py
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
# DryGram Developed By Santhu
|
|
2
|
+
# mail: telegramsanthu@gmail.com
|
|
3
|
+
|
|
4
|
+
import asyncio
|
|
5
|
+
from typing import Any, Optional, Union
|
|
6
|
+
from drygram.client import DryClient
|
|
7
|
+
|
|
8
|
+
class BridgeClient(DryClient):
|
|
9
|
+
"""
|
|
10
|
+
Bridge client wrapping DryClient to provide compatibility for external voice libraries.
|
|
11
|
+
"""
|
|
12
|
+
def __init__(self, *args, **kwargs):
|
|
13
|
+
super().__init__(*args, **kwargs)
|
|
14
|
+
|
|
15
|
+
async def reconnect(self) -> None:
|
|
16
|
+
"""Helper to reconnect the client network pool."""
|
|
17
|
+
await self.restart()
|
|
18
|
+
|
|
19
|
+
async def synchronize_updates(self) -> None:
|
|
20
|
+
"""Helper to synchronize update streams."""
|
|
21
|
+
if self.dispatcher:
|
|
22
|
+
# Re-starts the update processor pipeline
|
|
23
|
+
await self.dispatcher.stop()
|
|
24
|
+
await self.dispatcher.start()
|