RubigramClient 1.6.1__tar.gz → 1.6.3__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.3
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.3
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.3"
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
- self.state = StateManager()
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):
@@ -66,11 +70,11 @@ class Client(Method):
66
70
 
67
71
  async def on_startup(self, app):
68
72
  await self.set_endpoints()
69
- await self.state.start()
73
+ # await self.state.start()
70
74
  await self.start()
71
75
 
72
76
  async def on_cleanup(self, app):
73
- await self.state.stop()
77
+ # await self.state.stop()
74
78
  await self.stop()
75
79
 
76
80
  def create_request_handler(self):
@@ -82,7 +86,7 @@ class Client(Method):
82
86
 
83
87
  async def runner(self):
84
88
  try:
85
- await self.state.start()
89
+ # await self.state.start()
86
90
  while True:
87
91
  get_updates = await self.get_update(100, self.offset_id)
88
92
  if get_updates.updates:
@@ -97,14 +101,25 @@ class Client(Method):
97
101
  except Exception as error:
98
102
  print(f"ERROR : {error}")
99
103
  finally:
100
- await self.state.stop()
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