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 +7 -0
- robooki-1.0.0/robooki/__init__.py +3 -0
- robooki-1.0.0/robooki/client.py +27 -0
- robooki-1.0.0/robooki/types.py +17 -0
- robooki-1.0.0/robooki.egg-info/PKG-INFO +7 -0
- robooki-1.0.0/robooki.egg-info/SOURCES.txt +9 -0
- robooki-1.0.0/robooki.egg-info/dependency_links.txt +1 -0
- robooki-1.0.0/robooki.egg-info/requires.txt +1 -0
- robooki-1.0.0/robooki.egg-info/top_level.txt +1 -0
- robooki-1.0.0/setup.cfg +4 -0
- robooki-1.0.0/setup.py +11 -0
robooki-1.0.0/PKG-INFO
ADDED
|
@@ -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 @@
|
|
|
1
|
+
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
aiohttp>=3.8.0
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
robooki
|
robooki-1.0.0/setup.cfg
ADDED
robooki-1.0.0/setup.py
ADDED