def makeMoney(): for bank in getBankList(): bankOwner = bank[3] bank_money = int(getBankValue(bankOwner, "money")) credit_p = int(getBankValue(bankOwner, "credit_percent")) dedit_p = int(getBankValue(bankOwner, "debit_percent")) for user in getBankUsers(bankOwner): bank_user_name = user[0] bank_user_money = int(user[2]) user_money = int( database.getDBValue(bank_user_name, "eco", "money")) if user_money < 0: database.setDBValue(bank_user_name, "users", "banned", "1") if bank_user_money > 0: if user[1] == "credit": summ = round(getValueByPercent(credit_p, bank_user_money)) user_money = user_money - summ database.setDBValue(bank_user_name, "eco", "money", str(user_money)) setBankValue(bankOwner, "money", str(bank_money + summ)) setBankUserValue(bankOwner, bank_user_name, str(bank_user_money - summ)) pass elif user[1] == "debit": pass else: pass else: print("Skip, user money in bank = 0") pass
def answer(message): if not user_func.userCanUseCommand(message.from_user.username): bf.ReplyTo(bot, message, "Соси бибу, ты забанен", stack=False, timeout=3) return username = message.from_user.username.replace("@", "") current_user_money = int(database.getDBValue(username, "eco", "money")) bank_cost = config.global_economic["bank_cost"] if current_user_money < bank_cost: bf.ReplyTo(bot, message, "Не хватает денег, заказать банк стоит " + str(bank_cost), stack=False, timeout=3) return new_bank = bank_func.blank_bank_obj database.setDBValue(username, "eco", "money", str(current_user_money - bank_cost)) bank_func.createBankEntry(username, new_bank) UI = "🏦Новый банк создан!\n" UI += "\t\tНазвание банка: *" + new_bank["bankname"] + "*\n" UI += "📝Описание банка: *" + new_bank["description"] + "*\n" UI += "💵Процент по кредиту банка: *" + new_bank["credit_percent"] + "%*\n" UI += "💵Процент по дебету банка: *" + new_bank["debit_percent"] + "%*\n" UI += "⏱Время сбора процентов: *" + new_bank["time_to_pay"] + "м*\n" msg = bot.reply_to(message, UI, parse_mode="Markdown") bf.ReplyTo(bot, message, UI, stack=False, timeout=20, use_markdown=True)
def answer(message): if user_func.isOwner(message.from_user.username.replace("@", "")): target = message.text.split(maxsplit=4)[1].replace("@", "") obj = message.text.split(maxsplit=4)[2] key = message.text.split(maxsplit=4)[3] value = message.text.split(maxsplit=4)[4] if fileio.isUserExist(target): database.setDBValue(target, obj, key, value) bf.ReplyTo(bot, message, "Значение " + key + " у " + target + " теперь - " + value, stack=False, timeout=3) else: bf.ReplyTo(bot, message, "Данного пользователя нет в базе данных", stack=False, timeout=3) else: bf.ReplyTo(bot, message, "Доступно только создателю", stack=False, timeout=3)
def setPetAvatar(bot, message): username = message.from_user.username.replace("@", "") try: target_pet_id = message.text.split()[1] target_value = message.text.split()[2] if len(database.getListPetsByUserName(username)) != 0: if database.isPetExist(username, target_pet_id) is not None: user_money = int(database.getDBValue(username, "eco", "money")) change_name_cost = config.global_economic[ "pet_change_avatar_cost"] UI = "" if user_money < change_name_cost: UI = "У вас не достаточно денег для смены аватара!\n" UI += "Цена смены составляет: " + str( change_name_cost) + "💵\n" UI += "💰 Ваш баланс: " + str(user_money) + "\n" bf.ReplyTo(bot, message, UI, stack=False, timeout=10) return lost_current = int( database.getDBValue(username, "stats", "money_lost_in_pet")) lost = lost_current + ( config.global_economic["pet_change_avatar_cost"]) database.setDBValue(username, "stats", "money_lost_in_pet", str(lost)) user_money = user_money - change_name_cost database.setDBValue(username, "eco", "money", str(user_money)) database.setPetValueByPos(username, target_pet_id, "pet_avatar", target_value) UI += "Изменено:\n" UI += "▫ Аватар питомца: " + str( database.getPetValue(username, target_pet_id, "pet_avatar")) + "\n" bf.ReplyTo(bot, message, UI, stack=False, timeout=10) else: bf.ReplyTo( bot, message, "Такого питомца не существует, посмотреть список питомцев /mypets", stack=False, timeout=3) else: bf.ReplyTo( bot, message, "У вас нет ни одного питомца, купить /buy_pet [ид питомца] [имя питомца]", stack=False, timeout=3) except: bf.ReplyTo(bot, message, "Команда введена не правильно. /pet_setavatar [ид] [смайл]", stack=False, timeout=3)
def run(self): chat_id = self.message.chat.id msg = self.bot.reply_to(self.message, "⏳") usermoney = int(db.getDBValue(self.username, "eco", "money")) rullet_price = round(self.ROLL_PRICE * self.game_bet) if usermoney < rullet_price: time.sleep(2) self.bot.edit_message_text( "У вас не хватает денег. Стоимость: " + str(rullet_price) + "💵\nВаш баланс: " + str(usermoney) + "💵", msg.chat.id, msg.message_id) time.sleep(5) self.bot.delete_message(chat_id, msg.message_id) self.bot.delete_message(chat_id, self.message.message_id) mainf.GAME_AVAILABLE = True return usermoney -= rullet_price time.sleep(2) line = self.getLine() line2 = self.getLine() line3 = self.getLine() DISP = self.processUI([line, line2, line3]) for i in range(4): time.sleep(0.3) UI = "Вы потратили на игру " + str( rullet_price) + "💵\nРезультат:\n" UI += DISP[i] if i == 3: won = 0 if self.lineWin(line2): won += self.getLinePrize(line2[1]) if self.diagonalLineWin([line, line2, line3]): won += self.getLinePrize(line2[1]) if self.diagonalLineWin([line, line2, line3], reverse=True): won += self.getLinePrize(line2[1]) if won != 0: UI += "\nВы выиграли! 😎" UI += "\nВаш приз составил: " + str(won) + "💵" usermoney += won db.setDBValue(self.username, "eco", "money", str(usermoney)) else: UI += "\nУдача не на вашей стороне 😄" self.bot.edit_message_text(UI, msg.chat.id, msg.message_id) time.sleep(15) chat_id = self.message.chat.id self.bot.delete_message(chat_id, msg.message_id) self.bot.delete_message(chat_id, self.message.message_id)
def messageCounter(messages): for message in messages: username = message.from_user.username if username is not None: username = username.replace("@", "") if fileio.isUserExist(username): if database.getDBValue(username, "user", "banned") != "1": try: target_message_count = int( database.getDBValue(username, "stats", "message_count")) target_message_count += 1 database.setDBValue(username, "stats", "message_count", str(target_message_count)) except: pass
def delAdmin(bot, message): username = message.from_user.username.replace("@", "") target = message.text.split(maxsplit=1)[1].replace("@", "") if isOwner(username): database.setDBValue(target, "user", "admin", "1") bf.ReplyTo(bot, message, "Теперь *" + target + "* больше не администратор", stack=False, timeout=3, use_markdown=True) else: bf.ReplyTo(bot, message, "Доступно только администраторам", stack=False, timeout=3)
def answer(message): if not user_func.userCanUseCommand(message.from_user.username): bf.ReplyTo(bot, message, "Соси бибу, ты забанен", stack=False, timeout=3) return if user_func.isUserAdmin(message.from_user.username): try: req = Request("http://www.gifporntube.com/gifs/" + str(random.randint(20, 2000)) + ".html", headers={'User-Agent': 'Mozilla/5.0'}) resource = urllib.request.urlopen(req) content = resource.read().decode( resource.headers.get_content_charset()) urls = re.findall( 'https?://(?:[-\w.]|(?:%[\da-fA-F]{2}))+([/a-z_0-9]*.mp4)', content) markdown = "[ᅠ](http://www.gifporntube.com" + str(urls[0]) + ")" usage_count = int( database.getDBValue(message.from_user.username, "stats", "sex_command_count")) usage_count += 1 database.setDBValue(message.from_user.username, "stats", "sex_command_count", str(usage_count)) bot.delete_message(message.chat.id, message.message_id) bf.ReplyTo(bot, message, markdown, stack=False, timeout=6, use_markdown=True) except: bf.ReplyTo(bot, message, "Временно не доступно", stack=False, timeout=3) else: bf.ReplyTo(bot, message, "Достпуно только для админов, соси бибу", stack=False, timeout=3)
def unBanUser(bot, message): username = message.from_user.username.replace("@", "") target = message.text.split(maxsplit=1)[1].replace("@", "") if isUserAdmin(username): database.setDBValue(target, "user", "banned", "0") bf.ReplyTo(bot, message, "Теперь @*" + target + "* не будет сосет бибу", stack=False, timeout=3, use_markdown=True) else: bf.ReplyTo(bot, message, "Доступно только администраторам", stack=False, timeout=3, use_markdown=True)
def send_photo(message): if not user_func.userCanUseCommand(message.from_user.username): bf.ReplyTo(bot, message, "Соси бибу, ты забанен", stack=False, timeout=3) return if user_func.isUserAdmin(message.from_user.username): try: usage_count = int( database.getDBValue(message.from_user.username, "stats", "sex_command_count")) usage_count += 1 database.setDBValue(message.from_user.username, "stats", "sex_command_count", str(usage_count)) markdown = "[ᅠ](https://www.scrolller.com/media/" + str( random.randint(20, 2000)) + ".jpg)" usage_count = int( database.getDBValue(message.from_user.username, "stats", "sex_command_count")) usage_count += 1 database.setDBValue(message.from_user.username, "stats", "sex_command_count", str(usage_count)) bot.delete_message(message.chat.id, message.message_id) bf.ReplyTo(bot, message, markdown, stack=False, timeout=6, use_markdown=True) except: bf.ReplyTo(bot, message, "Временно не доступно", stack=False, timeout=3) else: bf.ReplyTo(bot, message, "Достпуно только для админов, соси бибу", stack=False, timeout=3)
def playGAME(bot, message): try: message_to_delete = message.message_id userName = message.from_user.username.replace("@", "") if userName is None: msg = bot.reply_to(message, "У тебя нет никнейма, что бы играть") bot.message_stack.append(msg) return userMoney = int(database.getDBValue(userName, "eco", "money")) user_slot_gamed_count = int(database.getDBValue(userName, "stats", "slot_gamed_count")) user_money_lost_in_slot = int(database.getDBValue(userName, "stats", "money_lost_in_slot")) if userMoney < 0: delete = bot.reply_to(message, "У тебя нет денег, возьми кредит /banks") time.sleep(15) bot.delete_message(message.chat.id, delete.message_id) else: command = message.text.split() bet = 1 if len(command) > 1: if command[1] == "0": bet = 1 bet = int(command[1]) if bet > 25: delete = bot.reply_to(message, "Максимальная ставка - х25🕹") time.sleep(4) bot.delete_message(message.chat.id, delete.message_id) return user_slot_gamed_count += 1 user_money_lost_in_slot = user_money_lost_in_slot + (config.global_economic["slot_spin_cost"]*bet) slotState = getSlotState(bet) prize = int(slotState[0]) slot_line1 = slotState[1][0] slot_line2 = slotState[1][1] slot_line3 = slotState[1][2] won = userMoney + prize if prize == 0: won = userMoney - (config.global_economic["slot_spin_cost"]*bet) UI = "" #UI = "👨: @" + userName + "\n" UI += "\n⚖️Баланс: " + str(won) + "💲\n" UI += "\n🕹Cтавка: "+str((config.global_economic["slot_spin_cost"]*bet))+"💶\n\n" UI += "3x🍏 = "+str(config.global_economic["slot_item1_cost"]*bet)+"\n3x🍋 = "+str(config.global_economic["slot_item2_cost"]*bet)+"\n3x🍇 = "+str(config.global_economic["slot_item3_cost"]*bet)+"\n3x🍒 = "+str(config.global_economic["slot_item4_cost"]*bet)+"\n3x7️⃣ = "+str(config.global_economic["slot_item5_cost"]*bet)+" \n" UI += "----------------------------\n" UI += "[ -" + slot_line1[0][0] + "- -" + slot_line1[1][0] + "- -" + slot_line1[2][0] + "- ]\n" UI += "[ -" + slot_line2[0][0]+ "- -" + slot_line2[1][0] + "- -" + slot_line2[2][0] + "- ]\n" UI += "[ -" + slot_line3[0][0]+ "- -" + slot_line3[1][0] + "- -" + slot_line3[2][0] + "- ]\n" UI += "----------------------------\n" if prize == 0: UI += "\nТы потерял свои несчастные: " + str(config.global_economic["slot_spin_cost"]*bet) + "💲 и ничего не выиграл\n" else: UI += "\n🎉 Выигрыш: " + str(prize) + "💲\n" database.setDBValue(userName, "eco", "money", str(won)) database.setDBValue(userName, "stats", "slot_gamed_count", str(user_slot_gamed_count)) database.setDBValue(userName, "stats", "money_lost_in_slot", str(user_money_lost_in_slot)) show_ui = bot.reply_to(message, UI) time.sleep(10) bot.delete_message(message.chat.id, show_ui.message_id) bot.delete_message(message.chat.id, message_to_delete) except: #msg = bot.send_message(message.chat.id, "Попробуй еще раз, что-то сломалось") #bot.message_stack.append(msg) pass
def buyPet(bot, message): username = message.from_user.username.replace("@", "") if fileio.isUserExist(username): user_money = int(database.getDBValue(username, "eco", "money")) pet_cost = config.global_economic["pet_cost"] if user_money < pet_cost: UI = "У вас не достаточно денег для покупки!\n" UI += "Цена нового питомца составляет: " + str(pet_cost) + "💵\n" UI += "💰Ваш баланс: " + str(user_money) + "\n" bf.ReplyTo(bot, message, UI, stack=False, timeout=10) return try: target_pet_id = message.text.split()[1] target_pet_name = message.text.split()[2] pet_count = len(database.getListPetsByUserName(username)) if pet_count == 0: pet_count = 1 user_money = user_money - (pet_cost * pet_count) database.setDBValue(username, "user", "money", str(user_money)) database.addPet(username, target_pet_name, target_pet_id) time.sleep(1) UI = "Вы успешно купили нового питомца 👍\n" UI += "💵 Списано со счета " + str((pet_cost * pet_count)) + " \n\n" UI += "💵 Цена = количество * стандартная цена (3000💵 ) \n" UI += "💰 Баланс " + str(database.getDBValue(username, "money")) + " \n" UI += "Состояние \n\n" UI += "Владелец: @" + str(username) + "\n" UI += "▫️Аватар питомца: " + str( database.getPetValue(username, target_pet_id, "pet_avatar")) + "\n" UI += "▫️Имя питомца: " + str( database.getPetValue(username, target_pet_id, "pet_name")) + "\n" UI += "🍗 Еда питомца: " + str( database.getPetValue(username, target_pet_id, "pet_food")) + "\n" UI += "💧 Вода питомца: " + str( database.getPetValue(username, target_pet_id, "pet_water")) + "\n" UI += "🍗🍗🍗 Избыток еды: " + str( database.getPetValue(username, target_pet_id, "pet_food_auto")) + "\n" UI += "💧💧💧 Избыток воды: " + str( database.getPetValue(username, target_pet_id, "pet_water_auto")) + "\n" UI += "🏠 У питомца есть дом: " + str( database.getPetValue(username, target_pet_id, "pet_have_house")) + "\n" UI += "🏠📊 Уровень дома питомца: " + str( database.getPetValue(username, target_pet_id, "pet_house_level")) + "\n" UI += "💵 Пассивный доход с питомца: " + str( database.getPetValue(username, target_pet_id, "pet_passive_produce")) + "\n" UI += "⏱💵 Тайм-аут дохода в минутах: " + str( database.getPetValue(username, target_pet_id, "pet_passive_produce_timeout_m")) + "\n" UI += "📊 Уровень питомца: " + str( database.getPetValue(username, target_pet_id, "pet_level")) + "\n" UI += "🌟 Опыт питомца: " + str( database.getPetValue(username, target_pet_id, "pet_exp")) + "\n" UI += "💎 Найдено сокровищ питомцем: " + str( database.getPetValue(username, target_pet_id, "pet_unique_treasure")) + "\n" bf.ReplyTo(bot, message, UI, stack=False, timeout=10) except: bf.ReplyTo( bot, message, "Команда введена не правильно. /buy_pet [ид питомца] [имя питомца]\n ID используется для обращения к конкретному питомцу", stack=False, timeout=3)
def answer(message): if not user_func.userCanUseCommand(message.from_user.username): bf.ReplyTo(bot, message, "Соси бибу, ты забанен", stack=False, timeout=3) return username = message.from_user.username.replace("@", "") command = message.text.split() if len(command) < 2: bf.ReplyTo( bot, message, "Команда введена не правильно. /getcredit [владелец] [сумма]. Список банков /banks", stack=False, timeout=5) return usermoney = int(database.getDBValue(username, "eco", "money")) owner = command[1].replace("@", "") amount = int(command[2]) if bank_func.isBankExist(owner): bank_money = int(bank_func.getBankValue(owner, "money")) if amount > bank_money: bf.ReplyTo( bot, message, "Банк не может выдать вам кредит, у банка нет нужной суммы!", stack=False, timeout=5) return if username == owner: bf.ReplyTo(bot, message, "Вы не можете взять кредит у своего банка", stack=False, timeout=5) return if int(len(bank_func.getBankUsers(owner))) > 0: for user in bank_func.getBankUsers(owner): if username == user[0]: if user[1] == "credit": credit_money = int(user[2]) credit_percent = int( bank_func.getBankValue(owner, "credit_percent")) credit_money = credit_money + (amount + round( bank_func.getValueByPercent( credit_percent, amount))) bank_money = bank_money - amount usermoney = usermoney + (amount - round( bank_func.getValueByPercent( credit_percent, amount))) bank_func.setBankValue(owner, "money", str(bank_money)) bank_func.setBankUserValue(owner, username, credit_money) database.setDBValue(username, "eco", "money", str(usermoney)) UI = "Вы успешно взяли кредит в банке 🏦 @" + owner + "\n" UI += "Затребовано: " + str( amount) + "💵\nКредит банка " + str( credit_percent ) + "% \nИтого получено - " + str(amount - round( bank_func.getValueByPercent( credit_percent, amount))) + "💵\n" UI += "Спасибо что пользуетесь услугами банка: 🏦" + bank_func.getBankValue( owner, "bankname") + "\n\n" UI += "Ваш баланс: " + str(usermoney) + "💵\n" bf.ReplyTo(bot, message, UI, stack=False, timeout=20) return credit_percent = int(bank_func.getBankValue(owner, "credit_percent")) credit_money = amount + round( bank_func.getValueByPercent(credit_percent, amount)) bank_money = bank_money - amount usermoney = usermoney + (amount - round( bank_func.getValueByPercent(credit_percent, amount))) new_bank_user = bank_func.blank_user_obj new_bank_user["name"] = username new_bank_user["money"] = str(credit_money) bank_func.setBankValue(owner, "money", str(bank_money)) bank_func.setBankUserValue(owner, username, credit_money) database.setDBValue(username, "eco", "money", str(usermoney)) bank_func.addNewUserToBank(owner, new_bank_user) UI = "Вы успешно взяли кредит в банке 🏦 @" + owner + " и стали его участником\n" UI += "Затребовано: " + str(amount) + "💵\nКредит банка " + str( credit_percent) + "% \nИтого получено - " + str(amount - round( bank_func.getValueByPercent(credit_percent, amount))) + "💵\n" UI += "Спасибо что пользуетесь услугами банка: 🏦" + bank_func.getBankValue( owner, "bankname") + "\n\n" UI += "Ваш баланс: " + str(usermoney) + "💵\n" bf.ReplyTo(bot, message, UI, stack=False, timeout=20) else: bf.ReplyTo( bot, message, "Такого банка не существует. /getcredit [владелец] [сумма]. Список банков /banks", stack=False, timeout=3)
def answer(message): if not user_func.userCanUseCommand(message.from_user.username): bf.ReplyTo(bot, message, "Соси бибу, ты забанен", stack=False, timeout=3) return username = message.from_user.username.replace("@", "") command = message.text.split() if len(command) < 1: bf.ReplyTo( bot, message, "Команда введена не правильно. /paytobank [владелец] [сумма]. Список банков /banks", stack=False, timeout=5) return usermoney = int(database.getDBValue(username, "eco", "money")) owner = command[1].replace("@", "") amount = int(command[2]) if amount > usermoney: bf.ReplyTo(bot, message, "У вас не хватает денег. Ваш баланс: " + str(usermoney) + "💵", stack=False, timeout=5) return if bank_func.isBankExist(owner): bank_money = int(bank_func.getBankValue(owner, "money")) if username == owner: bank_money = bank_money + amount UI = "Вы внесли в свой банк 🏦" + bank_func.getBankValue( owner, "bankname") + " деньги на сумму: " + str(amount) + "💵\n" UI += "Баланс вашего банка: " + str(bank_money) + "💵" bank_func.setBankValue(owner, "money", str(bank_money)) database.setDBValue(username, "eco", "money", str(usermoney - amount)) bf.ReplyTo(bot, message, UI, stack=False, timeout=20) return if int(len(bank_func.getBankUsers(owner))) > 0: for user in bank_func.getBankUsers(owner): if username == user[0]: if user[1] == "credit": credit_money = int(user[2]) credit_percent = int( bank_func.getBankValue(owner, "credit_percent")) credit_money = credit_money - (amount - round( bank_func.getValueByPercent( credit_percent, amount))) bank_money = bank_money + amount + round( bank_func.getValueByPercent( credit_percent, amount)) usermoney = usermoney - (amount - round( bank_func.getValueByPercent( credit_percent, amount))) bank_func.setBankValue(owner, "money", str(bank_money)) if credit_money < 0: credit_money = 0 bank_func.setBankUserValue(owner, username, credit_money) database.setDBValue(username, "eco", "money", str(usermoney)) UI = "Вы заплатили в банк 🏦 @" + owner + "\n" UI += "Платеж: " + str( amount) + "💵 плюс кредит банка " + str( credit_percent) + "% итого списано - " + str( amount - round( bank_func.getValueByPercent( credit_percent, amount))) + "💵\n" UI += "Спасибо что пользуетесь услугами банка: 🏦" + bank_func.getBankValue( owner, "bankname") bf.ReplyTo(bot, message, UI, stack=False, timeout=20) return else: debet_money = int(user[2]) debet_money = debet_money + amount bank_money = bank_money + amount usermoney = usermoney - amount bank_func.setBankValue(owner, "money", str(bank_money)) bank_func.setBankUserValue(owner, username, debet_money) database.setDBValue(username, "eco", "money", str(usermoney)) UI = "Вы внесли в банк 🏦 @" + owner + "\n" UI += "Платеж: " + str(amount) + "💵\n" UI += "Спасибо что пользуетесь услугами банка: 🏦" + bank_func.getBankValue( owner, "bankname") bf.ReplyTo(bot, message, UI, stack=False, timeout=20) return UI = "Вы не являетесь пользователем банка 🏦 " + bank_func.getBankValue( owner, "bankname") + " и не можете платить банку" bf.ReplyTo(bot, message, UI, stack=False, timeout=5) else: bf.ReplyTo(bot, message, "Пользователь не владеет банком!", stack=False, timeout=3)