182
182
183
183
184
184
class GoCode :
185
+ @staticmethod
185
186
def execute_sync_function (
186
- self , func : Callable [SyncFunctionParams , ReturnType ]
187
+ func : Callable [SyncFunctionParams , ReturnType ],
187
188
) -> Callable [SyncFunctionParams , Awaitable [ReturnType ]]:
188
189
def call (
189
190
* args : SyncFunctionParams .args , ** kwargs : SyncFunctionParams .kwargs
@@ -2672,13 +2673,12 @@ async def send_fb_message(
2672
2673
len (extra_buff ),
2673
2674
)
2674
2675
return SendResponse .FromString (response .get_bytes ())
2676
+
2675
2677
async def send_presence (self , presence : Presence ):
2676
- response = await self .__client .SendPresence (
2677
- self .uuid ,
2678
- presence .value
2679
- )
2680
- if response :
2681
- raise SendPresenceError (response )
2678
+ response = await self .__client .SendPresence (self .uuid , presence .value )
2679
+ if response :
2680
+ raise SendPresenceError (response )
2681
+
2682
2682
async def connect (self ):
2683
2683
"""Establishes a connection to the WhatsApp servers."""
2684
2684
# Convert the list of functions to a bytearray
@@ -2723,8 +2723,6 @@ def disconnect(self) -> None:
2723
2723
self .__client .Disconnect (self .uuid )
2724
2724
2725
2725
2726
-
2727
-
2728
2726
class ClientFactory :
2729
2727
def __init__ (self , database_name : str = "neonize.db" ) -> None :
2730
2728
"""
@@ -2753,7 +2751,12 @@ def get_all_devices_from_db(db: str) -> List[Device]:
2753
2751
id , server = id .split ("@" )
2754
2752
jid = build_jid (id , server )
2755
2753
2756
- device = Device (JID = jid , PushName = push_name , BussinessName = bussniess_name , Initialized = initialized == "true" )
2754
+ device = Device (
2755
+ JID = jid ,
2756
+ PushName = push_name ,
2757
+ BussinessName = bussniess_name ,
2758
+ Initialized = initialized == "true" ,
2759
+ )
2757
2760
devices .append (device )
2758
2761
2759
2762
return devices
@@ -2763,7 +2766,10 @@ def get_all_devices(self) -> List["Device"]:
2763
2766
return self .get_all_devices_from_db (self .database_name )
2764
2767
2765
2768
def new_client (
2766
- self , jid : Optional [JID ] = None , uuid : Optional [str ] = None , props : Optional [DeviceProps ] = None
2769
+ self ,
2770
+ jid : Optional [JID ] = None ,
2771
+ uuid : Optional [str ] = None ,
2772
+ props : Optional [DeviceProps ] = None ,
2767
2773
) -> NewAClient :
2768
2774
"""
2769
2775
This function creates a new instance of the client. If the jid parameter is not provided, a new client will be created.
@@ -2787,4 +2793,4 @@ def new_client(
2787
2793
return client
2788
2794
2789
2795
async def run (self ):
2790
- return await asyncio .gather (* [client .connect () for client in self .clients ])
2796
+ return await asyncio .gather (* [client .connect () for client in self .clients ])
0 commit comments