multibotkit 0.1.7__tar.gz → 0.1.9__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.
Files changed (44) hide show
  1. {multibotkit-0.1.7 → multibotkit-0.1.9}/PKG-INFO +1 -1
  2. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit/helpers/telegram.py +137 -0
  3. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit/schemas/telegram/outgoing.py +26 -0
  4. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit.egg-info/PKG-INFO +1 -1
  5. {multibotkit-0.1.7 → multibotkit-0.1.9}/setup.py +1 -1
  6. {multibotkit-0.1.7 → multibotkit-0.1.9}/LICENSE +0 -0
  7. {multibotkit-0.1.7 → multibotkit-0.1.9}/README.md +0 -0
  8. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit/__init__.py +0 -0
  9. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit/dispatchers/__init__.py +0 -0
  10. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit/dispatchers/base_dispatcher.py +0 -0
  11. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit/dispatchers/fb.py +0 -0
  12. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit/dispatchers/telegram.py +0 -0
  13. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit/dispatchers/viber.py +0 -0
  14. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit/dispatchers/vk.py +0 -0
  15. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit/helpers/__init__.py +0 -0
  16. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit/helpers/base_helper.py +0 -0
  17. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit/helpers/fb.py +0 -0
  18. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit/helpers/viber.py +0 -0
  19. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit/helpers/vk.py +0 -0
  20. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit/schemas/__init__.py +0 -0
  21. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit/schemas/fb/__init__.py +0 -0
  22. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit/schemas/fb/incoming.py +0 -0
  23. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit/schemas/fb/outgoing.py +0 -0
  24. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit/schemas/telegram/__init__.py +0 -0
  25. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit/schemas/telegram/incoming.py +0 -0
  26. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit/schemas/viber/__init__.py +0 -0
  27. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit/schemas/viber/incoming.py +0 -0
  28. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit/schemas/viber/outgoing.py +0 -0
  29. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit/schemas/vk/__init__.py +0 -0
  30. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit/schemas/vk/incoming.py +0 -0
  31. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit/schemas/vk/outgoing.py +0 -0
  32. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit/states/__init__.py +0 -0
  33. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit/states/managers/__init__.py +0 -0
  34. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit/states/managers/base.py +0 -0
  35. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit/states/managers/memory.py +0 -0
  36. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit/states/managers/mongo.py +0 -0
  37. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit/states/managers/redis.py +0 -0
  38. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit/states/state.py +0 -0
  39. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit.egg-info/SOURCES.txt +0 -0
  40. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit.egg-info/dependency_links.txt +0 -0
  41. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit.egg-info/requires.txt +0 -0
  42. {multibotkit-0.1.7 → multibotkit-0.1.9}/multibotkit.egg-info/top_level.txt +0 -0
  43. {multibotkit-0.1.7 → multibotkit-0.1.9}/pyproject.toml +0 -0
  44. {multibotkit-0.1.7 → multibotkit-0.1.9}/setup.cfg +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: multibotkit
3
- Version: 0.1.7
3
+ Version: 0.1.9
4
4
  Summary: Functional library for developing multiplatform chatbots
5
5
  Home-page: https://github.com/Appvelox/multibotkit
6
6
  Author: Appvelox LLC
@@ -13,6 +13,7 @@ from tenacity import (
13
13
  from multibotkit.helpers.base_helper import BaseHelper
14
14
  from multibotkit.schemas.telegram.outgoing import (
15
15
  Animation,
16
+ Audio,
16
17
  Document,
17
18
  EditMessageMediaModel,
18
19
  InlineKeyboardMarkup,
@@ -24,6 +25,7 @@ from multibotkit.schemas.telegram.outgoing import (
24
25
  SetWebhookParams,
25
26
  WebhookInfo,
26
27
  MediaGroup, ReplyKeyboardRemove,
28
+ Sticker
27
29
  )
28
30
 
29
31
 
@@ -1013,3 +1015,138 @@ class TelegramHelper(BaseHelper):
1013
1015
 
1014
1016
  r = await self._perform_async_request(url, data)
1015
1017
  return r
1018
+
1019
+ async def async_send_audio(
1020
+ self,
1021
+ chat_id: int,
1022
+ audio: str,
1023
+ file_name: Optional[str] = None,
1024
+ caption: Optional[str] = None,
1025
+ parse_mode: str = None,
1026
+ duration: Optional[int] = None,
1027
+ performer: Optional[str] = None,
1028
+ title: Optional[str] = None,
1029
+ thumbnail: Optional[str] = None,
1030
+ disable_notification: Optional[bool] = None,
1031
+ protect_content: Optional[bool] = None,
1032
+ reply_to_message_id: Optional[int] = None,
1033
+ allow_sending_without_reply: Optional[bool] = None,
1034
+ reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup]] = None
1035
+ ):
1036
+ files = {}
1037
+ audio_str = None
1038
+
1039
+ if type(audio) == str:
1040
+ if not (audio.startswith("http://") or audio.startswith("https://")):
1041
+ ends = [".mp3"]
1042
+ for end in ends:
1043
+ if audio.endswith(end):
1044
+ files["audio"] = (file_name if file_name else audio, open(audio, "rb"))
1045
+ audio_str = "attach://animation"
1046
+ if audio_str is None:
1047
+ audio_str = audio
1048
+ else:
1049
+ audio_str = "attach://animation"
1050
+ files["animation"] = (file_name if file_name else "file", audio)
1051
+
1052
+ audio_obj = Audio(
1053
+ chat_id=chat_id,
1054
+ audio=audio_str,
1055
+ caption=caption,
1056
+ parse_mode=parse_mode if parse_mode else "HTML",
1057
+ duration=duration,
1058
+ performer=performer,
1059
+ title=title,
1060
+ thumbnail=thumbnail,
1061
+ disable_notification=disable_notification,
1062
+ protect_content=protect_content,
1063
+ reply_to_message_id=reply_to_message_id,
1064
+ allow_sending_without_reply=allow_sending_without_reply,
1065
+ reply_markup=reply_markup
1066
+ )
1067
+
1068
+ url = self.tg_base_url + "sendAudio"
1069
+ data = audio_obj.dict(exclude_none=True)
1070
+ if "reply_markup" in data.keys():
1071
+ data["reply_markup"] = json.dumps(data["reply_markup"])
1072
+
1073
+ if len(files.keys()):
1074
+ r = await self._perform_async_request(url, data, use_json=False, files=files)
1075
+ return r
1076
+
1077
+ r = await self._perform_async_request(url, data)
1078
+ return r
1079
+
1080
+ async def async_send_sticker(
1081
+ self,
1082
+ chat_id: int,
1083
+ sticker: str,
1084
+ disable_notification: Optional[bool] = None,
1085
+ protect_content: Optional[bool] = None,
1086
+ reply_to_message_id: Optional[int] = None,
1087
+ allow_sending_without_reply: Optional[bool] = None,
1088
+ reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup]] = None
1089
+ ):
1090
+ sticker_obj = Sticker(
1091
+ chat_id=chat_id,
1092
+ sticker=sticker,
1093
+ disable_notification=disable_notification,
1094
+ protect_content=protect_content,
1095
+ reply_to_message_id=reply_to_message_id,
1096
+ allow_sending_without_reply=allow_sending_without_reply,
1097
+ reply_markup=reply_markup
1098
+ )
1099
+
1100
+ url = self.tg_base_url + "sendSticker"
1101
+ data = sticker_obj.dict(exclude_none=True)
1102
+ if "reply_markup" in data.keys():
1103
+ data["reply_markup"] = json.dumps(data["reply_markup"])
1104
+
1105
+ r = await self._perform_async_request(url, data)
1106
+ return r
1107
+
1108
+ def sync_send_sticker(
1109
+ self,
1110
+ chat_id: int,
1111
+ sticker: str,
1112
+ disable_notification: Optional[bool] = None,
1113
+ protect_content: Optional[bool] = None,
1114
+ reply_to_message_id: Optional[int] = None,
1115
+ allow_sending_without_reply: Optional[bool] = None,
1116
+ reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup]] = None
1117
+ ):
1118
+ sticker_obj = Sticker(
1119
+ chat_id=chat_id,
1120
+ sticker=sticker,
1121
+ disable_notification=disable_notification,
1122
+ protect_content=protect_content,
1123
+ reply_to_message_id=reply_to_message_id,
1124
+ allow_sending_without_reply=allow_sending_without_reply,
1125
+ reply_markup=reply_markup
1126
+ )
1127
+
1128
+ url = self.tg_base_url + "sendSticker"
1129
+ data = sticker_obj.dict(exclude_none=True)
1130
+ if "reply_markup" in data.keys():
1131
+ data["reply_markup"] = json.dumps(data["reply_markup"])
1132
+
1133
+ r = self._perform_sync_request(url, data)
1134
+ return r
1135
+
1136
+ def sync_get_sticker_set(
1137
+ self,
1138
+ sticker_set: str,
1139
+ ):
1140
+ url = self.tg_base_url + "getStickerSet"
1141
+ data = {"name": sticker_set}
1142
+ r = self._perform_sync_request(url, data)
1143
+ return r
1144
+
1145
+ async def async_get_sticker_set(
1146
+ self,
1147
+ sticker_set: str,
1148
+ ):
1149
+ url = self.tg_base_url + "getStickerSet"
1150
+ data = {"name": sticker_set}
1151
+ r = await self._perform_async_request(url, data)
1152
+ return r
@@ -202,3 +202,29 @@ class Animation(BaseModel):
202
202
  reply_to_message_id: Optional[int] = Field(None, title="reply to message id")
203
203
  allow_sending_without_reply: Optional[bool] = Field(None, title="allow sending without reply")
204
204
  reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup]] = Field(None, title="reply markup")
205
+
206
+
207
+ class Audio(BaseModel):
208
+ chat_id: int = Field(..., title="chat id")
209
+ audio: str = Field(..., title="document")
210
+ caption: Optional[str] = Field(None, title="caption")
211
+ parse_mode: str = Field("HTML", title="parse mode")
212
+ duration: Optional[int] = Field(None, title="Duration of sent animation in seconds")
213
+ performer: Optional[str] = Field(None, title="Performer")
214
+ title: Optional[str] = Field(None, title="Title")
215
+ thumbnail: Optional[str] = Field(None, title="document thumbnail")
216
+ disable_notification: Optional[bool] = Field(None, title="disable notification")
217
+ protect_content: Optional[bool] = Field(None, title="protect content")
218
+ reply_to_message_id: Optional[int] = Field(None, title="reply to message id")
219
+ allow_sending_without_reply: Optional[bool] = Field(None, title="allow sending without reply")
220
+ reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup]] = Field(None, title="reply markup")
221
+
222
+
223
+ class Sticker(BaseModel):
224
+ chat_id: int = Field(..., title="chat id")
225
+ sticker: str = Field(..., title="document")
226
+ disable_notification: Optional[bool] = Field(None, title="disable notification")
227
+ protect_content: Optional[bool] = Field(None, title="protect content")
228
+ reply_to_message_id: Optional[int] = Field(None, title="reply to message id")
229
+ allow_sending_without_reply: Optional[bool] = Field(None, title="allow sending without reply")
230
+ reply_markup: Optional[Union[InlineKeyboardMarkup, ReplyKeyboardMarkup]] = Field(None, title="reply markup")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: multibotkit
3
- Version: 0.1.7
3
+ Version: 0.1.9
4
4
  Summary: Functional library for developing multiplatform chatbots
5
5
  Home-page: https://github.com/Appvelox/multibotkit
6
6
  Author: Appvelox LLC
@@ -5,7 +5,7 @@ with open("README.md", "r") as fh:
5
5
 
6
6
  setuptools.setup(
7
7
  name="multibotkit",
8
- version="0.1.7",
8
+ version="0.1.9",
9
9
  author="Appvelox LLC",
10
10
  author_email="team@appvelox.ru",
11
11
  description="Functional library for developing multiplatform chatbots",
File without changes
File without changes
File without changes
File without changes