robooki 1.0.0__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.
robooki-1.0.0/PKG-INFO ADDED
@@ -0,0 +1,7 @@
1
+ Metadata-Version: 2.1
2
+ Name: robooki
3
+ Version: 1.0.0
4
+ Summary: Robooki library for Rubika
5
+ Author: Developer
6
+ Requires-Python: >=3.7
7
+ Requires-Dist: aiohttp>=3.8.0
@@ -0,0 +1,3 @@
1
+ from .client import Bot, Client
2
+ from .types import Message, User, Chat
3
+ __version__ = "1.0.0"
@@ -0,0 +1,27 @@
1
+
2
+ import aiohttp
3
+ import asyncio
4
+
5
+ class Bot:
6
+ def __init__(self, token: str):
7
+ self.token = token
8
+ self.base_url = f"https://botapi.rubika.ir/v0/{token}"
9
+ self.on_message_callback = None
10
+
11
+ async def send_message(self, chat_id: str, text: str, reply_to_message_id: str = None):
12
+ url = f"{self.base_url}/sendMessage"
13
+ payload = {"chat_id": chat_id, "text": text}
14
+ if reply_to_message_id:
15
+ payload["reply_to_message_id"] = reply_to_message_id
16
+ async with aiohttp.ClientSession() as session:
17
+ async with session.post(url, json=payload) as resp:
18
+ return await resp.json()
19
+
20
+ def on_message(self):
21
+ def decorator(func):
22
+ self.on_message_callback = func
23
+ return func
24
+ return decorator
25
+
26
+ class Client(Bot):
27
+ pass
@@ -0,0 +1,17 @@
1
+
2
+ class Message:
3
+ def __init__(self, data: dict):
4
+ self.raw = data
5
+ msg = data.get("message", data)
6
+ self.message_id = msg.get("message_id")
7
+ self.chat_id = msg.get("chat_id")
8
+ self.text = msg.get("text", "")
9
+ self.sender_id = msg.get("sender_id")
10
+
11
+ class User:
12
+ def __init__(self, data: dict):
13
+ self.user_id = data.get("user_id")
14
+
15
+ class Chat:
16
+ def __init__(self, data: dict):
17
+ self.chat_id = data.get("chat_id")
@@ -0,0 +1,7 @@
1
+ Metadata-Version: 2.1
2
+ Name: robooki
3
+ Version: 1.0.0
4
+ Summary: Robooki library for Rubika
5
+ Author: Developer
6
+ Requires-Python: >=3.7
7
+ Requires-Dist: aiohttp>=3.8.0
@@ -0,0 +1,9 @@
1
+ setup.py
2
+ robooki/__init__.py
3
+ robooki/client.py
4
+ robooki/types.py
5
+ robooki.egg-info/PKG-INFO
6
+ robooki.egg-info/SOURCES.txt
7
+ robooki.egg-info/dependency_links.txt
8
+ robooki.egg-info/requires.txt
9
+ robooki.egg-info/top_level.txt
@@ -0,0 +1 @@
1
+ aiohttp>=3.8.0
@@ -0,0 +1 @@
1
+ robooki
@@ -0,0 +1,4 @@
1
+ [egg_info]
2
+ tag_build =
3
+ tag_date = 0
4
+
robooki-1.0.0/setup.py ADDED
@@ -0,0 +1,11 @@
1
+
2
+ from setuptools import setup, find_packages
3
+ setup(
4
+ name="robooki",
5
+ version="1.0.0",
6
+ packages=find_packages(),
7
+ install_requires=["aiohttp>=3.8.0"],
8
+ author="Developer",
9
+ description="Robooki library for Rubika",
10
+ python_requires=">=3.7",
11
+ )