From 67d9c81f5ca0e76ff0a240bcf44f470b50797ce5 Mon Sep 17 00:00:00 2001 From: Rilliat Date: Mon, 3 Feb 2025 08:19:28 +0300 Subject: [PATCH] update installationcmd --- hikka/langpacks/de.yml | 2 +- hikka/langpacks/en.yml | 19 +++++++++++++------ hikka/langpacks/ru.yml | 2 +- hikka/langpacks/ua.yml | 2 +- hikka/modules/settings.py | 35 +++++++++++++++++++++++++++++++---- hikka/modules/updater.py | 2 +- 6 files changed, 48 insertions(+), 14 deletions(-) diff --git a/hikka/langpacks/de.yml b/hikka/langpacks/de.yml index 97398a6..6b3f85d 100644 --- a/hikka/langpacks/de.yml +++ b/hikka/langpacks/de.yml @@ -247,7 +247,7 @@ settings: _cmd_doc_blacklistuser: "[Benutzer] - Verhindert, dass ein Benutzer Befehle ausführt" _cmd_doc_cleardb: "Löscht die Datenbank" _cmd_doc_delalias: "Entfernt einen Alias für einen Befehl" - _cmd_doc_hikka: "Zeigt die Version von Hikka an" + _cmd_doc_heroku: "Zeigt die Version von Hikka an" _cmd_doc_setprefix: " - Setzt den Befehlspräfix" _cmd_doc_unblacklist: "[Chat] - Aktiviert den Bot an einem bestimmten Ort" _cmd_doc_unblacklistuser: "[Benutzer] - Erlaubt einem Benutzer, Befehle auszuführen" diff --git a/hikka/langpacks/en.yml b/hikka/langpacks/en.yml index ca1af47..2364a5f 100644 --- a/hikka/langpacks/en.yml +++ b/hikka/langpacks/en.yml @@ -159,7 +159,7 @@ heroku_settings: _cmd_doc_nonickuser: "Allow no nickname for certain user" _cmd_doc_nonickusers: "Returns the list of NoNick users" _cmd_doc_settings: "Show settings menu" - _cmd_doc_uninstall_hikka: "Uninstall Heroku" + _cmd_doc_uninstall_heroku: "Uninstall Heroku" _cmd_doc_watcherbl: " - Toggle watcher in current chat" _cmd_doc_watcher: " - Toggle global watcher rules\nArgs:\n[-c - only in chats]\n[-p - only in pm]\n[-o - only out]\n[-i - only incoming]" _cmd_doc_watchers: "List current watchers" @@ -229,14 +229,21 @@ presets: settings: name: "Settings" - choose_installation: "" + 'jamhost', 'module_switch', 'userland' } + termux: "🕶 Termux" + vds: "💎 VDS" + railway: "🚂 Railway" + jamhost: "🧃 JamHost" + module_switch: "📁 Module Switching" + userland: "🐧 UserLand" + choose_installation: "🪐 Choose your {heroku} installation option:" installation: "▪️ The installation is very easy! Just enter the following in your servers terminal:\n
sudo apt update && sudo apt upgrade -y && sudo apt install git && sudo apt install python3-pip && git clone https://github.com/coddrago/Heroku && cd Heroku && pip install -r requirements.txt && python3 -m hikka
\n😐 If you dont have sudo access, simply remove the initial steps.\n\n🥳 Lets go over a few arguments:\n\n🔐 The --root argument allows you to run Heroku as a root user.\n\n🌎 The --no-web argument enables login to your account directly in the terminal, rather than through a link {}.lhr.life.\n\n🤲 However, if you want to migrate from hikariatama Hikka, download this module:\n
{prefix}dlm https://raw.githubusercontent.com/coddrago/modules/main/SwitchToHeroku.py
\nIt completely safe and will help you upgrade to Heroku automatically" - termux_install: "😲 How to install Heroku on Termux?\n⬜️ Download Termux from the link . ⚠️ The version from Play Market will not work!\n⬜️ Copy the command into it: termux-wake-lock && export AIOHTTP_NO_EXTENSIONS=1 && pkg upgr -y && pkg install tur-repo && pkg update && pkg install python3.10 && pkg i wget ncurses-utils python3.10 -y && pkg update && pkg install openssl -y && pkg install git && clear && git clone https://github.com/coddrago/Heroku && cd Heroku && pip install -r requirements.txt && python3.10 -m hikka --no-web\n⬜️ Answer "y" to everything the script asks\n⬜️ Follow the instructions in the script.\n\n⬜️ Where to get API_ID and API_HASH? 🎬 Video" - vds_install: "
sudo apt update && sudo apt upgrade -y && sudo apt install git && sudo apt install python3-pip && git clone https://github.com/coddrago/Heroku && cd Heroku && pip install -r requirements.txt && python3 -m hikka
" + termux_install: "😲 How to install Heroku on Termux?\n⬜️ Download Termux from the link . ⚠️ The version from Play Market will not work!\n⬜️ Copy the command into it: termux-wake-lock && export AIOHTTP_NO_EXTENSIONS=1 && pkg upgr -y && pkg install tur-repo && pkg update && pkg install python3.10 && pkg i wget ncurses-utils python3.10 -y && pkg update && pkg install openssl -y && pkg install git && clear && git clone https://github.com/coddrago/Heroku && cd Heroku && pip install -r requirements.txt && python3.10 -m hikka --no-web\n⬜️ Answer \"y\" to everything the script asks\n⬜️ Follow the instructions in the script.\n\n⬜️ Where to get API_ID and API_HASH? 🎬 Video" + vds_install: "
sudo apt update && sudo apt upgrade -y && sudo apt install git && sudo apt install python3-pip && git clone https://github.com/coddrago/Heroku && cd Heroku && pip install -r requirements.txt && python3 -m hikka
" railway_install: "Image for RailWay:\nhttps://railway.com/template/2YO_QL?referralCode=RfzFur\n\nBe careful! Any userbots are officially prohibited on RailWay, if your account is banned, neither the creator nor other people are to blame for this." jamhost_install: "Proceed to @jamhostbot, type /pay and follow its instructions" - module_switch: "
dlm https://raw.githubusercontent.com/coddrago/modules/main/SwitchToHeroku.py
" - userland_install: "Install UserLAnd from the link\n\nOpen it, choose Ubuntu —> Minimal —> Terminal\n\nWait for the distribution to install, you can pour some tea\n\nAfter successful installation, a terminal will open in front of you, write there:\n
sudo apt update && sudo apt upgrade -y && sudo apt install python3 git python3-pip -y && git clone https://github.com/coddrago/Heroku && cd Heroku && sudo pip install -r requirements.txt && python3 -m hikka
\n\nAt the end of the installation, a link will appear, follow it and enter your account details to log in.\n\nVoila! You have installed Heroku on UserLAnd." + module_switch_install: "
dlm https://raw.githubusercontent.com/coddrago/modules/main/SwitchToHeroku.py
" + userland_install: "Install UserLAnd from the link\n\nOpen it, choose Ubuntu —> Minimal —> Terminal\n\nWait for the distribution to install, you can pour some tea\n\nAfter successful installation, a terminal will open in front of you, write there:\n
sudo apt update && sudo apt upgrade -y && sudo apt install python3 git python3-pip -y && git clone https://github.com/coddrago/Heroku && cd Heroku && sudo pip install -r requirements.txt && python3 -m hikka
\n\nAt the end of the installation, a link will appear, follow it and enter your account details to log in.\n\nVoila! You have installed Heroku on UserLAnd." too_many_args: "🚫 Too many args" blacklisted: "👍 Chat {} blacklisted from userbot" unblacklisted: "👍 Chat {} unblacklisted from userbot" diff --git a/hikka/langpacks/ru.yml b/hikka/langpacks/ru.yml index 3c2be6d..d054fa0 100644 --- a/hikka/langpacks/ru.yml +++ b/hikka/langpacks/ru.yml @@ -148,7 +148,7 @@ heroku_settings: _cmd_doc_nonickuser: "Включить NoNick для определенного пользователя" _cmd_doc_nonickusers: "Показать список активных NoNick пользователей" _cmd_doc_settings: "Показать настройки" - _cmd_doc_uninstall_hikka: "Удалить Heroku" + _cmd_doc_uninstall_heroku: "Удалить Heroku" _cmd_doc_watcherbl: " - Включить/выключить смотрителя в текущем чате" _cmd_doc_watcher: "<модуль> - Управление глобальными правилами смотрителя\nАргументы:\n[-c - только в чатах]\n[-p - только в лс]\n[-o - только исходящие]\n[-i - только входящие]" _cmd_doc_watchers: "Показать активные смотрители" diff --git a/hikka/langpacks/ua.yml b/hikka/langpacks/ua.yml index 7edb2c5..19a8c21 100644 --- a/hikka/langpacks/ua.yml +++ b/hikka/langpacks/ua.yml @@ -247,7 +247,7 @@ settings: _cmd_doc_blacklistuser: "[користувач] - Заборонити користувачу виконувати команди" _cmd_doc_cleardb: "Очистити базу даних" _cmd_doc_delalias: "Видалити аліас для команди" - _cmd_doc_hikka: "Показати версію Heroku" + _cmd_doc_heroku: "Показати версію Heroku" _cmd_doc_setprefix: "<префікс> - Встановити префікс команд" _cmd_doc_unblacklist: "[чат] - Увімкнути бота де-небудь" _cmd_doc_unblacklistuser: "[користувач] - Дозволити користувачу виконувати команди" diff --git a/hikka/modules/settings.py b/hikka/modules/settings.py index 167d37a..adca041 100644 --- a/hikka/modules/settings.py +++ b/hikka/modules/settings.py @@ -45,6 +45,20 @@ class CoreMod(loader.Module): ), ) + async def client_ready(self): + self._markup = utils.chunks( + [ + { + "text": self.strings(platform), + "callback": self._inline__choose__installation, + "args": (platform,), + } + for platform in {'termux', 'vds', 'railway', + 'jamhost', 'module_switch', 'userland'} + ], + 2 + ) + def _process_config_changes(self): # option is controlled by user only # it's not a RCE @@ -292,9 +306,15 @@ class CoreMod(loader.Module): args = utils.get_args_raw(message) - if not args and not self.inline.form( - self.strings("choose_installation") - ): + if (not args or args not in {'-t', '-v', '-r', '-jh', '-ms', '-u'}) and \ + (not self.inline.form( + self.strings("choose_installation"), + message, + reply_markup=self._markup, + photo="https://imgur.com/a/HrrFair.png" + ) + ): + await self.client.send_file( message.peer_id, "https://imgur.com/a/HrrFair.png", @@ -308,6 +328,13 @@ class CoreMod(loader.Module): elif "-jh" in args: await utils.answer(message, self.strings["jamhost_install"]) elif "-ms" in args: - await utils.answer(message, self.strings["module_switch"]) + await utils.answer(message, self.strings["module_switch_install"]) elif "-u" in args: await utils.answer(message, self.strings["userland_install"]) + + async def _inline__choose__installation(self, call: InlineCall, platform: str): + await call.edit( + text=self.strings(f'{platform}_install'), + reply_markup=self._markup, + ) + diff --git a/hikka/modules/updater.py b/hikka/modules/updater.py index dd72b1d..91f6806 100644 --- a/hikka/modules/updater.py +++ b/hikka/modules/updater.py @@ -130,7 +130,7 @@ class UpdaterMod(loader.Module): ) @loader.callback_handler() - async def update(self, call: InlineCall): + async def update_call(self, call: InlineCall): """Process update buttons clicks""" if call.data not in {"heroku/update", "heroku/ignore_upd"}: return