RubigramClient 1.5.6__tar.gz → 1.5.7__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.5.6 → rubigramclient-1.5.7}/PKG-INFO +2 -2
- {rubigramclient-1.5.6 → rubigramclient-1.5.7}/README.md +1 -1
- {rubigramclient-1.5.6 → rubigramclient-1.5.7}/RubigramClient.egg-info/PKG-INFO +2 -2
- {rubigramclient-1.5.6 → rubigramclient-1.5.7}/pyproject.toml +1 -1
- {rubigramclient-1.5.6 → rubigramclient-1.5.7}/rubigram/client.py +2 -2
- rubigramclient-1.5.7/rubigram/filters.py +180 -0
- {rubigramclient-1.5.6 → rubigramclient-1.5.7}/rubigram/method.py +0 -2
- {rubigramclient-1.5.6 → rubigramclient-1.5.7}/rubigram/network.py +0 -1
- {rubigramclient-1.5.6 → rubigramclient-1.5.7}/rubigram/state.py +1 -3
- rubigramclient-1.5.6/rubigram/filters.py +0 -192
- {rubigramclient-1.5.6 → rubigramclient-1.5.7}/LICENSE +0 -0
- {rubigramclient-1.5.6 → rubigramclient-1.5.7}/RubigramClient.egg-info/SOURCES.txt +0 -0
- {rubigramclient-1.5.6 → rubigramclient-1.5.7}/RubigramClient.egg-info/dependency_links.txt +0 -0
- {rubigramclient-1.5.6 → rubigramclient-1.5.7}/RubigramClient.egg-info/requires.txt +0 -0
- {rubigramclient-1.5.6 → rubigramclient-1.5.7}/RubigramClient.egg-info/top_level.txt +0 -0
- {rubigramclient-1.5.6 → rubigramclient-1.5.7}/rubigram/__init__.py +0 -0
- {rubigramclient-1.5.6 → rubigramclient-1.5.7}/rubigram/models.py +0 -0
- {rubigramclient-1.5.6 → rubigramclient-1.5.7}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: RubigramClient
|
|
3
|
-
Version: 1.5.
|
|
3
|
+
Version: 1.5.7
|
|
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 <Javad.Py1385@gmail.com>
|
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -27,7 +27,7 @@ pip install RubigramClient
|
|
|
27
27
|
from rubigram import Client, filters
|
|
28
28
|
from rubigram.models import Update
|
|
29
29
|
|
|
30
|
-
bot = Client("your_bot_token"
|
|
30
|
+
bot = Client("your_bot_token")
|
|
31
31
|
|
|
32
32
|
@bot.on_message(filters.command("start") & filters.private)
|
|
33
33
|
async def start_handler(client, message: Update):
|
|
@@ -11,7 +11,7 @@ pip install RubigramClient
|
|
|
11
11
|
from rubigram import Client, filters
|
|
12
12
|
from rubigram.models import Update
|
|
13
13
|
|
|
14
|
-
bot = Client("your_bot_token"
|
|
14
|
+
bot = Client("your_bot_token")
|
|
15
15
|
|
|
16
16
|
@bot.on_message(filters.command("start") & filters.private)
|
|
17
17
|
async def start_handler(client, message: Update):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: RubigramClient
|
|
3
|
-
Version: 1.5.
|
|
3
|
+
Version: 1.5.7
|
|
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 <Javad.Py1385@gmail.com>
|
|
6
6
|
Classifier: Programming Language :: Python :: 3
|
|
@@ -27,7 +27,7 @@ pip install RubigramClient
|
|
|
27
27
|
from rubigram import Client, filters
|
|
28
28
|
from rubigram.models import Update
|
|
29
29
|
|
|
30
|
-
bot = Client("your_bot_token"
|
|
30
|
+
bot = Client("your_bot_token")
|
|
31
31
|
|
|
32
32
|
@bot.on_message(filters.command("start") & filters.private)
|
|
33
33
|
async def start_handler(client, message: Update):
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "RubigramClient"
|
|
3
|
-
version = "1.5.
|
|
3
|
+
version = "1.5.7"
|
|
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"
|
|
@@ -7,6 +7,7 @@ from datetime import datetime
|
|
|
7
7
|
from aiohttp import web
|
|
8
8
|
import asyncio
|
|
9
9
|
|
|
10
|
+
|
|
10
11
|
class Client(Method):
|
|
11
12
|
def __init__(
|
|
12
13
|
self,
|
|
@@ -23,8 +24,7 @@ class Client(Method):
|
|
|
23
24
|
self.MESSAGE_HANDLER = []
|
|
24
25
|
self.INLINE_HANDLER = []
|
|
25
26
|
self.state = StateManager()
|
|
26
|
-
super().__init__(token)
|
|
27
|
-
|
|
27
|
+
super().__init__(token)
|
|
28
28
|
|
|
29
29
|
def create_handler(self, type: Literal["message", "inline"], filters: Optional[Filter] = None):
|
|
30
30
|
def decorator(func: Callable) -> Callable:
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
from rubigram.models import Update, InlineMessage
|
|
2
|
+
from typing import Union
|
|
3
|
+
import re
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
class Filter:
|
|
8
|
+
def __init__(self, func):
|
|
9
|
+
self.func = func
|
|
10
|
+
|
|
11
|
+
async def __call__(self, update: Union[Update, InlineMessage]):
|
|
12
|
+
return await self.func(update)
|
|
13
|
+
|
|
14
|
+
async def __and__(self, other: "Filter"):
|
|
15
|
+
async def filter(update):
|
|
16
|
+
return await self(update) and await other(update)
|
|
17
|
+
return Filter(filter)
|
|
18
|
+
|
|
19
|
+
async def __or__(self, other: "Filter"):
|
|
20
|
+
async def filter(update):
|
|
21
|
+
return await self(update) or await other(update)
|
|
22
|
+
return Filter(filter)
|
|
23
|
+
|
|
24
|
+
|
|
25
|
+
|
|
26
|
+
async def TEXT(message: Update):
|
|
27
|
+
if isinstance(message, Update):
|
|
28
|
+
return True if message.new_message and message.new_message.text else False
|
|
29
|
+
return False
|
|
30
|
+
|
|
31
|
+
async def FILE(message: Update):
|
|
32
|
+
if isinstance(message, Update):
|
|
33
|
+
return True if message.new_message and message.new_message.file else False
|
|
34
|
+
return False
|
|
35
|
+
|
|
36
|
+
async def LIVE(message: Update):
|
|
37
|
+
if isinstance(message, Update):
|
|
38
|
+
return True if message.new_message and message.new_message.live_location else False
|
|
39
|
+
return False
|
|
40
|
+
|
|
41
|
+
async def POLL(message: Update):
|
|
42
|
+
if isinstance(message, Update):
|
|
43
|
+
return True if message.new_message and message.new_message.poll else False
|
|
44
|
+
return False
|
|
45
|
+
|
|
46
|
+
async def CONTACT(message: Update):
|
|
47
|
+
if isinstance(message, Update):
|
|
48
|
+
return True if message.new_message and message.new_message.contact_message else False
|
|
49
|
+
return False
|
|
50
|
+
|
|
51
|
+
async def STICKER(message: Update):
|
|
52
|
+
if isinstance(message, Update):
|
|
53
|
+
return True if message.new_message and message.new_message.sticker else False
|
|
54
|
+
return False
|
|
55
|
+
|
|
56
|
+
async def LOCATION(message: Update):
|
|
57
|
+
if isinstance(message, Update):
|
|
58
|
+
return True if message.new_message and message.new_message.location else False
|
|
59
|
+
return False
|
|
60
|
+
|
|
61
|
+
async def FORWARD(message: Update):
|
|
62
|
+
if isinstance(message, Update):
|
|
63
|
+
return True if message.new_message and message.new_message.forwarded_from else False
|
|
64
|
+
return False
|
|
65
|
+
|
|
66
|
+
async def EDITED(message: Update):
|
|
67
|
+
if isinstance(message, Update):
|
|
68
|
+
return True if message.updated_message else False
|
|
69
|
+
return False
|
|
70
|
+
|
|
71
|
+
async def PRIVATE(message: Union[Update, InlineMessage]):
|
|
72
|
+
return True if message.chat_id.startswith("b0") else False
|
|
73
|
+
|
|
74
|
+
async def GROUP(message: Union[Update, InlineMessage]):
|
|
75
|
+
return True if message.chat_id.startswith("g0") else False
|
|
76
|
+
|
|
77
|
+
async def CHANNEL(message: Union[Update, InlineMessage]):
|
|
78
|
+
return True if message.chat_id.startswith("c0") else False
|
|
79
|
+
|
|
80
|
+
async def FORWARD_BOT(message: Update):
|
|
81
|
+
if isinstance(message, Update) and message.new_message:
|
|
82
|
+
return True if message.new_message.forwarded_from and message.new_message.forwarded_from.type_from == "Bot" else False
|
|
83
|
+
|
|
84
|
+
async def FORWARD_USER(message: Update):
|
|
85
|
+
if isinstance(message, Update) and message.new_message:
|
|
86
|
+
return True if message.new_message.forwarded_from and message.new_message.forwarded_from.type_from == "User" else False
|
|
87
|
+
|
|
88
|
+
async def FORWARD_CHANNEL(message: Update):
|
|
89
|
+
if isinstance(message, Update) and message.new_message:
|
|
90
|
+
return True if message.new_message.forwarded_from and message.new_message.forwarded_from.type_from == "Channel" else False
|
|
91
|
+
|
|
92
|
+
|
|
93
|
+
text = Filter(TEXT)
|
|
94
|
+
file = Filter(FILE)
|
|
95
|
+
live = Filter(LIVE)
|
|
96
|
+
poll = Filter(POLL)
|
|
97
|
+
contact = Filter(CONTACT)
|
|
98
|
+
sticker = Filter(STICKER)
|
|
99
|
+
location = Filter(LOCATION)
|
|
100
|
+
forward = Filter(FORWARD)
|
|
101
|
+
edited = Filter(EDITED)
|
|
102
|
+
private = Filter(PRIVATE)
|
|
103
|
+
group = Filter(GROUP)
|
|
104
|
+
channel = Filter(CHANNEL)
|
|
105
|
+
forward_bot = Filter(FORWARD_BOT)
|
|
106
|
+
forward_user = Filter(FORWARD_USER)
|
|
107
|
+
forward_channel = Filter(FORWARD_CHANNEL)
|
|
108
|
+
|
|
109
|
+
|
|
110
|
+
class state(Filter):
|
|
111
|
+
def __init__(self, states: Union[str, list[str]]):
|
|
112
|
+
self.states = states
|
|
113
|
+
super().__init__(self.filter)
|
|
114
|
+
|
|
115
|
+
async def filter(self, update: Union[Update, InlineMessage]):
|
|
116
|
+
states = self.states if isinstance(self.states, list) else [self.states]
|
|
117
|
+
user = await update.client.state.get_state(update.chat_id)
|
|
118
|
+
return user.lower() in states if user else False
|
|
119
|
+
|
|
120
|
+
|
|
121
|
+
class command(Filter):
|
|
122
|
+
def __init__(self, cmd: Union[str, list[str]], prefix: str = "/"):
|
|
123
|
+
self.cmd = cmd
|
|
124
|
+
self.prefix = prefix
|
|
125
|
+
super().__init__(self.filter)
|
|
126
|
+
|
|
127
|
+
async def filter(self, update: Update):
|
|
128
|
+
commands = self.cmd if isinstance(self.cmd, list) else [self.cmd]
|
|
129
|
+
text = ""
|
|
130
|
+
if isinstance(update, Update):
|
|
131
|
+
if update.type == "NewMessage":
|
|
132
|
+
text = update.new_message.text
|
|
133
|
+
elif update.type == "UpdatedMessage":
|
|
134
|
+
text = update.updated_message.text
|
|
135
|
+
if text:
|
|
136
|
+
for cmd in commands:
|
|
137
|
+
if text.lower().startswith(self.prefix + cmd.lower()):
|
|
138
|
+
return True
|
|
139
|
+
return False
|
|
140
|
+
|
|
141
|
+
|
|
142
|
+
class regex(Filter):
|
|
143
|
+
def __init__(self, pattern: str):
|
|
144
|
+
self.pattern = pattern
|
|
145
|
+
super().__init__(self.filter)
|
|
146
|
+
|
|
147
|
+
async def filter(self, update: Union[Update, InlineMessage]):
|
|
148
|
+
text = ""
|
|
149
|
+
if isinstance(update, Update):
|
|
150
|
+
if update.type == "NewMessage":
|
|
151
|
+
text = getattr(update.new_message, "text", "")
|
|
152
|
+
elif update.type == "UpdatedMessage":
|
|
153
|
+
text = getattr(update.updated_message, "text", "")
|
|
154
|
+
elif isinstance(update, InlineMessage):
|
|
155
|
+
text = getattr(update, "text", "")
|
|
156
|
+
|
|
157
|
+
if text:
|
|
158
|
+
return bool(re.search(self.pattern, text))
|
|
159
|
+
return False
|
|
160
|
+
|
|
161
|
+
|
|
162
|
+
class chat(Filter):
|
|
163
|
+
def __init__(self, chat_id: Union[str, list[str]]):
|
|
164
|
+
self.chat_id = chat_id
|
|
165
|
+
super().__init__(self.filter)
|
|
166
|
+
|
|
167
|
+
async def filter(self, update: Union[Update, InlineMessage]):
|
|
168
|
+
chat_ids = self.chat_id if isinstance(self.chat_id, list) else [self.chat_id]
|
|
169
|
+
return update.chat_id in chat_ids
|
|
170
|
+
|
|
171
|
+
|
|
172
|
+
class button(Filter):
|
|
173
|
+
def __init__(self, button_id: Union[str, list[str]]):
|
|
174
|
+
self.button_id = button_id
|
|
175
|
+
super().__init__(self.filter)
|
|
176
|
+
|
|
177
|
+
async def filter(self, update: InlineMessage):
|
|
178
|
+
if isinstance(update, InlineMessage):
|
|
179
|
+
button_ids = self.button_id if isinstance(self.button_id, list) else [self.button_id]
|
|
180
|
+
return update.aux_data.button_id in button_ids
|
|
@@ -3,12 +3,10 @@ from typing import Literal, Optional
|
|
|
3
3
|
from rubigram.models import Bot, Chat, Keypad, MessageId, Updates
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
|
|
7
6
|
class Method(Network):
|
|
8
7
|
def __init__(self, token: str):
|
|
9
8
|
super().__init__(token)
|
|
10
9
|
|
|
11
|
-
|
|
12
10
|
async def get_me(self) -> "Bot":
|
|
13
11
|
response = await self.request("getMe", {})
|
|
14
12
|
return Bot.from_dict(response["bot"])
|
|
@@ -62,7 +62,6 @@ class ManageDB:
|
|
|
62
62
|
data = await cursor.fetchall()
|
|
63
63
|
return {k: v for k, v in data} if data else {}
|
|
64
64
|
|
|
65
|
-
|
|
66
65
|
|
|
67
66
|
async def remove_data(self, user_id: str, key: str = None):
|
|
68
67
|
await self.connect()
|
|
@@ -71,8 +70,7 @@ class ManageDB:
|
|
|
71
70
|
else:
|
|
72
71
|
await self.connection.execute("DELETE FROM user_data WHERE user_id = ?", (user_id,))
|
|
73
72
|
await self.connection.commit()
|
|
74
|
-
|
|
75
|
-
|
|
73
|
+
|
|
76
74
|
|
|
77
75
|
class StateManager:
|
|
78
76
|
def __init__(self):
|
|
@@ -1,192 +0,0 @@
|
|
|
1
|
-
from rubigram.models import Update, InlineMessage
|
|
2
|
-
from typing import Union, Callable, Awaitable
|
|
3
|
-
import re
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
class Filter:
|
|
10
|
-
def __init__(self, func: Callable[[Union[Update, InlineMessage]], Union[bool, Awaitable[bool]]]):
|
|
11
|
-
self.func = func
|
|
12
|
-
|
|
13
|
-
async def __call__(self, update: Union[Update, InlineMessage]) -> bool:
|
|
14
|
-
result = self.func(update)
|
|
15
|
-
if isinstance(result, Awaitable):
|
|
16
|
-
return await result
|
|
17
|
-
return result
|
|
18
|
-
|
|
19
|
-
def __and__(self, other: "Filter"):
|
|
20
|
-
async def combined(update):
|
|
21
|
-
return await self(update) and await other(update)
|
|
22
|
-
return Filter(combined)
|
|
23
|
-
|
|
24
|
-
def __or__(self, other: "Filter"):
|
|
25
|
-
async def combined(update):
|
|
26
|
-
return await self(update) or await other(update)
|
|
27
|
-
return Filter(combined)
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
class state(Filter):
|
|
31
|
-
def __init__(self, states: Union[str, list[str]]):
|
|
32
|
-
self.states = states
|
|
33
|
-
super().__init__(self.filter)
|
|
34
|
-
|
|
35
|
-
async def filter(self, update: Update):
|
|
36
|
-
states = self.states if isinstance(self.states, list) else [self.states]
|
|
37
|
-
if isinstance(update, Update):
|
|
38
|
-
user = await update.client.state.get_state(update.chat_id)
|
|
39
|
-
return user.lower() in states if user else False
|
|
40
|
-
return False
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
class command(Filter):
|
|
44
|
-
def __init__(self, cmd: Union[str, list[str]], prefix: str = "/"):
|
|
45
|
-
self.cmd = cmd
|
|
46
|
-
self.prefix = prefix
|
|
47
|
-
super().__init__(self.filter)
|
|
48
|
-
|
|
49
|
-
def filter(self, update: Update):
|
|
50
|
-
commands = self.cmd if isinstance(self.cmd, list) else [self.cmd]
|
|
51
|
-
text = ""
|
|
52
|
-
if isinstance(update, Update):
|
|
53
|
-
if update.type == "NewMessage":
|
|
54
|
-
text = update.new_message.text
|
|
55
|
-
elif update.type == "UpdatedMessage":
|
|
56
|
-
text = update.updated_message.text
|
|
57
|
-
if text:
|
|
58
|
-
for cmd in commands:
|
|
59
|
-
if text.lower().startswith(self.prefix + cmd.lower()):
|
|
60
|
-
return True
|
|
61
|
-
return False
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
class regex(Filter):
|
|
65
|
-
def __init__(self, pattern: str):
|
|
66
|
-
self.pattern = pattern
|
|
67
|
-
super().__init__(self.filter)
|
|
68
|
-
|
|
69
|
-
def filter(self, update: Union[Update, InlineMessage]):
|
|
70
|
-
text = ""
|
|
71
|
-
if isinstance(update, Update):
|
|
72
|
-
if update.type == "NewMessage":
|
|
73
|
-
text = getattr(update.new_message, "text", "")
|
|
74
|
-
elif update.type == "UpdatedMessage":
|
|
75
|
-
text = getattr(update.updated_message, "text", "")
|
|
76
|
-
elif isinstance(update, InlineMessage):
|
|
77
|
-
text = getattr(update, "text", "")
|
|
78
|
-
|
|
79
|
-
if text:
|
|
80
|
-
return bool(re.search(self.pattern, text))
|
|
81
|
-
return False
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
class chat(Filter):
|
|
85
|
-
def __init__(self, chat_id: Union[str, list[str]]):
|
|
86
|
-
self.chat_id = chat_id
|
|
87
|
-
super().__init__(self.filter)
|
|
88
|
-
|
|
89
|
-
def filter(self, update: Union[Update, InlineMessage]):
|
|
90
|
-
chat_ids = self.chat_id if isinstance(self.chat_id, list) else [self.chat_id]
|
|
91
|
-
return update.chat_id in chat_ids
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
class button(Filter):
|
|
95
|
-
def __init__(self, button_id: Union[str, list[str]]):
|
|
96
|
-
self.button_id = button_id
|
|
97
|
-
super().__init__(self.filter)
|
|
98
|
-
|
|
99
|
-
def filter(self, update: InlineMessage):
|
|
100
|
-
if isinstance(update, InlineMessage):
|
|
101
|
-
button_ids = self.button_id if isinstance(self.button_id, list) else [self.button_id]
|
|
102
|
-
return update.aux_data.button_id in button_ids
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
def TEXT(update: Update):
|
|
107
|
-
return bool(update.new_message and getattr(update.new_message, "text", None))
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
def FILE(update: Update):
|
|
111
|
-
return bool(update.new_message and getattr(update.new_message, "file", None))
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
def LIVE(update: Update):
|
|
115
|
-
return bool(update.new_message and getattr(update.new_message, "live_location", None))
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
def POLL(update: Update):
|
|
119
|
-
return bool(update.new_message and getattr(update.new_message, "poll", None))
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
def CONTACT(update: Update):
|
|
123
|
-
return bool(update.new_message and getattr(update.new_message, "contact_message", None))
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
def STICKER(update: Update):
|
|
127
|
-
return bool(update.new_message and getattr(update.new_message, "sticker", None))
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
def LOCATION(update: Update):
|
|
131
|
-
return bool(update.new_message and getattr(update.new_message, "location", None))
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
def FORWARD(update: Update):
|
|
135
|
-
return bool(update.new_message and getattr(update.new_message, "forwarded_from", None))
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
def EDITED(update: Update):
|
|
139
|
-
if isinstance(update, Update) and update.type == "UpdatedMessage":
|
|
140
|
-
return update.updated_message.is_edited
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
def PRIVATE(update: Update):
|
|
144
|
-
if isinstance(update, Update) and update.type == "NewMessage":
|
|
145
|
-
return update.new_message.sender_type in ["User", "Bot"]
|
|
146
|
-
return False
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
def FORWARD_BOT(update: Update):
|
|
150
|
-
if isinstance(update, Update) and update.type == "NewMessage" and update.new_message.forwarded_from:
|
|
151
|
-
return update.new_message.forwarded_from.type_from == "Bot"
|
|
152
|
-
return False
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
def FORWARD_USER(update: Update):
|
|
156
|
-
if isinstance(update, Update) and update.type == "NewMessage" and update.new_message.forwarded_from:
|
|
157
|
-
return update.new_message.forwarded_from.type_from == "User"
|
|
158
|
-
return False
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
def FORWARD_CHANNEL(update: Update):
|
|
162
|
-
if isinstance(update, Update) and update.type == "NewMessage" and update.new_message.forwarded_from:
|
|
163
|
-
return update.new_message.forwarded_from.type_from == "Channel"
|
|
164
|
-
return False
|
|
165
|
-
|
|
166
|
-
def GROUP(update: Update):
|
|
167
|
-
if isinstance(update, Update):
|
|
168
|
-
return update.chat_id.startswith("g0")
|
|
169
|
-
return False
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
def CHANNEL(update: Update):
|
|
173
|
-
if isinstance(update, Update):
|
|
174
|
-
return update.chat_id.startswith("c0")
|
|
175
|
-
return False
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
text = Filter(TEXT)
|
|
179
|
-
file = Filter(FILE)
|
|
180
|
-
live = Filter(LIVE)
|
|
181
|
-
poll = Filter(POLL)
|
|
182
|
-
group = Filter(GROUP)
|
|
183
|
-
channel = Filter(CHANNEL)
|
|
184
|
-
edited = Filter(EDITED)
|
|
185
|
-
contact = Filter(CONTACT)
|
|
186
|
-
sticker = Filter(STICKER)
|
|
187
|
-
location = Filter(LOCATION)
|
|
188
|
-
forward = Filter(FORWARD)
|
|
189
|
-
private = Filter(PRIVATE)
|
|
190
|
-
forward_bot = Filter(FORWARD_BOT)
|
|
191
|
-
forward_user = Filter(FORWARD_USER)
|
|
192
|
-
forward_channel = Filter(FORWARD_CHANNEL)
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|