plustik 0.0.1__py3-none-any.whl

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.
Files changed (53) hide show
  1. plustik/__init__.py +5 -0
  2. plustik/client/__init__.py +74 -0
  3. plustik/documents.md +1256 -0
  4. plustik/objects/__init__.py +44 -0
  5. plustik/objects/animation.py +36 -0
  6. plustik/objects/audio.py +36 -0
  7. plustik/objects/botcommand.py +21 -0
  8. plustik/objects/botcommandscope.py +19 -0
  9. plustik/objects/botcommandscopeallprivatechats.py +19 -0
  10. plustik/objects/botcommandscopechat.py +21 -0
  11. plustik/objects/botcommandscopedefault.py +19 -0
  12. plustik/objects/callbackquery.py +29 -0
  13. plustik/objects/chat.py +61 -0
  14. plustik/objects/chatlocation.py +22 -0
  15. plustik/objects/chatpermissions.py +45 -0
  16. plustik/objects/chatphoto.py +25 -0
  17. plustik/objects/contact.py +27 -0
  18. plustik/objects/dice.py +21 -0
  19. plustik/objects/document.py +30 -0
  20. plustik/objects/file.py +25 -0
  21. plustik/objects/forcereply.py +23 -0
  22. plustik/objects/inlinekeyboardbutton.py +23 -0
  23. plustik/objects/inlinekeyboardmarkup.py +20 -0
  24. plustik/objects/inputfile.py +17 -0
  25. plustik/objects/inputmediaanimation.py +34 -0
  26. plustik/objects/inputmediaaudio.py +34 -0
  27. plustik/objects/inputmediadocument.py +30 -0
  28. plustik/objects/inputmediaphoto.py +28 -0
  29. plustik/objects/inputmediavideo.py +36 -0
  30. plustik/objects/keyboardbutton.py +23 -0
  31. plustik/objects/location.py +21 -0
  32. plustik/objects/maskposition.py +25 -0
  33. plustik/objects/message.py +99 -0
  34. plustik/objects/messageentity.py +30 -0
  35. plustik/objects/messageid.py +3 -0
  36. plustik/objects/photosize.py +27 -0
  37. plustik/objects/replykeyboardmarkup.py +26 -0
  38. plustik/objects/replykeyboardremove.py +19 -0
  39. plustik/objects/responseparameters.py +19 -0
  40. plustik/objects/sticker.py +41 -0
  41. plustik/objects/stickerset.py +27 -0
  42. plustik/objects/update.py +27 -0
  43. plustik/objects/user.py +35 -0
  44. plustik/objects/userprofilephotos.py +22 -0
  45. plustik/objects/video.py +36 -0
  46. plustik/objects/videonote.py +30 -0
  47. plustik/objects/voice.py +27 -0
  48. plustik/objects/webhookinfo.py +33 -0
  49. plustik/utils/httpclient.py +25 -0
  50. plustik-0.0.1.dist-info/METADATA +38 -0
  51. plustik-0.0.1.dist-info/RECORD +53 -0
  52. plustik-0.0.1.dist-info/WHEEL +4 -0
  53. plustik-0.0.1.dist-info/licenses/LICENSE +21 -0
plustik/__init__.py ADDED
@@ -0,0 +1,5 @@
1
+ from .client import *
2
+ from .exceptions import *
3
+ from .filters import *
4
+ from .objects import *
5
+ from .objects import *
@@ -0,0 +1,74 @@
1
+ from typing import List, Optional, Union
2
+
3
+ from plustik import InputFile, WebhookInfo, InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply, \
4
+ Message
5
+ from plustik import MessageEntity
6
+ from plustik.objects.user import User
7
+ from plustik.utils.httpclient import HTTPClient
8
+
9
+
10
+ class Client:
11
+ def __init__(self,
12
+ token: str,
13
+ base_url: str = "https://api.splus.ir"):
14
+ self.token = token
15
+ self.base_url = base_url
16
+ self.httpclient = HTTPClient()
17
+
18
+ async def get_me(self):
19
+ response = await self.httpclient.send_request(f"{self.base_url}/bot{self.token}/" + "getMe")
20
+ return User(**response.json()['result'], client=self)
21
+
22
+ async def logout(self):
23
+ response = await self.httpclient.send_request(f"{self.base_url}/bot{self.token}/" + "LogOut")
24
+ return response.json()['result']
25
+
26
+ async def get_updates(self, offset: int = 0, limit: int = 100, timeout: int = 30,
27
+ allowed_updates: Optional[List[str]] = None):
28
+ response = await self.httpclient.send_request(f"{self.base_url}/bot{self.token}/" + "getUpdates",
29
+ params={"offset": offset, "limit": limit, "timeout": timeout,
30
+ "allowed_updates": allowed_updates})
31
+ return response.json()['result']
32
+
33
+ async def set_webhook(self, url: str, certificate: Optional[InputFile] = None, ip_address: Optional[str] = None,
34
+ max_connections: Optional[int] = 40, allowed_updates: Optional[List[str]] = None,
35
+ drop_pending_updates: Optional[bool] = None):
36
+ response = await self.httpclient.send_request(f"{self.base_url}/bot{self.token}/" + "setWebhook",
37
+ params={"url": url, "certificate": certificate,
38
+ "ip_address": ip_address,
39
+ "max_connections": max_connections,
40
+ "allowed_updates": allowed_updates,
41
+ "drop_pending_updates": drop_pending_updates})
42
+ return response.json()['result']
43
+
44
+ async def delete_webhook(self, drop_pending_updates: Optional[bool] = None):
45
+ response = await self.httpclient.send_request(f"{self.base_url}/bot{self.token}/" + "deleteWebhook",
46
+ params={"drop_pending_updates": drop_pending_updates})
47
+ return response.json()['result']
48
+
49
+ async def get_webhook_info(self):
50
+ response = await self.httpclient.send_request(f"{self.base_url}/bot{self.token}/" + "getWebhookInfo")
51
+ return WebhookInfo(**response.json()['result'], client=self)
52
+
53
+ async def close(self):
54
+ response = await self.httpclient.send_request(f"{self.base_url}/bot{self.token}/" + "close")
55
+ return response.json()['result']
56
+
57
+ async def send_message(self, chat_id: Union[int, str], text: str, parse_mode: Optional[str] = None,
58
+ entities: Optional[List["MessageEntity"]] = None, reply_markup: Optional[
59
+ Union[InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove, ForceReply]] = None,
60
+ disable_web_page_preview: Optional[bool] = None, reply_to_message_id: Optional[int] = None,
61
+ allow_sending_without_reply: Optional[bool] = None):
62
+ response = await self.httpclient.send_request(f"{self.base_url}/bot{self.token}/" + "sendMessage",
63
+ params={
64
+ "chat_id": chat_id,
65
+ "text": text,
66
+ "parse_mode": parse_mode,
67
+ "entities": entities,
68
+ "reply_markup": reply_markup,
69
+ "disable_web_page_preview": disable_web_page_preview,
70
+ "reply_to_message_id": reply_to_message_id,
71
+ "allow_sending_without_reply": allow_sending_without_reply
72
+ }
73
+ )
74
+ return Message(**response.json()['result'], client=self)