Skip to content
This repository has been archived by the owner on Feb 26, 2024. It is now read-only.

Commit

Permalink
corrige bug quando leva ban
Browse files Browse the repository at this point in the history
  • Loading branch information
JonasCaetanoSz committed Aug 12, 2023
1 parent 9bc96e3 commit 5e12542
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions whatssap.py
Original file line number Diff line number Diff line change
Expand Up @@ -79,9 +79,12 @@ def run(self):
receive_phone_number = self.phones[receive_phone_index]
sender_phone_number = self.phones[self.last_number_sender]


if self.check_block(sender_phone_number):
account_is_blocked = self.check_block(sender_phone_number)
if account_is_blocked == -1:
continue
elif account_is_blocked:
return

# tudo certo enviar a mensagem e aguardar o intervalo escolhido pelo usuário
self.open_chat(phone=receive_phone_number)
self.send_message(message=message)
Expand Down Expand Up @@ -143,7 +146,7 @@ def set_account_block(self, phone:str):

# checar se a conta que esta enviando mensagem foi bloqueada os desconectada

def check_block(self, phone:str) -> bool:
def check_block(self, phone:str) -> bool|int:
with open(file="scripts/check_block.js", mode="r", encoding="utf8") as f:
script = f.read()
self.account_sender.page().runJavaScript(script.replace("@PHONE", phone))
Expand All @@ -165,6 +168,7 @@ def check_block(self, phone:str) -> bool:
self.block = False
self.account_sender = None
self.last_number_sender = None
return -1

return False

Expand Down

0 comments on commit 5e12542

Please # to comment.