def check_oplata_qiwi(chat_id, username, callback_id, first_name): if chat_id in he_client: with open('data/Temp/' + str(chat_id) + 'good_name.txt', encoding='utf-8') as f: name_good = f.read() phone = dop.normal_read_line('data/Temp/' + str(chat_id) + '.txt', 0) token = dop.normal_read_line('data/Temp/' + str(chat_id) + '.txt', 1) amount = dop.normal_read_line('data/Temp/' + str(chat_id) + '.txt', 2) price = dop.normal_read_line('data/Temp/' + str(chat_id) + '.txt', 3) comm = dop.read_my_line('data/Temp/' + str(chat_id) + '.txt', 4) api = SimpleQIWI.QApi(phone=phone, token=token) comment = api.bill(int(price), comm) api.start() time.sleep(1) try: if api.check(comment): he_client.remove(chat_id) try: bot.edit_message_text( chat_id=chat_id, message_id=message_id, text= 'Платёж успешно зачилен!\nСейчас вы получите ваш товар' ) except: pass text = '' for i in range(int(amount)): if dop.get_goodformat(name_good) == 'file': bot.send_document(chat_id, dop.get_tovar(name_good)) elif dop.get_goodformat(name_good) == 'text': text += dop.get_tovar(name_good) + '\n' if dop.get_goodformat(name_good) == 'text': bot.send_message(chat_id, text) if dop.check_message('after_buy') is True: with shelve.open(files.bot_message_bd) as bd: after_buy = bd['after_buy'] after_buy = after_buy.replace('username', username) after_buy = after_buy.replace('name', first_name) bot.send_message(chat_id, after_buy) for admin_id in dop.get_adminlist(): bot.send_message(admin_id, '*Юзер*\nID: `' + str(chat_id) + '`\nUsername: @' + username + '\nКупил *' + name_good + '*\nНа сумму ' + str(price) + ' р', parse_mode='Markdown') dop.new_buy(chat_id, username, name_good, amount, price) dop.new_buyer(chat_id, username, price) else: bot.answer_callback_query(callback_query_id=callback_id, show_alert=True, text='Деньги ещё не были зачислены!') except: pass api.stop()
def check_oplata_btc(chat_id, username, callback_id, first_name): if chat_id in he_client: with open( 'https://drive.google.com/open?id=1F7UFARDfsTKih-tdJnXH6KlzikWfO9tz' + str(chat_id) + 'good_name.txt', encoding='utf-8') as f: name_good = f.read() amount = dop.normal_read_line( 'https://drive.google.com/open?id=1F7UFARDfsTKih-tdJnXH6KlzikWfO9tz' + str(chat_id) + '.txt', 0) sum = dop.normal_read_line( 'https://drive.google.com/open?id=1F7UFARDfsTKih-tdJnXH6KlzikWfO9tz' + str(chat_id) + '.txt', 1) address = dop.read_my_line( 'https://drive.google.com/open?id=1F7UFARDfsTKih-tdJnXH6KlzikWfO9tz' + str(chat_id) + '.txt', 2) r = requests.get('https://blockchain.info/q/addressbalance/' + address) s = r.text if float(s) >= float(sum): try: bot.edit_message_text( chat_id=chat_id, message_id=message_id, text='Платёж успешно зачилен!\nСейчас вы получите ваш товар' ) except: pass text = '' for i in range(int(amount)): if dop.get_goodformat(name_good) == 'file': bot.send_document(chat_id, dop.get_tovar(name_good)) elif dop.get_goodformat(name_good) == 'text': text += dop.get_tovar(name_good) + '\n' if dop.get_goodformat(name_good) == 'text': bot.send_message(chat_id, text) if dop.check_message('after_buy') is True: with shelve.open(files.bot_message_bd) as bd: after_buy = bd['after_buy'] after_buy = after_buy.replace('username', username) after_buy = after_buy.replace('name', first_name) bot.send_message(chat_id, after_buy) for admin_id in dop.get_adminlist(): bot.send_message(admin_id, '*Юзер*\nID: `' + str(chat_id) + '`\nUsername: @' + username + '\nКупил *' + name_good + '*\nНа сумму ' + str(sum) + ' btc', parse_mode='Markdown') #*/ # dop.new_buy(chat_id, username, name_good, amount, price) # dop.new_buyer(chat_id, username, price) else: bot.answer_callback_query(callback_query_id=callback_id, show_alert=True, text='Деньги ещё не были зачислены!')