RubigramClient 1.3.7__tar.gz → 1.3.9__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.

@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: RubigramClient
3
- Version: 1.3.7
3
+ Version: 1.3.9
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
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: RubigramClient
3
- Version: 1.3.7
3
+ Version: 1.3.9
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
@@ -1,6 +1,6 @@
1
1
  [project]
2
2
  name = "RubigramClient"
3
- version = "1.3.7"
3
+ version = "1.3.9"
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"
@@ -4,7 +4,7 @@ from aiohttp import web
4
4
 
5
5
 
6
6
  class Client(Method):
7
- def __init__(self, token: str, endpoint: str = None, host: str = "0.0.0.0", port: int = 5000):
7
+ def __init__(self, token: str, endpoint: str = None, host: str = "0.0.0.0", port: int = 8000):
8
8
  self.token = token
9
9
  self.port = port
10
10
  self.host = host
@@ -0,0 +1,105 @@
1
+ from rubigram.types import Update, InlineMessage
2
+ from typing import Union
3
+ import re
4
+
5
+ def command(commands: Union[str, list[str]], prefixe: str = "/"):
6
+ def filter(message: Update):
7
+ if isinstance(message, Update) and message.type == "NewMessage" and message.new_message.text:
8
+ text = message.new_message.text
9
+ COMMANDS = commands if isinstance(commands, list) else [commands]
10
+ for cmd in COMMANDS:
11
+ if text.lower().startswith(prefixe + cmd):
12
+ return True
13
+ return False
14
+ return filter
15
+
16
+ def button(id: Union[str, list[str]]):
17
+ def filter(message: InlineMessage):
18
+ if isinstance(message, InlineMessage):
19
+ button_id = message.aux_data.button_id
20
+ ID = id if isinstance(id, list) else [id]
21
+ for i in ID:
22
+ if button_id == i:
23
+ return True
24
+ return False
25
+ return filter
26
+
27
+ def chat(chat_id: Union[str, list[str]]):
28
+ def filter(message: Union[Update, InlineMessage]):
29
+ chat_ids = chat_id if isinstance(chat_id, list) else [chat_id]
30
+ if isinstance(message, Update) or isinstance(message, InlineMessage):
31
+ return message.chat_id in chat_ids
32
+ return False
33
+ return filter
34
+
35
+ def regex(pattern: str):
36
+ def filter(message: Union[Update, InlineMessage]):
37
+ if isinstance(message, Update) and message.type == "NewMessage" and message.new_message.text:
38
+ return bool(re.search(pattern, message.new_message.text))
39
+ elif isinstance(message, InlineMessage) and message.text:
40
+ return bool(re.search(pattern, message.text))
41
+ return False
42
+ return filter
43
+
44
+ def text():
45
+ def filter(message: Update):
46
+ if isinstance(message, Update) and message.type == "NewMessage":
47
+ return message.new_message.text is None
48
+ return False
49
+ return filter
50
+
51
+ def file():
52
+ def filter(message: Update):
53
+ if isinstance(message, Update) and message.type == "NewMessage":
54
+ return message.new_message.file is None
55
+ return False
56
+ return filter
57
+
58
+ def private():
59
+ def filter(message: Update):
60
+ if isinstance(message, Update) and message.type == "NewMessage":
61
+ return message.new_message.sender_type in ["User", "Bot"]
62
+ return False
63
+ return filter
64
+
65
+ def forward():
66
+ def filter(message: Update):
67
+ if isinstance(message, Update) and message.type == "NewMessage":
68
+ return message.new_message.forwarded_from is None
69
+ return False
70
+ return filter
71
+
72
+ def location():
73
+ def filter(message: Update):
74
+ if isinstance(message, Update) and message.type == "NewMessage":
75
+ return message.new_message.location is None
76
+ return False
77
+ return filter
78
+
79
+ def sticker():
80
+ def filter(message: Update):
81
+ if isinstance(message, Update) and message.type == "NewMessage":
82
+ return message.new_message.sticker is None
83
+ return False
84
+ return filter
85
+
86
+ def contact():
87
+ def filter(message: Update):
88
+ if isinstance(message, Update) and message.type == "NewMessage":
89
+ return message.new_message.contact_message is None
90
+ return False
91
+ return filter
92
+
93
+ def poll():
94
+ def filter(message: Update):
95
+ if isinstance(message, Update) and message.type == "NewMessage":
96
+ return message.new_message.poll is None
97
+ return False
98
+ return filter
99
+
100
+ def live():
101
+ def filter(message: Update):
102
+ if isinstance(message, Update) and message.type == "NewMessage":
103
+ return message.new_message.live_location is None
104
+ return False
105
+ return filter
@@ -1,53 +0,0 @@
1
- from rubigram.types import Update, InlineMessage
2
- from typing import Union
3
-
4
- def command(commands: Union[str, list[str]], prefixe: str = "/"):
5
- def filter(message: Update):
6
- if isinstance(message, Update) and message.type == "NewMessage" and message.new_message.text:
7
- text = message.new_message.text
8
- COMMANDS = commands if isinstance(commands, list) else [commands]
9
- for cmd in COMMANDS:
10
- if text.lower().startswith(prefixe + cmd):
11
- return True
12
- return False
13
- return filter
14
-
15
- def button(id: Union[str, list[str]]):
16
- def filter(message: InlineMessage):
17
- if isinstance(message, InlineMessage):
18
- button_id = message.aux_data.button_id
19
- ID = id if isinstance(id, list) else [id]
20
- for i in ID:
21
- if button_id == i:
22
- return True
23
- return False
24
- return filter
25
-
26
- def chat(chat_id: Union[str, list[str]]):
27
- def filter(message: Union[Update, InlineMessage]):
28
- chat_ids = chat_id if isinstance(chat_id, list) else [chat_id]
29
- if isinstance(message, Update) or isinstance(message, InlineMessage):
30
- return message.chat_id in chat_ids
31
- return False
32
- return filter
33
-
34
- def text():
35
- def filter(message: Update):
36
- if isinstance(message, Update) and message.type == "NewMessage":
37
- return bool(message.new_message.text)
38
- return False
39
- return filter
40
-
41
- def file():
42
- def filter(message: Update):
43
- if isinstance(message, Update) and message.type == "NewMessage":
44
- return bool(message.new_message.file)
45
- return False
46
- return filter
47
-
48
- def private():
49
- def filter(message: Update):
50
- if isinstance(message, Update) and message.type == "NewMessage":
51
- return message.new_message.sender_type in ["User", "Bot"]
52
- return False
53
- return filter
File without changes
File without changes
File without changes