mirror of
https://github.com/Steffo99/greed.git
synced 2025-03-13 12:17:27 +00:00
fix cancel payment button
This commit is contained in:
parent
20740661c4
commit
ac21a05bf9
1 changed files with 7 additions and 3 deletions
10
worker.py
10
worker.py
|
@ -231,6 +231,7 @@ class ChatWorker(threading.Thread):
|
|||
response = ""
|
||||
|
||||
def cancel_thread(stop_event):
|
||||
global response
|
||||
while not stop_event.is_set():
|
||||
# Wait for inline keyboard
|
||||
stuff_complete = self.__wait_for_inlinekeyboard_callback()
|
||||
|
@ -241,6 +242,7 @@ class ChatWorker(threading.Thread):
|
|||
break
|
||||
|
||||
def __wait_for_websocket(stop_event):
|
||||
global response
|
||||
result = ws.recv()
|
||||
print("Received '%s'" % result)
|
||||
response = "Received"
|
||||
|
@ -249,6 +251,7 @@ class ChatWorker(threading.Thread):
|
|||
stop_event.set()
|
||||
|
||||
def run_threads():
|
||||
global response
|
||||
# create a thread event
|
||||
a_stop_event = threading.Event()
|
||||
# start the cancel thread
|
||||
|
@ -262,9 +265,10 @@ class ChatWorker(threading.Thread):
|
|||
time.sleep(0.1)
|
||||
print ("At least one thread is done")
|
||||
|
||||
run_threads()
|
||||
ws.close()
|
||||
return response
|
||||
ws.close()
|
||||
return response
|
||||
|
||||
return run_threads()
|
||||
|
||||
def __wait_for_photo(self, cancellable: bool=False) -> typing.Union[typing.List[telegram.PhotoSize], CancelSignal]:
|
||||
"""Continue getting updates until a photo is received, then return it."""
|
||||
|
|
Loading…
Add table
Reference in a new issue