RubigramClient 1.6.1__tar.gz → 1.6.2__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.6.1
3
+ Version: 1.6.2
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.6.1
3
+ Version: 1.6.2
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.6.1"
3
+ version = "1.6.2"
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,8 @@ from datetime import datetime
7
7
  from aiohttp import web
8
8
  import asyncio
9
9
 
10
+
11
+
10
12
  class Client(Method):
11
13
  def __init__(
12
14
  self,
@@ -20,11 +22,13 @@ class Client(Method):
20
22
  self.host = host
21
23
  self.port = port
22
24
  self.offset_id = None
25
+ self.ROUTES = []
23
26
  self.MESSAGE_HANDLER = []
24
27
  self.INLINE_HANDLER = []
25
28
  self.state = StateManager()
26
29
  super().__init__(token)
27
30
 
31
+
28
32
  def create_handler(self, type: Literal["message", "inline"], filters: Optional[Filter] = None):
29
33
  def decorator(func: Callable) -> Callable:
30
34
  async def wrapper(client: Client, update: Update):
@@ -100,11 +104,22 @@ class Client(Method):
100
104
  await self.state.stop()
101
105
  await self.stop()
102
106
 
107
+ def create_app(self, path: str, method: str = "Get"):
108
+ def decorator(func):
109
+ self.ROUTES.append((path, func, method))
110
+ return func
111
+ return decorator
112
+
103
113
  def run(self):
104
114
  if self.endpoint:
105
115
  app = web.Application()
106
116
  app.on_startup(self.on_startup)
107
117
  app.on_cleanup(self.on_cleanup)
118
+ for path, func, method in self.ROUTES:
119
+ if method.upper() == "GET":
120
+ app.router.add_get(path, func)
121
+ elif method.upper() == "POST":
122
+ app.router.add_post(path, func)
108
123
  app.router.add_post("/ReceiveUpdate", self.create_request_handler())
109
124
  app.router.add_post("/ReceiveInlineMessage", self.create_request_handler())
110
125
  web.run_app(app, host=self.host, port=self.port)
File without changes
File without changes
File without changes