# * _ __ __ _ _ # * / \ _ _ _ __ ___ _ __ __ _| \/ | ___ __| |_ _| | ___ ___ # * / _ \| | | | '__/ _ \| '__/ _` | |\/| |/ _ \ / _` | | | | |/ _ \/ __| # * / ___ \ |_| | | | (_) | | | (_| | | | | (_) | (_| | |_| | | __/\__ \ # * /_/ \_\__,_|_| \___/|_| \__,_|_| |_|\___/ \__,_|\__,_|_|\___||___/ # * # * © Copyright 2024 # * # * https://t.me/AuroraModules # * # * 🔒 Code is licensed under GNU AGPLv3 # * 🌐 https://www.gnu.org/licenses/agpl-3.0.html # * ⛔️ You CANNOT edit this file without direct permission from the author. # * ⛔️ You CANNOT distribute this file if you have modified it without the direct permission of the author. # Name: AutoFarmUniversal # Author: Felix? # Commands: # .ufarm # scope: hikka_only # meta developer: @AuroraModules # meta pic: https://i.postimg.cc/Hx3Zm8rB/logo.png # meta banner: https://te.legra.ph/file/77e64e3d33263a669125f.jpg __version__ = (1, 0, 0) import asyncio import random from .. import loader, utils @loader.tds class AutoFarmUniversalMod(loader.Module): """Universal auto farmer with settings in the config""" strings = { "name": "AutoFarmUniversal", "status": "ℹ️ Module operation status", "s_1": "Active.", "s_0": "Inactive.", "on": "Activated.", "off": "Deactivated.", "n_args": "🚫 Specify the arguments", "error_cfg": " Error! Incorrect config value.", "cfg_chat_id": "Enter the chat identifier.", "cfg_text": "Enter the text that will be sent.", "cfg_time_delay": "Enter the delay in seconds", "random_time_delay_min": "Enter the minimum value after how long the command will be sent", "random_time_delay_max": "Enter the maximum value after how long the command will be sent", } strings_ru = { "status": "ℹ️ Статус работы модуля", "s_1": "Активно.", "s_0": "Неактивно.", "on": "Активировано.", "off": "Деактивировано.", "n_args": "🚫 Укажите аргументы", "error_cfg": " Ошибка! Неверное значение конфигурации.", "cfg_chat_id": "Введите идентификатор чата.", "cfg_text": "Введите текст, который будет отправлен.", "cfg_time_delay": "Введите задержку в секундах", "random_time_delay_min": "Введите минимальное значение времени, через которое будет отправлена команда", "random_time_delay_max": "Введите максимальное значение времени, через которое будет отправлена команда", } strings_uz = { "status": "ℹ️ Modul ishlash holati", "s_1": "Faol.", "s_0": "Faol emas.", "on": "Faollashtirildi.", "off": "O'chirildi.", "n_args": "🚫 Argumentlarni kiriting", "error_cfg": " Xato! Noto'g'ri konfiguratsiya qiymati.", "cfg_chat_id": "Chat identifikatorini kiriting.", "cfg_text": "Yuboriladigan matnni kiriting.", "cfg_time_delay": "Kechikishni sekundlarda kiriting", "random_time_delay_min": "Buyruq yuboriladigan minimal vaqtni kiriting", "random_time_delay_max": "Buyruq yuboriladigan maksimal vaqtni kiriting", } strings_de = { "status": "ℹ️ Modulbetriebsstatus", "s_1": "Aktiv.", "s_0": "Inaktiv.", "on": "Aktiviert.", "off": "Deaktiviert.", "n_args": "🚫 Geben Sie die Argumente an", "error_cfg": " Fehler! Ungültiger Konfigurationswert.", "cfg_chat_id": "Geben Sie die Chat-ID ein.", "cfg_text": "Geben Sie den zu sendenden Text ein.", "cfg_time_delay": "Geben Sie die Verzögerung in Sekunden ein", "random_time_delay_min": "Geben Sie den minimalen Wert an, nach dem der Befehl gesendet wird", "random_time_delay_max": "Geben Sie den maximalen Wert an, nach dem der Befehl gesendet wird", } strings_es = { "status": "ℹ️ Estado de operación del módulo", "s_1": "Activo.", "s_0": "Inactivo.", "on": "Activado.", "off": "Desactivado.", "n_args": "🚫 Especifica los argumentos", "error_cfg": " Error! Valor de configuración incorrecto.", "cfg_chat_id": "Introduce el identificador del chat.", "cfg_text": "Introduce el texto que se enviará.", "cfg_time_delay": "Introduce el retraso en segundos", "random_time_delay_min": "Introduce el valor mínimo después del cual se enviará el comando", "random_time_delay_max": "Introduce el valor máximo después del cual se enviará el comando", } def __init__(self): self.config = loader.ModuleConfig( loader.ConfigValue( "chat_id", None, lambda: self.strings["cfg_chat_id"] ), loader.ConfigValue( "text", None, lambda: self.strings["cfg_text"] ), loader.ConfigValue( "time_delay", None, lambda: self.strings["cfg_time_delay"], validator=loader.validators.Integer(minimum=1), ), loader.ConfigValue( "random_time_delay_min", None, lambda: self.strings["cfg_random_time_delay_min"], validator=loader.validators.Integer(minimum=1), ), loader.ConfigValue( "random_time_delay_max", None, lambda: self.strings["cfg_random_time_delay_max"], validator=loader.validators.Integer(minimum=2), ), ) async def client_ready(self, client, db): self.db = db self.client = client @loader.command( ru_doc="{on/off} - включить или выключить автоматическую фарминг", uz_doc="{on/off} - avtomatik fermani yoqish yoki o'chirish", de_doc="{on/off} - Auto-Farm ein- oder ausschalten", es_doc="{on/off} - activar o desactivar la auto-granja", ) async def ufarm(self, message): """{on/off} - turn auto farm on or off""" args = utils.get_args_raw(message).lower() status_result_True = self.db.get("AutoFarmUniversal", "status", True) if status_result_True: status_result = self.strings("s_1") else: status_result = self.strings("s_0") error_cfg = self.strings("error_cfg") time_delay = self.config["time_delay"] random_time_delay = self.config["random_time_delay_min"] or self.config["random_time_delay_max"] if self.config["chat_id"] == None: await utils.answer(message, f"{error_cfg}") self.db.set("AutoFarmUniversal", "status", False) await self.allmodules.commands["config"](await message.client.send_message(message.chat_id, f"{self.get_prefix()}cfg AutoFarmUniversal")) return if self.config["text"] == None: await utils.answer(message, f"{error_cfg}") self.db.set("AutoFarmUniversal", "status", False) await self.allmodules.commands["config"](await message.client.send_message(message.chat_id, f"{self.get_prefix()}cfg AutoFarmUniversal")) return if (time_delay is not None and time_delay != 0) and (random_time_delay is not None and random_time_delay != 0): await utils.answer(message, f"{error_cfg}") self.db.set("AutoFarmUniversal", "status", False) await self.allmodules.commands["config"](await message.client.send_message(message.chat_id, f"{self.get_prefix()}cfg AutoFarmUniversal")) return if (time_delay is None or time_delay == 0) and (random_time_delay is None or random_time_delay == 0): await utils.answer(message, f"{error_cfg}") self.db.set("AutoFarmUniversal", "status", False) await self.allmodules.commands["config"](await message.client.send_message(message.chat_id, f"{self.get_prefix()}cfg AutoFarmUniversal")) return if not args: status = self.strings("status") await utils.answer(message, f"{status}: {status_result}") return if args == "on": args_s = self.strings("on") self.db.set("AutoFarmUniversal", "status", True) await utils.answer(message, f" AutoFarmUniversal: {args_s}") elif args == "off": args_s = self.strings("off") self.db.set("AutoFarmUniversal", "status", False) await utils.answer(message, f" AutoFarmUniversal: {args_s}") else: n_args = self.strings("n_args") await utils.answer(message, f"{n_args}") return chat_id = self.config["chat_id"] text = self.config["text"] if time_delay is not None and time_delay != 0: while self.db.get("AutoFarmUniversal", "status"): await message.client.send_message(chat_id, str(text)) time = self.config["time_delay"] await asyncio.sleep(time) if random_time_delay is not None and random_time_delay != 0: while self.db.get("AutoFarmUniversal", "status"): min_delay = self.config['random_time_delay_min'] max_delay = self.config['random_time_delay_max'] r_time = random.randint(min_delay, max_delay) await message.client.send_message(chat_id, str(text)) await asyncio.sleep(r_time)