mirror of
https://github.com/Steffo99/greed.git
synced 2025-03-13 12:17:27 +00:00
Connect to websocket before message
This commit is contained in:
parent
bfbf7b0cdf
commit
2dccc11130
1 changed files with 9 additions and 9 deletions
18
worker.py
18
worker.py
|
@ -229,6 +229,15 @@ class ChatWorker(threading.Thread):
|
|||
ws = create_connection("wss://www.blockonomics.co/payment/" + address)
|
||||
print("Connected to websocket...")
|
||||
response = ""
|
||||
#inline_keyboard = telegram.InlineKeyboardMarkup([[telegram.InlineKeyboardButton("Open In Wallet",url="https://google.com")]])
|
||||
# Create the keyboard with the cancel button
|
||||
inline_keyboard = telegram.InlineKeyboardMarkup([[telegram.InlineKeyboardButton(strings.menu_cancel,
|
||||
callback_data="cart_cancel")]])
|
||||
# Send a message containing the button to cancel or pay
|
||||
self.bot.send_message_markdown(self.chat.id, "To pay, send this amount:\n`"
|
||||
+ str(btc_amount)
|
||||
+ "`\nto this bitcoin address:\n`"
|
||||
+ btc_address + "`", reply_markup=inline_keyboard)
|
||||
|
||||
def cancel_thread(stop_event):
|
||||
while not stop_event.is_set():
|
||||
|
@ -787,15 +796,6 @@ class ChatWorker(threading.Thread):
|
|||
#Add and commit the btc transaction
|
||||
self.session.add(transaction)
|
||||
self.session.commit()
|
||||
#inline_keyboard = telegram.InlineKeyboardMarkup([[telegram.InlineKeyboardButton("Open In Wallet",url="https://google.com")]])
|
||||
# Create the keyboard with the cancel button
|
||||
inline_keyboard = telegram.InlineKeyboardMarkup([[telegram.InlineKeyboardButton(strings.menu_cancel,
|
||||
callback_data="cart_cancel")]])
|
||||
# Send a message containing the button to cancel or pay
|
||||
self.bot.send_message_markdown(self.chat.id, "To pay, send this amount:\n`"
|
||||
+ str(btc_amount)
|
||||
+ "`\nto this bitcoin address:\n`"
|
||||
+ btc_address + "`", reply_markup=inline_keyboard)
|
||||
# Wait for the bitcoin payment
|
||||
successfulpayment = self.__wait_for_successfulbtcpayment(btc_address)
|
||||
if successfulpayment:
|
||||
|
|
Loading…
Add table
Reference in a new issue