PySPlusthon 0.5.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.
Files changed (291) hide show
  1. pysplusthon-0.5.0/LICENSE +19 -0
  2. pysplusthon-0.5.0/PKG-INFO +65 -0
  3. pysplusthon-0.5.0/PySPlusthon/__init__.py +3 -0
  4. pysplusthon-0.5.0/PySPlusthon/client/__init__.py +1 -0
  5. pysplusthon-0.5.0/PySPlusthon/client/attachments/__init__.py +29 -0
  6. pysplusthon-0.5.0/PySPlusthon/client/attachments/get_file.py +22 -0
  7. pysplusthon-0.5.0/PySPlusthon/client/attachments/send_animation.py +71 -0
  8. pysplusthon-0.5.0/PySPlusthon/client/attachments/send_audio.py +54 -0
  9. pysplusthon-0.5.0/PySPlusthon/client/attachments/send_contact.py +47 -0
  10. pysplusthon-0.5.0/PySPlusthon/client/attachments/send_document.py +63 -0
  11. pysplusthon-0.5.0/PySPlusthon/client/attachments/send_location.py +45 -0
  12. pysplusthon-0.5.0/PySPlusthon/client/attachments/send_media_group.py +88 -0
  13. pysplusthon-0.5.0/PySPlusthon/client/attachments/send_photo.py +67 -0
  14. pysplusthon-0.5.0/PySPlusthon/client/attachments/send_sticker.py +51 -0
  15. pysplusthon-0.5.0/PySPlusthon/client/attachments/send_video.py +56 -0
  16. pysplusthon-0.5.0/PySPlusthon/client/attachments/send_voice.py +52 -0
  17. pysplusthon-0.5.0/PySPlusthon/client/attachments/upload_file.py +82 -0
  18. pysplusthon-0.5.0/PySPlusthon/client/chats/__init__.py +43 -0
  19. pysplusthon-0.5.0/PySPlusthon/client/chats/ban_chat_member.py +24 -0
  20. pysplusthon-0.5.0/PySPlusthon/client/chats/delete_chat_photo.py +32 -0
  21. pysplusthon-0.5.0/PySPlusthon/client/chats/get_chat.py +69 -0
  22. pysplusthon-0.5.0/PySPlusthon/client/chats/get_chat_administrators.py +18 -0
  23. pysplusthon-0.5.0/PySPlusthon/client/chats/get_chat_history.py +39 -0
  24. pysplusthon-0.5.0/PySPlusthon/client/chats/get_chat_member.py +16 -0
  25. pysplusthon-0.5.0/PySPlusthon/client/chats/get_chat_members.py +29 -0
  26. pysplusthon-0.5.0/PySPlusthon/client/chats/get_chat_members_count.py +21 -0
  27. pysplusthon-0.5.0/PySPlusthon/client/chats/join_chat.py +31 -0
  28. pysplusthon-0.5.0/PySPlusthon/client/chats/leave_chat.py +22 -0
  29. pysplusthon-0.5.0/PySPlusthon/client/chats/pin_chat_message.py +31 -0
  30. pysplusthon-0.5.0/PySPlusthon/client/chats/promote_chat_member.py +64 -0
  31. pysplusthon-0.5.0/PySPlusthon/client/chats/restrict_chat_member.py +25 -0
  32. pysplusthon-0.5.0/PySPlusthon/client/chats/set_chat_description.py +23 -0
  33. pysplusthon-0.5.0/PySPlusthon/client/chats/set_chat_photo.py +33 -0
  34. pysplusthon-0.5.0/PySPlusthon/client/chats/set_chat_title.py +23 -0
  35. pysplusthon-0.5.0/PySPlusthon/client/chats/unban_chat_member.py +24 -0
  36. pysplusthon-0.5.0/PySPlusthon/client/chats/unpin_all_chat_messages.py +38 -0
  37. pysplusthon-0.5.0/PySPlusthon/client/chats/unpin_chat_message.py +33 -0
  38. pysplusthon-0.5.0/PySPlusthon/client/client.py +232 -0
  39. pysplusthon-0.5.0/PySPlusthon/client/invite_links/__init__.py +7 -0
  40. pysplusthon-0.5.0/PySPlusthon/client/invite_links/create_chat_invite_link.py +14 -0
  41. pysplusthon-0.5.0/PySPlusthon/client/invite_links/export_chat_invite_link.py +21 -0
  42. pysplusthon-0.5.0/PySPlusthon/client/invite_links/revoke_chat_invite_link.py +23 -0
  43. pysplusthon-0.5.0/PySPlusthon/client/messages/__init__.py +21 -0
  44. pysplusthon-0.5.0/PySPlusthon/client/messages/answer_callback_query.py +12 -0
  45. pysplusthon-0.5.0/PySPlusthon/client/messages/copy_message.py +43 -0
  46. pysplusthon-0.5.0/PySPlusthon/client/messages/delete_message.py +29 -0
  47. pysplusthon-0.5.0/PySPlusthon/client/messages/edit_message_caption.py +40 -0
  48. pysplusthon-0.5.0/PySPlusthon/client/messages/edit_message_reply_markup.py +17 -0
  49. pysplusthon-0.5.0/PySPlusthon/client/messages/edit_message_text.py +40 -0
  50. pysplusthon-0.5.0/PySPlusthon/client/messages/forward_message.py +35 -0
  51. pysplusthon-0.5.0/PySPlusthon/client/messages/send_message.py +38 -0
  52. pysplusthon-0.5.0/PySPlusthon/client/stickers/__init__.py +9 -0
  53. pysplusthon-0.5.0/PySPlusthon/client/stickers/add_sticker_to_set.py +15 -0
  54. pysplusthon-0.5.0/PySPlusthon/client/stickers/create_new_sticker_set.py +16 -0
  55. pysplusthon-0.5.0/PySPlusthon/client/stickers/delete_sticker_from_set.py +10 -0
  56. pysplusthon-0.5.0/PySPlusthon/client/stickers/get_sticker_set.py +11 -0
  57. pysplusthon-0.5.0/PySPlusthon/client/stickers/upload_sticker_file.py +16 -0
  58. pysplusthon-0.5.0/PySPlusthon/client/updates/__init__.py +8 -0
  59. pysplusthon-0.5.0/PySPlusthon/client/updates/delete_webhook.py +9 -0
  60. pysplusthon-0.5.0/PySPlusthon/client/updates/get_updates.py +14 -0
  61. pysplusthon-0.5.0/PySPlusthon/client/updates/get_webhook_info.py +10 -0
  62. pysplusthon-0.5.0/PySPlusthon/client/updates/set_webhook.py +10 -0
  63. pysplusthon-0.5.0/PySPlusthon/client/users/__init__.py +6 -0
  64. pysplusthon-0.5.0/PySPlusthon/client/users/ask_review.py +14 -0
  65. pysplusthon-0.5.0/PySPlusthon/client/users/get_me.py +16 -0
  66. pysplusthon-0.5.0/PySPlusthon/conditions/__init__.py +43 -0
  67. pysplusthon-0.5.0/PySPlusthon/conditions/all.py +6 -0
  68. pysplusthon-0.5.0/PySPlusthon/conditions/animation.py +7 -0
  69. pysplusthon-0.5.0/PySPlusthon/conditions/at_state.py +18 -0
  70. pysplusthon-0.5.0/PySPlusthon/conditions/audio.py +7 -0
  71. pysplusthon-0.5.0/PySPlusthon/conditions/author.py +13 -0
  72. pysplusthon-0.5.0/PySPlusthon/conditions/caption.py +7 -0
  73. pysplusthon-0.5.0/PySPlusthon/conditions/channel.py +11 -0
  74. pysplusthon-0.5.0/PySPlusthon/conditions/channel_chat_created.py +7 -0
  75. pysplusthon-0.5.0/PySPlusthon/conditions/chat.py +14 -0
  76. pysplusthon-0.5.0/PySPlusthon/conditions/click.py +24 -0
  77. pysplusthon-0.5.0/PySPlusthon/conditions/command.py +23 -0
  78. pysplusthon-0.5.0/PySPlusthon/conditions/condition.py +88 -0
  79. pysplusthon-0.5.0/PySPlusthon/conditions/contact.py +7 -0
  80. pysplusthon-0.5.0/PySPlusthon/conditions/content.py +7 -0
  81. pysplusthon-0.5.0/PySPlusthon/conditions/delete_chat_photo.py +7 -0
  82. pysplusthon-0.5.0/PySPlusthon/conditions/document.py +7 -0
  83. pysplusthon-0.5.0/PySPlusthon/conditions/entities.py +7 -0
  84. pysplusthon-0.5.0/PySPlusthon/conditions/equals.py +14 -0
  85. pysplusthon-0.5.0/PySPlusthon/conditions/forward.py +7 -0
  86. pysplusthon-0.5.0/PySPlusthon/conditions/group.py +11 -0
  87. pysplusthon-0.5.0/PySPlusthon/conditions/group_chat_created.py +7 -0
  88. pysplusthon-0.5.0/PySPlusthon/conditions/is_admin.py +17 -0
  89. pysplusthon-0.5.0/PySPlusthon/conditions/is_instance.py +10 -0
  90. pysplusthon-0.5.0/PySPlusthon/conditions/is_joined.py +61 -0
  91. pysplusthon-0.5.0/PySPlusthon/conditions/left_chat_member.py +7 -0
  92. pysplusthon-0.5.0/PySPlusthon/conditions/location.py +7 -0
  93. pysplusthon-0.5.0/PySPlusthon/conditions/media.py +7 -0
  94. pysplusthon-0.5.0/PySPlusthon/conditions/media_group.py +7 -0
  95. pysplusthon-0.5.0/PySPlusthon/conditions/new_chat_members.py +7 -0
  96. pysplusthon-0.5.0/PySPlusthon/conditions/new_chat_photo.py +7 -0
  97. pysplusthon-0.5.0/PySPlusthon/conditions/new_chat_title.py +7 -0
  98. pysplusthon-0.5.0/PySPlusthon/conditions/number.py +12 -0
  99. pysplusthon-0.5.0/PySPlusthon/conditions/photo.py +7 -0
  100. pysplusthon-0.5.0/PySPlusthon/conditions/pinned_message.py +7 -0
  101. pysplusthon-0.5.0/PySPlusthon/conditions/poll.py +7 -0
  102. pysplusthon-0.5.0/PySPlusthon/conditions/private.py +11 -0
  103. pysplusthon-0.5.0/PySPlusthon/conditions/regex.py +17 -0
  104. pysplusthon-0.5.0/PySPlusthon/conditions/reply.py +7 -0
  105. pysplusthon-0.5.0/PySPlusthon/conditions/sticker.py +7 -0
  106. pysplusthon-0.5.0/PySPlusthon/conditions/supergroup_chat_created.py +7 -0
  107. pysplusthon-0.5.0/PySPlusthon/conditions/text.py +7 -0
  108. pysplusthon-0.5.0/PySPlusthon/conditions/video.py +7 -0
  109. pysplusthon-0.5.0/PySPlusthon/conditions/voice.py +7 -0
  110. pysplusthon-0.5.0/PySPlusthon/dispatcher/__init__.py +5 -0
  111. pysplusthon-0.5.0/PySPlusthon/dispatcher/chain.py +165 -0
  112. pysplusthon-0.5.0/PySPlusthon/dispatcher/dispatcher.py +124 -0
  113. pysplusthon-0.5.0/PySPlusthon/dispatcher/logging_chain.py +36 -0
  114. pysplusthon-0.5.0/PySPlusthon/dispatcher/monitoring_chain.py +19 -0
  115. pysplusthon-0.5.0/PySPlusthon/dispatcher/printing_chain.py +21 -0
  116. pysplusthon-0.5.0/PySPlusthon/enums/__init__.py +7 -0
  117. pysplusthon-0.5.0/PySPlusthon/enums/chat_member_status.py +9 -0
  118. pysplusthon-0.5.0/PySPlusthon/enums/chat_type.py +9 -0
  119. pysplusthon-0.5.0/PySPlusthon/enums/message_media_type.py +16 -0
  120. pysplusthon-0.5.0/PySPlusthon/enums/name_enum.py +13 -0
  121. pysplusthon-0.5.0/PySPlusthon/enums/peer_type.py +8 -0
  122. pysplusthon-0.5.0/PySPlusthon/enums/poll_type.py +8 -0
  123. pysplusthon-0.5.0/PySPlusthon/enums/transaction_status.py +10 -0
  124. pysplusthon-0.5.0/PySPlusthon/errors/__init__.py +11 -0
  125. pysplusthon-0.5.0/PySPlusthon/errors/dispatching_errors/__init__.py +2 -0
  126. pysplusthon-0.5.0/PySPlusthon/errors/dispatching_errors/break_dispatching.py +2 -0
  127. pysplusthon-0.5.0/PySPlusthon/errors/dispatching_errors/continue_dispatching.py +2 -0
  128. pysplusthon-0.5.0/PySPlusthon/errors/rpc_errors/__init__.py +8 -0
  129. pysplusthon-0.5.0/PySPlusthon/errors/rpc_errors/bad_request_error.py +6 -0
  130. pysplusthon-0.5.0/PySPlusthon/errors/rpc_errors/flood_error.py +6 -0
  131. pysplusthon-0.5.0/PySPlusthon/errors/rpc_errors/forbidden_error.py +6 -0
  132. pysplusthon-0.5.0/PySPlusthon/errors/rpc_errors/internal_error.py +6 -0
  133. pysplusthon-0.5.0/PySPlusthon/errors/rpc_errors/not_found_error.py +6 -0
  134. pysplusthon-0.5.0/PySPlusthon/errors/rpc_errors/rpc_error.py +23 -0
  135. pysplusthon-0.5.0/PySPlusthon/errors/rpc_errors/too_many_requests.py +10 -0
  136. pysplusthon-0.5.0/PySPlusthon/errors/rpc_errors/unauthorized_error.py +6 -0
  137. pysplusthon-0.5.0/PySPlusthon/event_handlers/__init__.py +12 -0
  138. pysplusthon-0.5.0/PySPlusthon/event_handlers/callback_query_handler.py +16 -0
  139. pysplusthon-0.5.0/PySPlusthon/event_handlers/command_handler.py +46 -0
  140. pysplusthon-0.5.0/PySPlusthon/event_handlers/connect_handler.py +19 -0
  141. pysplusthon-0.5.0/PySPlusthon/event_handlers/disconnect_handler.py +18 -0
  142. pysplusthon-0.5.0/PySPlusthon/event_handlers/edited_message_handler.py +16 -0
  143. pysplusthon-0.5.0/PySPlusthon/event_handlers/error_handler.py +15 -0
  144. pysplusthon-0.5.0/PySPlusthon/event_handlers/event_handler.py +53 -0
  145. pysplusthon-0.5.0/PySPlusthon/event_handlers/initialize_handler.py +18 -0
  146. pysplusthon-0.5.0/PySPlusthon/event_handlers/message_handler.py +16 -0
  147. pysplusthon-0.5.0/PySPlusthon/event_handlers/shipping_query_handler.py +16 -0
  148. pysplusthon-0.5.0/PySPlusthon/event_handlers/shutdown_handler.py +18 -0
  149. pysplusthon-0.5.0/PySPlusthon/event_handlers/update_handler.py +16 -0
  150. pysplusthon-0.5.0/PySPlusthon/network/__init__.py +1 -0
  151. pysplusthon-0.5.0/PySPlusthon/network/httpconnection.py +74 -0
  152. pysplusthon-0.5.0/PySPlusthon/objects/__init__.py +44 -0
  153. pysplusthon-0.5.0/PySPlusthon/objects/animation.py +44 -0
  154. pysplusthon-0.5.0/PySPlusthon/objects/audio.py +36 -0
  155. pysplusthon-0.5.0/PySPlusthon/objects/callback_query.py +37 -0
  156. pysplusthon-0.5.0/PySPlusthon/objects/chat.py +118 -0
  157. pysplusthon-0.5.0/PySPlusthon/objects/chat_member.py +53 -0
  158. pysplusthon-0.5.0/PySPlusthon/objects/chat_permissions.py +26 -0
  159. pysplusthon-0.5.0/PySPlusthon/objects/chat_photo.py +24 -0
  160. pysplusthon-0.5.0/PySPlusthon/objects/contact.py +18 -0
  161. pysplusthon-0.5.0/PySPlusthon/objects/copy_text_button.py +18 -0
  162. pysplusthon-0.5.0/PySPlusthon/objects/date.py +35 -0
  163. pysplusthon-0.5.0/PySPlusthon/objects/document.py +36 -0
  164. pysplusthon-0.5.0/PySPlusthon/objects/edited_message.py +27 -0
  165. pysplusthon-0.5.0/PySPlusthon/objects/entity.py +21 -0
  166. pysplusthon-0.5.0/PySPlusthon/objects/file.py +21 -0
  167. pysplusthon-0.5.0/PySPlusthon/objects/forward_origin.py +22 -0
  168. pysplusthon-0.5.0/PySPlusthon/objects/inline_keyboard.py +65 -0
  169. pysplusthon-0.5.0/PySPlusthon/objects/inline_keyboard_button.py +42 -0
  170. pysplusthon-0.5.0/PySPlusthon/objects/input_media.py +44 -0
  171. pysplusthon-0.5.0/PySPlusthon/objects/input_media_photo.py +14 -0
  172. pysplusthon-0.5.0/PySPlusthon/objects/input_media_video.py +14 -0
  173. pysplusthon-0.5.0/PySPlusthon/objects/invite_link.py +32 -0
  174. pysplusthon-0.5.0/PySPlusthon/objects/list.py +24 -0
  175. pysplusthon-0.5.0/PySPlusthon/objects/location.py +14 -0
  176. pysplusthon-0.5.0/PySPlusthon/objects/message.py +478 -0
  177. pysplusthon-0.5.0/PySPlusthon/objects/message_id.py +31 -0
  178. pysplusthon-0.5.0/PySPlusthon/objects/object.py +154 -0
  179. pysplusthon-0.5.0/PySPlusthon/objects/order_info.py +19 -0
  180. pysplusthon-0.5.0/PySPlusthon/objects/photo.py +31 -0
  181. pysplusthon-0.5.0/PySPlusthon/objects/poll.py +34 -0
  182. pysplusthon-0.5.0/PySPlusthon/objects/poll_option.py +16 -0
  183. pysplusthon-0.5.0/PySPlusthon/objects/reply_keyboard.py +79 -0
  184. pysplusthon-0.5.0/PySPlusthon/objects/reply_keyboard_button.py +29 -0
  185. pysplusthon-0.5.0/PySPlusthon/objects/reply_keyboard_remove.py +10 -0
  186. pysplusthon-0.5.0/PySPlusthon/objects/reply_markup.py +12 -0
  187. pysplusthon-0.5.0/PySPlusthon/objects/shipping_address.py +22 -0
  188. pysplusthon-0.5.0/PySPlusthon/objects/shipping_query.py +20 -0
  189. pysplusthon-0.5.0/PySPlusthon/objects/sticker.py +54 -0
  190. pysplusthon-0.5.0/PySPlusthon/objects/sticker_set.py +29 -0
  191. pysplusthon-0.5.0/PySPlusthon/objects/transaction.py +25 -0
  192. pysplusthon-0.5.0/PySPlusthon/objects/update.py +33 -0
  193. pysplusthon-0.5.0/PySPlusthon/objects/user.py +60 -0
  194. pysplusthon-0.5.0/PySPlusthon/objects/video.py +45 -0
  195. pysplusthon-0.5.0/PySPlusthon/objects/voice.py +31 -0
  196. pysplusthon-0.5.0/PySPlusthon/objects/webhook_info.py +16 -0
  197. pysplusthon-0.5.0/PySPlusthon/proto/__init__.py +2 -0
  198. pysplusthon-0.5.0/PySPlusthon/proto/enums_pb2.py +46 -0
  199. pysplusthon-0.5.0/PySPlusthon/proto/enums_pb2.pyi +99 -0
  200. pysplusthon-0.5.0/PySPlusthon/proto/enums_pb2_grpc.py +24 -0
  201. pysplusthon-0.5.0/PySPlusthon/proto/requests/__init__.py +209 -0
  202. pysplusthon-0.5.0/PySPlusthon/proto/requests/abacus_pb2.py +40 -0
  203. pysplusthon-0.5.0/PySPlusthon/proto/requests/abacus_pb2.pyi +31 -0
  204. pysplusthon-0.5.0/PySPlusthon/proto/requests/abacus_pb2_grpc.py +24 -0
  205. pysplusthon-0.5.0/PySPlusthon/proto/requests/auth_pb2.py +49 -0
  206. pysplusthon-0.5.0/PySPlusthon/proto/requests/auth_pb2.pyi +67 -0
  207. pysplusthon-0.5.0/PySPlusthon/proto/requests/auth_pb2_grpc.py +24 -0
  208. pysplusthon-0.5.0/PySPlusthon/proto/requests/configs_pb2.py +37 -0
  209. pysplusthon-0.5.0/PySPlusthon/proto/requests/configs_pb2.pyi +15 -0
  210. pysplusthon-0.5.0/PySPlusthon/proto/requests/configs_pb2_grpc.py +24 -0
  211. pysplusthon-0.5.0/PySPlusthon/proto/requests/files_pb2.py +40 -0
  212. pysplusthon-0.5.0/PySPlusthon/proto/requests/files_pb2.pyi +34 -0
  213. pysplusthon-0.5.0/PySPlusthon/proto/requests/files_pb2_grpc.py +24 -0
  214. pysplusthon-0.5.0/PySPlusthon/proto/requests/groups_pb2.py +82 -0
  215. pysplusthon-0.5.0/PySPlusthon/proto/requests/groups_pb2.pyi +213 -0
  216. pysplusthon-0.5.0/PySPlusthon/proto/requests/groups_pb2_grpc.py +24 -0
  217. pysplusthon-0.5.0/PySPlusthon/proto/requests/messaging_pb2.py +56 -0
  218. pysplusthon-0.5.0/PySPlusthon/proto/requests/messaging_pb2.pyi +119 -0
  219. pysplusthon-0.5.0/PySPlusthon/proto/requests/messaging_pb2_grpc.py +24 -0
  220. pysplusthon-0.5.0/PySPlusthon/proto/requests/presence_pb2.py +40 -0
  221. pysplusthon-0.5.0/PySPlusthon/proto/requests/presence_pb2.pyi +24 -0
  222. pysplusthon-0.5.0/PySPlusthon/proto/requests/presence_pb2_grpc.py +24 -0
  223. pysplusthon-0.5.0/PySPlusthon/proto/requests/request_pb2.py +42 -0
  224. pysplusthon-0.5.0/PySPlusthon/proto/requests/request_pb2.pyi +35 -0
  225. pysplusthon-0.5.0/PySPlusthon/proto/requests/request_pb2_grpc.py +24 -0
  226. pysplusthon-0.5.0/PySPlusthon/proto/requests/users_pb2.py +43 -0
  227. pysplusthon-0.5.0/PySPlusthon/proto/requests/users_pb2.pyi +34 -0
  228. pysplusthon-0.5.0/PySPlusthon/proto/requests/users_pb2_grpc.py +24 -0
  229. pysplusthon-0.5.0/PySPlusthon/proto/responses/__init__.py +6 -0
  230. pysplusthon-0.5.0/PySPlusthon/proto/responses/abacus_pb2.py +37 -0
  231. pysplusthon-0.5.0/PySPlusthon/proto/responses/abacus_pb2.pyi +14 -0
  232. pysplusthon-0.5.0/PySPlusthon/proto/responses/abacus_pb2_grpc.py +24 -0
  233. pysplusthon-0.5.0/PySPlusthon/proto/responses/auth_pb2.py +42 -0
  234. pysplusthon-0.5.0/PySPlusthon/proto/responses/auth_pb2.pyi +40 -0
  235. pysplusthon-0.5.0/PySPlusthon/proto/responses/auth_pb2_grpc.py +24 -0
  236. pysplusthon-0.5.0/PySPlusthon/proto/responses/files_pb2.py +39 -0
  237. pysplusthon-0.5.0/PySPlusthon/proto/responses/files_pb2.pyi +27 -0
  238. pysplusthon-0.5.0/PySPlusthon/proto/responses/files_pb2_grpc.py +24 -0
  239. pysplusthon-0.5.0/PySPlusthon/proto/responses/groups_pb2.py +59 -0
  240. pysplusthon-0.5.0/PySPlusthon/proto/responses/groups_pb2.pyi +90 -0
  241. pysplusthon-0.5.0/PySPlusthon/proto/responses/groups_pb2_grpc.py +24 -0
  242. pysplusthon-0.5.0/PySPlusthon/proto/responses/messaging_pb2.py +44 -0
  243. pysplusthon-0.5.0/PySPlusthon/proto/responses/messaging_pb2.pyi +37 -0
  244. pysplusthon-0.5.0/PySPlusthon/proto/responses/messaging_pb2_grpc.py +24 -0
  245. pysplusthon-0.5.0/PySPlusthon/proto/responses/users_pb2.py +41 -0
  246. pysplusthon-0.5.0/PySPlusthon/proto/responses/users_pb2.pyi +28 -0
  247. pysplusthon-0.5.0/PySPlusthon/proto/responses/users_pb2_grpc.py +24 -0
  248. pysplusthon-0.5.0/PySPlusthon/proto/structs/__init__.py +7 -0
  249. pysplusthon-0.5.0/PySPlusthon/proto/structs/collections_pb2.py +54 -0
  250. pysplusthon-0.5.0/PySPlusthon/proto/structs/collections_pb2.pyi +79 -0
  251. pysplusthon-0.5.0/PySPlusthon/proto/structs/collections_pb2_grpc.py +24 -0
  252. pysplusthon-0.5.0/PySPlusthon/proto/structs/files_pb2.py +52 -0
  253. pysplusthon-0.5.0/PySPlusthon/proto/structs/files_pb2.pyi +93 -0
  254. pysplusthon-0.5.0/PySPlusthon/proto/structs/files_pb2_grpc.py +24 -0
  255. pysplusthon-0.5.0/PySPlusthon/proto/structs/groups_pb2.py +49 -0
  256. pysplusthon-0.5.0/PySPlusthon/proto/structs/groups_pb2.pyi +144 -0
  257. pysplusthon-0.5.0/PySPlusthon/proto/structs/groups_pb2_grpc.py +24 -0
  258. pysplusthon-0.5.0/PySPlusthon/proto/structs/messaging_pb2.py +81 -0
  259. pysplusthon-0.5.0/PySPlusthon/proto/structs/messaging_pb2.pyi +296 -0
  260. pysplusthon-0.5.0/PySPlusthon/proto/structs/messaging_pb2_grpc.py +24 -0
  261. pysplusthon-0.5.0/PySPlusthon/proto/structs/peers_pb2.py +47 -0
  262. pysplusthon-0.5.0/PySPlusthon/proto/structs/peers_pb2.pyi +56 -0
  263. pysplusthon-0.5.0/PySPlusthon/proto/structs/peers_pb2_grpc.py +24 -0
  264. pysplusthon-0.5.0/PySPlusthon/proto/structs/set_updates_pb2.py +37 -0
  265. pysplusthon-0.5.0/PySPlusthon/proto/structs/set_updates_pb2.pyi +15 -0
  266. pysplusthon-0.5.0/PySPlusthon/proto/structs/set_updates_pb2_grpc.py +24 -0
  267. pysplusthon-0.5.0/PySPlusthon/proto/structs/users_pb2.py +54 -0
  268. pysplusthon-0.5.0/PySPlusthon/proto/structs/users_pb2.pyi +122 -0
  269. pysplusthon-0.5.0/PySPlusthon/proto/structs/users_pb2_grpc.py +24 -0
  270. pysplusthon-0.5.0/PySPlusthon/proto/updates/__init__.py +1 -0
  271. pysplusthon-0.5.0/PySPlusthon/proto/updates/messaging_pb2.py +38 -0
  272. pysplusthon-0.5.0/PySPlusthon/proto/updates/messaging_pb2.pyi +26 -0
  273. pysplusthon-0.5.0/PySPlusthon/proto/updates/messaging_pb2_grpc.py +24 -0
  274. pysplusthon-0.5.0/PySPlusthon/proto/ws_pb2.py +52 -0
  275. pysplusthon-0.5.0/PySPlusthon/proto/ws_pb2.pyi +76 -0
  276. pysplusthon-0.5.0/PySPlusthon/proto/ws_pb2_grpc.py +24 -0
  277. pysplusthon-0.5.0/PySPlusthon/smart_call.py +73 -0
  278. pysplusthon-0.5.0/PySPlusthon/states/__init__.py +3 -0
  279. pysplusthon-0.5.0/PySPlusthon/states/state.py +11 -0
  280. pysplusthon-0.5.0/PySPlusthon/states/state_group.py +13 -0
  281. pysplusthon-0.5.0/PySPlusthon/states/state_machine.py +83 -0
  282. pysplusthon-0.5.0/PySPlusthon/sync_support.py +48 -0
  283. pysplusthon-0.5.0/PySPlusthon.egg-info/PKG-INFO +65 -0
  284. pysplusthon-0.5.0/PySPlusthon.egg-info/SOURCES.txt +289 -0
  285. pysplusthon-0.5.0/PySPlusthon.egg-info/dependency_links.txt +1 -0
  286. pysplusthon-0.5.0/PySPlusthon.egg-info/requires.txt +2 -0
  287. pysplusthon-0.5.0/PySPlusthon.egg-info/top_level.txt +1 -0
  288. pysplusthon-0.5.0/README.md +48 -0
  289. pysplusthon-0.5.0/pyproject.toml +30 -0
  290. pysplusthon-0.5.0/setup.cfg +4 -0
  291. pysplusthon-0.5.0/tests/test_bot.py +57 -0
@@ -0,0 +1,19 @@
1
+ Copyright (c) 2026 Mohammad Saleh Peyravi
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining a copy
4
+ of this software and associated documentation files (the "Software"), to deal
5
+ in the Software without restriction, including without limitation the rights
6
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
7
+ copies of the Software, and to permit persons to whom the Software is
8
+ furnished to do so, subject to the following conditions:
9
+
10
+ The above copyright notice and this permission notice shall be included in all
11
+ copies or substantial portions of the Software.
12
+
13
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
14
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
15
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
16
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
17
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
18
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
19
+ SOFTWARE.
@@ -0,0 +1,65 @@
1
+ Metadata-Version: 2.4
2
+ Name: PySPlusthon
3
+ Version: 0.5.0
4
+ Summary: a Python library for Soroush Plus Bot API
5
+ Author-email: Mohammad Saleh Peyravi <akhbari87@gmail.com>
6
+ License-Expression: MIT
7
+ Project-URL: Homepage, https://github.com/Msp-92/PySPlusthon
8
+ Project-URL: SPlus News Channel, https://splus.ir/PySPlusthon
9
+ Project-URL: PySPlusthon Developers Group, https://splus.ir/PySPlusthonDevelopers
10
+ Keywords: splus,messenger,bot,api,client
11
+ Requires-Python: >=3.10
12
+ Description-Content-Type: text/markdown
13
+ License-File: LICENSE
14
+ Requires-Dist: httpx==0.28.1
15
+ Requires-Dist: grpcio-tools==1.80.0
16
+ Dynamic: license-file
17
+
18
+ <p align="center">
19
+ <img src="assets/PySPlusthon.png" alt="PySPlusthon" width="200">
20
+ </p>
21
+
22
+ # PySPlusthon
23
+ A Python library for interacting with the Soroush Plus Bot API (Splus).
24
+
25
+ ## Quick Start
26
+ ```python
27
+
28
+ from PySPlusthon import Client
29
+
30
+ bot = Client("YOUR_BOT_TOKEN")
31
+
32
+ @bot.on_message()
33
+ async def on_message(message):
34
+ print(f"Received: {message.text}")
35
+
36
+ if __name__ == "__main__":
37
+ bot.run()
38
+ ```
39
+
40
+ ## Key Features
41
+
42
+ - **Full Bot API Support**: Send messages, photos, videos, documents, audio, voice, stickers, locations, contacts, and more
43
+ - **Update Handling**: Polling and webhook support with `start_polling()` and `set_webhook()`
44
+ - **Conditional Handlers**: Message filters using conditions (`text`, `command`, `document`, `photo`, `video`, `voice`, and more)
45
+ - **Event Handlers**: Connect, disconnect, initialize, shutdown, edited messages, callback queries, errors, and custom events
46
+ - **Object Model**: Comprehensive `Object` base class with `wrap()`/`unwrap()` for API response parsing
47
+ - **Inline Keyboards & Keyboards**: `InlineKeyboard` and `ReplyKeyboard` with button formatting
48
+ - **Media Groups**: Send photo/video/audio groups
49
+ - **Referral Links**: Create referral links with `create_referral_link()`
50
+ - **User/Chat Methods**: `get_me()`, `get_chat()`, `get_chat_member()`, `get_chat_members_count()`, and more
51
+ - **Inline Inline Buttons & Keyboards**: Full reply markup support
52
+ - **Protobuf & Userbot Support**: Optional userbot mode with WebSocket integration
53
+ - **Error Handling**: Custom RPC error types (`BadRequestError`, `FloodError`, `ForbiddenError`, `NotFoundError`, `UnauthorizedError`, `InternalError`, `TooManyRequestsError`)
54
+
55
+ ## Installing
56
+
57
+ ```bash
58
+ pip install PySPlusthon
59
+ ```
60
+
61
+ ## Links
62
+ - [**PyPI**](https://pypi.org/project/PySPlusthon/)
63
+ - [**GitHub**](https://github.com/Msp-92/PySPlusthon)
64
+ - [**Splus News Channel**](https://splus.ir/PySPlusthon)
65
+ - [**PySPlusthon Developers Group**](https://splus.ir/PySPlusthonDevelopers)
@@ -0,0 +1,3 @@
1
+ __version__ = "1.0.0"
2
+
3
+ from .client import Client
@@ -0,0 +1 @@
1
+ from .client import Client
@@ -0,0 +1,29 @@
1
+ from .send_photo import SendPhoto
2
+ from .send_animation import SendAnimation
3
+ from .send_audio import SendAudio
4
+ from .send_document import SendDocument
5
+ from .send_sticker import SendSticker
6
+ from .send_video import SendVideo
7
+ from .send_voice import SendVoice
8
+ from .send_location import SendLocation
9
+ from .send_contact import SendContact
10
+ from .send_media_group import SendMediaGroup
11
+ from .get_file import GetFile
12
+ from .upload_file import UploadFile
13
+
14
+
15
+ class Attachments(
16
+ SendPhoto,
17
+ SendAnimation,
18
+ SendAudio,
19
+ SendDocument,
20
+ SendVideo,
21
+ SendVoice,
22
+ SendSticker,
23
+ SendLocation,
24
+ SendContact,
25
+ SendMediaGroup,
26
+ GetFile,
27
+ UploadFile
28
+ ):
29
+ pass
@@ -0,0 +1,22 @@
1
+ import PySPlusthon
2
+ from ...objects import File
3
+
4
+
5
+ class GetFile:
6
+
7
+ async def get_file(
8
+ self: "PySPlusthon.Client",
9
+ file_id: str
10
+ ) -> File:
11
+ if self.is_userbot():
12
+ from ...proto import requests, structs
13
+ access_hash, file_id, file_storage_version = map(int, file_id.split(":"))
14
+ return await self.execute(requests.GetNasimFileUrl(
15
+ file=structs.FileLocation(
16
+ file_id=file_id,
17
+ access_hash=access_hash,
18
+ file_storage_version=structs.Int32Value(value=file_storage_version)
19
+ )
20
+ ))
21
+
22
+ return await self.auto_execute("getFile", locals())
@@ -0,0 +1,71 @@
1
+ from typing import Union, BinaryIO, Optional
2
+ import os
3
+
4
+ import PySPlusthon
5
+ from ...objects import InputMedia, resolve_media, Message, ReplyMarkup
6
+
7
+
8
+ def _extract_filename_media(media) -> Optional[str]:
9
+ if isinstance(media, InputMedia):
10
+ return getattr(media.media, 'name', None) if hasattr(media.media, 'name') else None
11
+ if isinstance(media, str):
12
+ return os.path.basename(media)
13
+ return None
14
+
15
+
16
+ class SendAnimation:
17
+
18
+ async def send_animation(
19
+ self: "PySPlusthon.Client",
20
+ chat_id: Union[int, str],
21
+ animation: Union[str, bytes, BinaryIO, InputMedia],
22
+ duration: int = None,
23
+ width: int = None,
24
+ height: int = None,
25
+ caption: str = None,
26
+ reply_markup: ReplyMarkup = None,
27
+ reply_to_message_id: int = None
28
+ ) -> Message:
29
+ animation = resolve_media(animation)
30
+ filename = _extract_filename_media(animation)
31
+
32
+ if self.is_userbot():
33
+ from ...proto import requests, structs, enums
34
+ peer_id, peer_type = map(int, chat_id.split("|"))
35
+ file = await self.upload_file(chat_id, animation, enums.SEND_TYPE_GIF)
36
+ return await self.execute(requests.SendMessage(
37
+ peer=structs.Peer(
38
+ type=peer_type,
39
+ id=peer_id
40
+ ),
41
+ rid=self.ws_connection.create_rid(),
42
+ message=structs.Message(
43
+ document_message=structs.DocumentMessage(
44
+ file_id=file.id,
45
+ access_hash=peer_id,
46
+ file_size=file.size,
47
+ name=file.name,
48
+ mime_type=file.mime_type,
49
+ ext=structs.DocumentEx(
50
+ document_ex_gif=structs.DocumentExGif(
51
+ w=100,
52
+ h=100,
53
+ duration=10
54
+ )
55
+ ),
56
+ caption=structs.TextMessage(text=caption)
57
+ )
58
+ ),
59
+ ex_peer=structs.Peer(
60
+ type=peer_type,
61
+ id=peer_id
62
+ )
63
+ ))
64
+
65
+ chat_id = await self.resolve_peer_id(chat_id)
66
+ params = {"chat_id": chat_id, "animation": animation, "duration": duration, "width": width, "height": height}
67
+ if caption is not None:
68
+ params["caption"] = caption
69
+ if filename is not None:
70
+ params["filename"] = filename
71
+ return await self.auto_execute("sendAnimation", params, json=False)
@@ -0,0 +1,54 @@
1
+ from typing import Union, BinaryIO
2
+
3
+ import PySPlusthon
4
+ from ...objects import InputMedia, resolve_media, Message, ReplyMarkup
5
+
6
+
7
+ class SendAudio:
8
+
9
+ async def send_audio(
10
+ self: "PySPlusthon.Client",
11
+ chat_id: Union[int, str],
12
+ audio: Union[str, bytes, BinaryIO, InputMedia],
13
+ caption: str = None,
14
+ duration: int = None,
15
+ title: str = None,
16
+ reply_markup: ReplyMarkup = None,
17
+ reply_to_message_id: int = None
18
+ ) -> Message:
19
+ audio = resolve_media(audio)
20
+
21
+ if self.is_userbot():
22
+ from ...proto import requests, structs, enums
23
+ peer_id, peer_type = map(int, chat_id.split("|"))
24
+ file = await self.upload_file(chat_id, audio, enums.SEND_TYPE_AUDIO)
25
+ return await self.execute(requests.SendMessage(
26
+ peer=structs.Peer(
27
+ type=peer_type,
28
+ id=peer_id
29
+ ),
30
+ rid=self.ws_connection.create_rid(),
31
+ message=structs.Message(
32
+ document_message=structs.DocumentMessage(
33
+ file_id=file.id,
34
+ access_hash=peer_id,
35
+ file_size=file.size,
36
+ name=file.name,
37
+ mime_type=file.mime_type,
38
+ ext=structs.DocumentEx(
39
+ document_ex_audio=structs.DocumentExAudio(
40
+ duration=duration,
41
+ track=title or file.name
42
+ )
43
+ ),
44
+ caption=structs.TextMessage(text=caption)
45
+ )
46
+ ),
47
+ ex_peer=structs.Peer(
48
+ type=peer_type,
49
+ id=peer_id
50
+ )
51
+ ))
52
+
53
+ chat_id = await self.resolve_peer_id(chat_id)
54
+ return await self.auto_execute("sendAudio", locals())
@@ -0,0 +1,47 @@
1
+ from typing import Union
2
+ from json import dumps
3
+
4
+ import PySPlusthon
5
+ from ...objects import Message, ReplyMarkup
6
+
7
+
8
+ class SendContact:
9
+
10
+ async def send_contact(
11
+ self: "PySPlusthon.Client",
12
+ chat_id: Union[int, str],
13
+ phone_number: str,
14
+ first_name: str,
15
+ last_name: str = None,
16
+ vcard : bytes = None,
17
+ reply_markup: ReplyMarkup = None,
18
+ reply_to_message_id: int = None
19
+ ) -> Message:
20
+ if self.is_userbot():
21
+ from PySPlusthon.proto import requests, structs
22
+ peer_id, peer_type = map(int, chat_id.split("|"))
23
+ raw_json = {
24
+ "dataType": "contact",
25
+ "data": {
26
+ "contact": {"name": first_name, "emails": [""], "phones": [phone_number]},
27
+ }
28
+ }
29
+ return await self.execute(requests.SendMessage(
30
+ peer=structs.Peer(
31
+ type=peer_type,
32
+ id=peer_id
33
+ ),
34
+ rid=self.ws_connection.create_rid(),
35
+ message=structs.Message(
36
+ json_message=structs.JsonMessage(
37
+ raw_json=dumps(raw_json)
38
+ )
39
+ ),
40
+ ex_peer=structs.Peer(
41
+ type=peer_type,
42
+ id=peer_id
43
+ )
44
+ ))
45
+
46
+ chat_id = await self.resolve_peer_id(chat_id)
47
+ return await self.auto_execute("sendContact", locals())
@@ -0,0 +1,63 @@
1
+ from typing import Union, BinaryIO, Optional
2
+ import os
3
+
4
+ import PySPlusthon
5
+ from ...objects import InputMedia, resolve_media, Message, ReplyMarkup
6
+
7
+
8
+ def _extract_filename(document) -> Optional[str]:
9
+ if isinstance(document, InputMedia):
10
+ return getattr(document.media, 'name', None) if hasattr(document.media, 'name') else None
11
+ if isinstance(document, str):
12
+ return os.path.basename(document)
13
+ if document is not None:
14
+ return getattr(document, 'name', None)
15
+ return None
16
+
17
+
18
+ class SendDocument:
19
+
20
+ async def send_document(
21
+ self: "PySPlusthon.Client",
22
+ chat_id: Union[int, str],
23
+ document: Union[str, bytes, BinaryIO, InputMedia],
24
+ caption: str = None,
25
+ reply_markup: ReplyMarkup = None,
26
+ reply_to_message_id: int = None
27
+ ) -> Message:
28
+ document = resolve_media(document)
29
+ filename = _extract_filename(document)
30
+
31
+ if self.is_userbot():
32
+ from ...proto import requests, structs, enums
33
+ peer_id, peer_type = map(int, chat_id.split("|"))
34
+ file = await self.upload_file(chat_id, document, enums.SEND_TYPE_DOCUMENT)
35
+ return await self.execute(requests.SendMessage(
36
+ peer=structs.Peer(
37
+ type=peer_type,
38
+ id=peer_id
39
+ ),
40
+ rid=self.ws_connection.create_rid(),
41
+ message=structs.Message(
42
+ document_message=structs.DocumentMessage(
43
+ file_id=file.id,
44
+ access_hash=peer_id,
45
+ file_size=file.size,
46
+ name=file.name,
47
+ mime_type=file.mime_type,
48
+ caption=structs.TextMessage(text=caption)
49
+ )
50
+ ),
51
+ ex_peer=structs.Peer(
52
+ type=peer_type,
53
+ id=peer_id
54
+ )
55
+ ))
56
+
57
+ chat_id = await self.resolve_peer_id(chat_id)
58
+ params = {"chat_id": chat_id, "document": document}
59
+ if caption is not None:
60
+ params["caption"] = caption
61
+ if filename is not None:
62
+ params["filename"] = filename
63
+ return await self.auto_execute("sendDocument", params)
@@ -0,0 +1,45 @@
1
+ from typing import Union
2
+ from json import dumps
3
+
4
+ import PySPlusthon
5
+ from ...objects import Message, ReplyMarkup
6
+
7
+
8
+ class SendLocation:
9
+
10
+ async def send_location(
11
+ self: "PySPlusthon.Client",
12
+ chat_id: Union[int, str],
13
+ latitude: float,
14
+ longitude: float,
15
+ reply_markup: ReplyMarkup = None,
16
+ reply_to_message_id: int = None
17
+ ) -> Message:
18
+ if self.is_userbot():
19
+ from PySPlusthon.proto import requests, structs
20
+ peer_id, peer_type = map(int, chat_id.split("|"))
21
+ raw_json = {
22
+ "dataType": "location",
23
+ "data": {
24
+ "location": {"latitude": latitude, "longitude": longitude}
25
+ }
26
+ }
27
+ return await self.execute(requests.SendMessage(
28
+ peer=structs.Peer(
29
+ type=peer_type,
30
+ id=peer_id
31
+ ),
32
+ rid=self.ws_connection.create_rid(),
33
+ message=structs.Message(
34
+ json_message=structs.JsonMessage(
35
+ raw_json=dumps(raw_json)
36
+ )
37
+ ),
38
+ ex_peer=structs.Peer(
39
+ type=peer_type,
40
+ id=peer_id
41
+ )
42
+ ))
43
+
44
+ chat_id = await self.resolve_peer_id(chat_id)
45
+ return await self.auto_execute("sendLocation", locals())
@@ -0,0 +1,88 @@
1
+ from typing import Union
2
+ from json import dumps
3
+ from typing import List
4
+
5
+ import PySPlusthon
6
+ from ...objects import Message, ReplyMarkup, InputMediaPhoto, InputMediaVideo
7
+ from PySPlusthon import objects
8
+
9
+
10
+ class SendMediaGroup:
11
+
12
+ async def send_media_group(
13
+ self: "PySPlusthon.Client",
14
+ chat_id: Union[int, str],
15
+ media: List["objects.InputMedia"],
16
+ reply_markup: ReplyMarkup = None,
17
+ reply_to_message_id: int = None
18
+ ) -> List[Message]:
19
+ if self.is_userbot():
20
+ from ...proto import requests, structs, enums
21
+ peer_id, peer_type = map(int, chat_id.split("|"))
22
+ files = []
23
+ for content in media:
24
+ if isinstance(content, InputMediaPhoto):
25
+ send_type = enums.SEND_TYPE_PHOTO
26
+ elif isinstance(content, InputMediaVideo):
27
+ send_type = enums.SEND_TYPE_VIDEO
28
+ else:
29
+ send_type = enums.SEND_TYPE_DOCUMENT
30
+ file = await self.upload_file(f"{peer_id}|{peer_type}", content.media, send_type)
31
+
32
+ if send_type == enums.SEND_TYPE_PHOTO:
33
+ ext = structs.DocumentEx(
34
+ document_ex_photo=structs.DocumentExPhoto(
35
+ w=500,
36
+ h=500
37
+ )
38
+ )
39
+ else:
40
+ ext = structs.DocumentEx(
41
+ document_ex_video=structs.DocumentExVideo(
42
+ w=500,
43
+ h=500,
44
+ duration=10
45
+ )
46
+ )
47
+
48
+ single_media = structs.SingleMedia(
49
+ random_id=self.ws_connection.create_rid(),
50
+ media=structs.DocumentMessage(
51
+ file_id=file.id,
52
+ access_hash=peer_id,
53
+ file_size=file.size,
54
+ name=file.name,
55
+ mime_type=file.mime_type,
56
+ ext=ext,
57
+ caption=structs.TextMessage(text=content.caption)
58
+ )
59
+ )
60
+ files.append(single_media)
61
+
62
+ return await self.execute(requests.SendMultiMediaMessage(
63
+ peer=structs.ExPeer(
64
+ type=peer_type,
65
+ id=peer_id,
66
+ ),
67
+ multi_media=files,
68
+ grouped_id=self.ws_connection.create_rid(),
69
+ ))
70
+
71
+ chat_id = await self.resolve_peer_id(chat_id)
72
+ data = locals()
73
+ del data["self"]
74
+ if any(not m.is_json_serializable for m in data["media"]):
75
+ for i, m in enumerate(data["media"]):
76
+ data["media"][i] = m.unwrap()
77
+ if not m.is_json_serializable:
78
+ data[f"media{i}"] = m.media
79
+ data["media"][i]["media"] = f"media{i}"
80
+ data["media"] = dumps(data["media"])
81
+ else:
82
+ for i, m in enumerate(data["media"]):
83
+ data["media"][i] = m.unwrap()
84
+ result = await self.execute("sendMediaGroup", **data)
85
+ result = [Message.wrap(message) for message in result]
86
+ for message in result:
87
+ message.bind(self)
88
+ return result
@@ -0,0 +1,67 @@
1
+ from typing import Union, BinaryIO, Optional
2
+ import os
3
+
4
+ import PySPlusthon
5
+ from ...objects import InputMedia, resolve_media, Message, ReplyMarkup
6
+
7
+
8
+ def _extract_filename_media(media) -> Optional[str]:
9
+ if isinstance(media, InputMedia):
10
+ return getattr(media.media, 'name', None) if hasattr(media.media, 'name') else None
11
+ if isinstance(media, str):
12
+ return os.path.basename(media)
13
+ return None
14
+
15
+
16
+ class SendPhoto:
17
+
18
+ async def send_photo(
19
+ self: "PySPlusthon.Client",
20
+ chat_id: Union[int, str],
21
+ photo: Union[str, bytes, BinaryIO, InputMedia],
22
+ caption: str = None,
23
+ reply_markup: ReplyMarkup = None,
24
+ reply_to_message_id: int = None
25
+ ) -> Message:
26
+ photo = resolve_media(photo)
27
+ filename = _extract_filename_media(photo)
28
+
29
+ if self.is_userbot():
30
+ from ...proto import requests, structs, enums
31
+ peer_id, peer_type = map(int, chat_id.split("|"))
32
+ file = await self.upload_file(chat_id, photo, enums.SEND_TYPE_PHOTO)
33
+ return await self.execute(requests.SendMessage(
34
+ peer=structs.Peer(
35
+ type=peer_type,
36
+ id=peer_id
37
+ ),
38
+ rid=self.ws_connection.create_rid(),
39
+ message=structs.Message(
40
+ document_message=structs.DocumentMessage(
41
+ file_id=file.id,
42
+ access_hash=peer_id,
43
+ file_size=file.size,
44
+ name=file.name,
45
+ mime_type=file.mime_type,
46
+ ext=structs.DocumentEx(
47
+ document_ex_photo=structs.DocumentExPhoto(
48
+ w=100,
49
+ h=100
50
+ )
51
+ ),
52
+ caption=structs.TextMessage(text=caption)
53
+ )
54
+ ),
55
+ ex_peer=structs.Peer(
56
+ type=peer_type,
57
+ id=peer_id
58
+ )
59
+ ))
60
+
61
+ chat_id = await self.resolve_peer_id(chat_id)
62
+ params = {"chat_id": chat_id, "photo": photo}
63
+ if caption is not None:
64
+ params["caption"] = caption
65
+ if filename is not None:
66
+ params["filename"] = filename
67
+ return await self.auto_execute("sendPhoto", params)
@@ -0,0 +1,51 @@
1
+ from typing import Union, BinaryIO
2
+
3
+ import PySPlusthon
4
+ from ...objects import InputMedia, resolve_media, Message, ReplyMarkup
5
+
6
+
7
+ class SendSticker:
8
+
9
+ async def send_sticker(
10
+ self: "PySPlusthon.Client",
11
+ chat_id: Union[int, str],
12
+ sticker: Union[str, bytes, BinaryIO, InputMedia],
13
+ reply_markup: ReplyMarkup = None,
14
+ reply_to_message_id: int = None
15
+ ) -> Message:
16
+ if self.is_userbot():
17
+ from ...proto import requests, structs
18
+ peer_id, peer_type = map(int, chat_id.split("|"))
19
+ file_id, access_hash, file_storage_version, sticker_id, collection_id = map(int, sticker.split(":"))
20
+ return await self.execute(requests.SendMessage(
21
+ peer=structs.Peer(
22
+ type=peer_type,
23
+ id=peer_id
24
+ ),
25
+ rid=self.ws_connection.create_rid(),
26
+ message=structs.Message(
27
+ sticker_message=structs.StickerMessage(
28
+ sticker_id=structs.Int32Value(
29
+ value=sticker_id,
30
+ ),
31
+ image512=structs.ImageLocation(
32
+ file_location=structs.FileLocation(
33
+ file_id=file_id,
34
+ access_hash=access_hash,
35
+ file_storage_version=structs.Int32Value(value=file_storage_version)
36
+ )
37
+ ),
38
+ sticker_collection_id=structs.Int32Value(
39
+ value=collection_id
40
+ )
41
+ ),
42
+ ),
43
+ ex_peer=structs.Peer(
44
+ type=peer_type,
45
+ id=peer_id
46
+ )
47
+ ))
48
+
49
+ chat_id = await self.resolve_peer_id(chat_id)
50
+ sticker = resolve_media(sticker)
51
+ return await self.auto_execute("sendSticker", locals())