def handle_refill_btc(call): chat = call.message.chat users_db = Users_db(project_variables.DB_NAME) address = users_db.select_addr_address(chat.id)[0] if address is None: address = coinbase_functions.generate_address() users_db.update_addr_by_user(chat.id, address) is_eng = users_db.select_stats_field(chat.id, 'is_eng') users_db.close() if is_eng: text = "*Minimal amount is {:.8f} BTC*\nYou can send desired amount of BTC and the bot will automatically" \ " charge them to your deposit.\nSend only one transaction to this address:\n`{}`\nNote that BTC " \ "transfers are not instant" else: text = "*Минимальная сумма: {:.8f} BTC*\nВы можете отправить желаемую сумму BTC и бот автоматически занесет её " \ "в ваш депозит.\nОтправляйте только одну транзакцию на этот адрес:\n`{}`\nОбратите внимание, что" \ " переводы BTC осуществляются не моментально." try: bot.send_message( chat.id, text.format(utils.to_bitcoin(project_variables.MIN_REFILL_BTC), address), parse_mode="Markdown") except telebot.apihelper.ApiException: pass
def start_command(message): chat = message.chat if chat.type == "private": try: bot.send_message(chat.id, "Hello, {}! Please select your language:".format( chat.first_name), reply_markup=utils.get_keyboard("lang_keyboard")) except telebot.apihelper.ApiException: pass users_db = Users_db(project_variables.DB_NAME) # Handle inserting user's statistics and ref_program info if not users_db.is_exist_stats(chat.id): users_db.insert_stats((chat.id, 0.0, 0, 0.0, 0, 0.0, 0, 1)) users_db.insert_ref(chat.id) # Handle updating inviter from ref_program salt = message.text.split()[-1] if salt.isnumeric(): found_user_id = users_db.select_salts_user_id(salt) if found_user_id is not None: users_db.update_ref_inviter(chat.id, found_user_id[0]) utils.lift_on_lines(users_db, chat.id, utils.update_people_on_line, operation='+') # Handle inserting user's requisites if not users_db.is_exist_requisites(chat.id): users_db.insert_requisites(chat.id) # Handle inserting user's addresses if users_db.select_addr_address(chat.id) is None: users_db.insert_addr(chat.id) # Handle inserting user's spam cnt if users_db.select_spam_cnt(chat.id) is None: users_db.insert_spam_record(chat.id) # Handle reward make_reward(chat.id, REWARD_AMOUNT, users_db) users_db.close() else: try: bot.send_message(chat.id, "This bot can work only in private chats") except telebot.apihelper.ApiException: pass bot.leave_chat(chat.id)