pyrobale 0.2.8.1__py3-none-any.whl → 0.2.8.3__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.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pyrobale
3
- Version: 0.2.8.1
3
+ Version: 0.2.8.3
4
4
  Summary: A python wrapper for bale api
5
5
  Project-URL: github, https://github.com/pyrobale/pyrobale
6
6
  Project-URL: website, https://pyrobale.github.io
@@ -0,0 +1,5 @@
1
+ pyrobale.py,sha256=EaJ172999Zft7HOuMNJPsho6YJFFo242SZuY2B9peX4,89775
2
+ pyrobale-0.2.8.3.dist-info/METADATA,sha256=wqOaghx0itJIOM79hvRZzGyuAHKqjZpT57dxLJ88t64,43670
3
+ pyrobale-0.2.8.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
4
+ pyrobale-0.2.8.3.dist-info/licenses/LICENSE,sha256=XQsvifC5HE85232_XgRHpeQ35MfeL2YcpU4yPiAgmW4,35269
5
+ pyrobale-0.2.8.3.dist-info/RECORD,,
pyrobale.py CHANGED
@@ -8,26 +8,19 @@ Features:
8
8
  - New and Up to date
9
9
  - Internal database management
10
10
  """
11
+ from typing import Optional, Dict, Any, List, Union
12
+ import os
11
13
  import json
12
14
  import time
13
- from typing import Optional, Dict, Any, List, Union
14
15
  import threading
15
16
  import traceback
16
17
  import sqlite3
17
18
  import inspect
18
- import requests
19
19
  import re
20
20
  import sys
21
- import os
22
- from urllib.parse import urlparse, unquote
23
- from io import BytesIO
24
- import mimetypes
25
- from os import PathLike
26
- from pathlib import Path
27
- import uuid
28
- from typing import Iterator
21
+ import requests
29
22
 
30
- __version__ = '0.2.8.1'
23
+ __version__ = '0.2.8.3'
31
24
 
32
25
 
33
26
  class ChatActions:
@@ -743,6 +736,9 @@ class Chat:
743
736
  self.description = result.get('description')
744
737
  self.invite_link = result.get('invite_link')
745
738
  self.photo = result.get('photo')
739
+ self.is_channel_chat = self.CHANNEL = self.type == "channel"
740
+ self.is_group_chat = self.GROUP = self.type == "group"
741
+ self.is_private_chat = self.PRIVATE = self.type == "private"
746
742
 
747
743
  def send_photo(self,
748
744
  photo: Union[str,
@@ -968,7 +964,7 @@ class Chat:
968
964
  """Send a chat action"""
969
965
  return self.client.send_chat_action(self.id, action, how_many_times)
970
966
 
971
- def banChatMember(
967
+ def ban_chat_member(
972
968
  self,
973
969
  user_id: int,
974
970
  until_date: Optional[int] = None) -> bool:
@@ -982,7 +978,7 @@ class Chat:
982
978
  'POST', 'banChatMember', data=data)
983
979
  return response.get('ok', False)
984
980
 
985
- def unbanChatMember(
981
+ def unban_chat_member(
986
982
  self,
987
983
  user_id: int,
988
984
  only_if_banned: bool = False) -> bool:
@@ -996,7 +992,7 @@ class Chat:
996
992
  'POST', 'unbanChatMember', data=data)
997
993
  return response.get('ok', False)
998
994
 
999
- def promoteChatMember(
995
+ def promotee_chat_member(
1000
996
  self,
1001
997
  user_id: int,
1002
998
  can_change_info: bool = None,
@@ -1022,7 +1018,7 @@ class Chat:
1022
1018
  'POST', 'promoteChatMember', data=data)
1023
1019
  return response.get('ok', False)
1024
1020
 
1025
- def setChatPhoto(self, photo: Union[str, bytes, InputFile]) -> bool:
1021
+ def set_chat_photo(self, photo: Union[str, bytes, InputFile]) -> bool:
1026
1022
  """Set a new chat photo"""
1027
1023
  files = None
1028
1024
  data = {'chat_id': self.id}
@@ -1038,26 +1034,26 @@ class Chat:
1038
1034
  'POST', 'setChatPhoto', data=data, files=files)
1039
1035
  return response.get('ok', False)
1040
1036
 
1041
- def leaveChat(self) -> bool:
1037
+ def leave_chat(self) -> bool:
1042
1038
  """Leave the chat"""
1043
1039
  data = {'chat_id': self.id}
1044
1040
  response = self.client._make_request('POST', 'leaveChat', data=data)
1045
1041
  return response.get('ok', False)
1046
1042
 
1047
- def getChat(self) -> 'Chat':
1043
+ def get_chat(self) -> 'Chat':
1048
1044
  """Get up to date information about the chat"""
1049
1045
  data = {'chat_id': self.id}
1050
1046
  response = self.client._make_request('GET', 'getChat', data=data)
1051
1047
  return Chat(self.client, response)
1052
1048
 
1053
- def getChatMembersCount(self) -> int:
1049
+ def get_members_count(self) -> int:
1054
1050
  """Get the number of members in the chat"""
1055
1051
  data = {'chat_id': self.id}
1056
1052
  response = self.client._make_request(
1057
1053
  'POST', 'getChatMembersCount', data=data)
1058
1054
  return response.get('result', 0)
1059
1055
 
1060
- def pinChatMessage(
1056
+ def pin_message(
1061
1057
  self,
1062
1058
  message_id: int,
1063
1059
  disable_notification: bool = False) -> bool:
@@ -1071,7 +1067,7 @@ class Chat:
1071
1067
  'POST', 'pinChatMessage', data=data)
1072
1068
  return response.get('ok', False)
1073
1069
 
1074
- def unPinChatMessage(self, message_id: int) -> bool:
1070
+ def unpin_message(self, message_id: int) -> bool:
1075
1071
  """Unpin a message in the chat"""
1076
1072
  data = {
1077
1073
  'chat_id': self.id,
@@ -1081,14 +1077,14 @@ class Chat:
1081
1077
  'POST', 'unpinChatMessage', data=data)
1082
1078
  return response.get('ok', False)
1083
1079
 
1084
- def unpinAllChatMessages(self) -> bool:
1080
+ def unpin_all_messages(self) -> bool:
1085
1081
  """Unpin all messages in the chat"""
1086
1082
  data = {'chat_id': self.id}
1087
1083
  response = self.client._make_request(
1088
1084
  'POST', 'unpinAllChatMessages', data=data)
1089
1085
  return response.get('ok', False)
1090
1086
 
1091
- def setChatTitle(self, title: str) -> bool:
1087
+ def set_chat_title(self, title: str) -> bool:
1092
1088
  """Change the title of the chat"""
1093
1089
  data = {
1094
1090
  'chat_id': self.id,
@@ -1097,7 +1093,7 @@ class Chat:
1097
1093
  response = self.client._make_request('POST', 'setChatTitle', data=data)
1098
1094
  return response.get('ok', False)
1099
1095
 
1100
- def setChatDescription(self, description: str) -> bool:
1096
+ def set_chat_description(self, description: str) -> bool:
1101
1097
  """Change the description of the chat"""
1102
1098
  data = {
1103
1099
  'chat_id': self.id,
@@ -1107,21 +1103,21 @@ class Chat:
1107
1103
  'POST', 'setChatDescription', data=data)
1108
1104
  return response.get('ok', False)
1109
1105
 
1110
- def deleteChatPhoto(self) -> bool:
1106
+ def delete_chat_photo(self) -> bool:
1111
1107
  """Delete the chat photo"""
1112
1108
  data = {'chat_id': self.id}
1113
1109
  response = self.client._make_request(
1114
1110
  'POST', 'deleteChatPhoto', data=data)
1115
1111
  return response.get('ok', False)
1116
1112
 
1117
- def createChatInviteLink(self) -> str:
1113
+ def create_invite_link(self) -> str:
1118
1114
  """Create an invite link for the chat"""
1119
1115
  data = {'chat_id': self.id}
1120
1116
  response = self.client._make_request(
1121
1117
  'POST', 'createChatInviteLink', data=data)
1122
1118
  return response.get('result', {}).get('invite_link')
1123
1119
 
1124
- def revokeChatInviteLink(self, invite_link: str) -> bool:
1120
+ def revoke_invite_link(self, invite_link: str) -> bool:
1125
1121
  """Revoke an invite link for the chat"""
1126
1122
  data = {
1127
1123
  'chat_id': self.id,
@@ -1131,7 +1127,7 @@ class Chat:
1131
1127
  'POST', 'revokeChatInviteLink', data=data)
1132
1128
  return response.get('ok', False)
1133
1129
 
1134
- def exportChatInviteLink(self) -> str:
1130
+ def export_invite_link(self) -> str:
1135
1131
  """Generate a new invite link for the chat"""
1136
1132
  data = {'chat_id': self.id}
1137
1133
  response = self.client._make_request(
@@ -1670,6 +1666,8 @@ class Client:
1670
1666
  self._member_leave_handler = None
1671
1667
  self._member_join_handler = None
1672
1668
  self._threads = []
1669
+ self._polling = False
1670
+ self.user = User(self, {})
1673
1671
 
1674
1672
  def set_state(self,
1675
1673
  chat_or_user_id: Union[Chat,
@@ -2366,7 +2364,7 @@ class Client:
2366
2364
  def run(self, debug=False):
2367
2365
  """Start p-olling for new messages"""
2368
2366
  try:
2369
- self.user = User(self, {"ok": True, "result": self.get_me()})
2367
+ self.user = self.get_me()
2370
2368
  except BaseException:
2371
2369
  raise BaleTokenNotFoundError("token not found")
2372
2370
 
@@ -2418,9 +2416,7 @@ class Client:
2418
2416
  print(f"Error checking file modification time: {e}")
2419
2417
  return False
2420
2418
 
2421
- def get_updates(self, offset: Optional[int] = None,
2422
- limit: Optional[int] = None,
2423
- timeout: Optional[int] = None) -> List[Dict[str, Any]]:
2419
+ def get_updates(self) -> List[Dict[str, Any]]:
2424
2420
  params = {k: v for k, v in locals().items() if k !=
2425
2421
  'self' and v is not None}
2426
2422
  response = self._make_request('GET', 'getUpdates', params=params)
@@ -1,5 +0,0 @@
1
- pyrobale.py,sha256=3X2xUh7sdHBCZkp-JcXJ6xL0ggW4BdIcDpmhSR09v7A,89846
2
- pyrobale-0.2.8.1.dist-info/METADATA,sha256=np0kt27IkkZVub_7t8_n44e9bKOygIuMNaSV0l0v1co,43670
3
- pyrobale-0.2.8.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
4
- pyrobale-0.2.8.1.dist-info/licenses/LICENSE,sha256=XQsvifC5HE85232_XgRHpeQ35MfeL2YcpU4yPiAgmW4,35269
5
- pyrobale-0.2.8.1.dist-info/RECORD,,