mirror of https://github.com/coddrago/Heroku
update strings, fix some errors
parent
fb1ffa3218
commit
1fa3aed083
|
@ -379,6 +379,7 @@ updater:
|
|||
installing: "<emoji document_id=5208622108191506906>🕗</emoji> <b>Updates werden installiert...</b>"
|
||||
success: "<emoji document_id=5208661316947955396>⏱</emoji> <b>Neustart erfolgreich! {}</b>\n<i>Die Module werden jedoch noch geladen...</i>\n<i>Der Neustart dauerte {} Sekunden</i>"
|
||||
full_success: "<emoji document_id=6028215594707324419>👍</emoji> <b>Der Userbot ist vollständig geladen! {}</b>\n<i>Der vollständige Neustart dauerte {} Sekunden.</i>"
|
||||
ub_stop: "Dein {} wurde gestoppt!"
|
||||
secure_boot_complete: "<emoji document_id=5472308992514464048>🔐</emoji> <b>Sicherer Start abgeschlossen! {}</b>\n<i>Der Neustart dauerte {} Sekunden</i>"
|
||||
origin_cfg_doc: "Die URL, von der die Updates heruntergeladen werden"
|
||||
btn_restart: "🔄 Neu starten"
|
||||
|
|
|
@ -419,6 +419,7 @@ updater:
|
|||
cancel: "🚫 Cancel"
|
||||
lavhost_update: "<emoji document_id=5469986291380657759>✌️</emoji> <b>Your {} is updating...</b>"
|
||||
full_success: "<emoji document_id=6028215594707324419>👍</emoji> <b>Userbot is fully loaded! {}</b>\n<i>Full restart took {}s</i>"
|
||||
ub_stop: "Your {emoji} has been stopped"
|
||||
secure_boot_complete: "<emoji document_id=5472308992514464048>🔐</emoji> <b>Secure boot completed! {}</b>\n<i>Restart took {}s</i>"
|
||||
invalid_args: "<emoji document_id=5210952531676504517>🚫</emoji> <b>You must provide number of commits to rollback!</b>"
|
||||
rollback_too_far: "<emoji document_id=5210952531676504517>🚫</emoji> <b>You're rolling back too far!</b>"
|
||||
|
|
|
@ -379,6 +379,7 @@ updater:
|
|||
installing: "<emoji document_id=5208622108191506906>🕗</emoji> <b>Установка обновлений...</b>"
|
||||
success: "<emoji document_id=5208661316947955396>⏱</emoji> <b>Перезагрузка успешна! {}</b>\n<i>Но модули еще загружаются...</i>\n<i>Перезагрузка заняла {} сек</i>"
|
||||
full_success: "<emoji document_id=6028215594707324419>👍</emoji> <b>Юзербот полностью загружен! {}</b>\n<i>Полная перезагрузка заняла {} сек.</i>"
|
||||
ub_stop: "Твоя {emoji} остановлена!"
|
||||
secure_boot_complete: "<emoji document_id=5472308992514464048>🔐</emoji> <b>Безопасная загрузка завершена! {}</b>\n<i>Перезагрузка заняла {} сек</i>"
|
||||
origin_cfg_doc: "Ссылка, из которой будут загружаться обновления"
|
||||
btn_restart: "🔄 Перезагрузиться"
|
||||
|
|
|
@ -379,6 +379,7 @@ updater:
|
|||
installing: "<emoji document_id=5208622108191506906>🕗</emoji> <b>Встановлення оновлень...</b>"
|
||||
success: "<emoji document_id=5208661316947955396>⏱</emoji> <b>Перезавантаження успішне! {}</b>\n<i>Але модулі ще завантажуються...</i>\n<i>Перезавантаження зайняло {} сек</i>"
|
||||
full_success: "<emoji document_id=6028215594707324419>👍</emoji> <b>Юзербот повністю завантажений! {}</b>\n<i>Повне перезавантаження зайняло {} сек</i>"
|
||||
ub_stop: "Твоя {} остановлена!"
|
||||
secure_boot_complete: "<emoji document_id=5472308992514464048>🔐</emoji> <b>Безпечне завантаження завершено! {}</b>\n<i>Перезавантаження зайняло {} сек</i>"
|
||||
origin_cfg_doc: "Посилання, з якого будуть завантажуватися оновлення"
|
||||
btn_restart: "🔄 Перезавнтаження"
|
||||
|
|
|
@ -27,6 +27,11 @@ from logging.handlers import RotatingFileHandler
|
|||
import herokutl
|
||||
from aiogram.exceptions import TelegramNetworkError
|
||||
from herokutl.errors import PersistentTimestampOutdatedError
|
||||
from herokutl.errors.rpcbaseerrors import
|
||||
(
|
||||
ServerError,
|
||||
RPCError
|
||||
)
|
||||
|
||||
from . import utils
|
||||
from .tl_cache import CustomTelegramClient
|
||||
|
@ -74,8 +79,14 @@ def override_text(exception: Exception) -> typing.Optional[str]:
|
|||
"""Returns error-specific description if available, else `None`"""
|
||||
if isinstance(exception, (TelegramNetworkError, asyncio.exceptions.TimeoutError)):
|
||||
return "✈️ <b>You have problems with internet connection on your server.</b>"
|
||||
elif isinstance(exception, PersistentTimestampOutdatedError):
|
||||
if isinstance(exception, PersistentTimestampOutdatedError):
|
||||
return "✈️ <b>Telegram has problems with their datacenters.</b>"
|
||||
if isinstance(exception, ServerError):
|
||||
return "📡 <b>Telegram servers are currently experiencing issues. Please try again later.</b>"
|
||||
if isinstance(exception, RPCError) and "TRANSLATION_TIMEOUT" in str(exception):
|
||||
return ("🕓 <b>Telegram translation service timed out. Please try again later.</b>")
|
||||
if isinstance(exception, ModuleNotFoundError):
|
||||
return f"📦 {traceback.format_exception_only(type(exception), exception)[0].split(':')[1].strip()}"
|
||||
|
||||
return None
|
||||
|
||||
|
|
|
@ -137,71 +137,76 @@ class HerokuWebMod(loader.Module):
|
|||
|
||||
@loader.command()
|
||||
async def addacc(self, message: Message):
|
||||
id = utils.get_args(message)
|
||||
if not id:
|
||||
reply = await message.get_reply_message()
|
||||
id = reply.sender_id if reply else None
|
||||
|
||||
if "JAMHOST" in os.environ or "HIKKAHOST" in os.environ or "LAVHOST" in os.environ or "SHARKHOST" in os.environ:
|
||||
await utils.answer(message, self.strings["host_denied"])
|
||||
else:
|
||||
id = id[0]
|
||||
|
||||
user = None
|
||||
if id:
|
||||
try:
|
||||
id = int(id)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
try:
|
||||
user = await self._client.get_entity(id)
|
||||
except Exception as e:
|
||||
logger.error(f"Error while fetching user: {e}")
|
||||
id = utils.get_args(message)
|
||||
if not id:
|
||||
reply = await message.get_reply_message()
|
||||
id = reply.sender_id if reply else None
|
||||
else:
|
||||
id = id[0]
|
||||
|
||||
user = None
|
||||
if id:
|
||||
try:
|
||||
id = int(id)
|
||||
except ValueError:
|
||||
pass
|
||||
|
||||
if not user or not isinstance(user, User) or user.bot:
|
||||
await utils.answer(
|
||||
message,
|
||||
self.strings("invalid_target")
|
||||
)
|
||||
return
|
||||
try:
|
||||
user = await self._client.get_entity(id)
|
||||
except Exception as e:
|
||||
logger.error(f"Error while fetching user: {e}")
|
||||
|
||||
if not user or not isinstance(user, User) or user.bot:
|
||||
await utils.answer(
|
||||
message,
|
||||
self.strings("invalid_target")
|
||||
)
|
||||
return
|
||||
|
||||
if user.id == self._client.tg_id:
|
||||
await utils.answer(
|
||||
message,
|
||||
self.strings("cant_add_self")
|
||||
)
|
||||
return
|
||||
if user.id == self._client.tg_id:
|
||||
await utils.answer(
|
||||
message,
|
||||
self.strings("cant_add_self")
|
||||
)
|
||||
return
|
||||
|
||||
if "force_insecure" in message.text.lower():
|
||||
await self._inline_login(message, user)
|
||||
if "force_insecure" in message.text.lower():
|
||||
await self._inline_login(message, user)
|
||||
|
||||
try:
|
||||
if not await self.inline.form(
|
||||
self.strings("add_user_confirm").format(
|
||||
try:
|
||||
if not await self.inline.form(
|
||||
self.strings("add_user_confirm").format(
|
||||
utils.escape_html(user.first_name),
|
||||
user.id,
|
||||
),
|
||||
message=message,
|
||||
reply_markup=[
|
||||
{
|
||||
"text": self.strings("btn_yes"),
|
||||
"callback": self._inline_login,
|
||||
"args": (user,),
|
||||
},
|
||||
{"text": self.strings("btn_no"), "action": "close"},
|
||||
],
|
||||
photo="",
|
||||
):
|
||||
raise Exception
|
||||
except Exception:
|
||||
await utils.answer(
|
||||
message,
|
||||
self.strings("add_user_insecure").format(
|
||||
utils.escape_html(user.first_name),
|
||||
user.id,
|
||||
),
|
||||
message=message,
|
||||
reply_markup=[
|
||||
{
|
||||
"text": self.strings("btn_yes"),
|
||||
"callback": self._inline_login,
|
||||
"args": (user,),
|
||||
},
|
||||
{"text": self.strings("btn_no"), "action": "close"},
|
||||
],
|
||||
photo="",
|
||||
):
|
||||
raise Exception
|
||||
except Exception:
|
||||
await utils.answer(
|
||||
message,
|
||||
self.strings("add_user_insecure").format(
|
||||
utils.escape_html(user.first_name),
|
||||
user.id,
|
||||
utils.escape_html(self.get_prefix()),
|
||||
user.id,
|
||||
utils.escape_html(self.get_prefix()),
|
||||
user.id,
|
||||
)
|
||||
)
|
||||
)
|
||||
return
|
||||
return
|
||||
|
||||
async def _inline_login(self, call: typing.Union[Message, InlineCall], user: User, after_fail: bool = False):
|
||||
reply_markup = [
|
||||
|
|
|
@ -34,6 +34,7 @@ import logging
|
|||
import os
|
||||
import re
|
||||
import typing
|
||||
import signal
|
||||
|
||||
import herokutl
|
||||
|
||||
|
@ -363,8 +364,8 @@ class TerminalMod(loader.Module):
|
|||
if needsswitch:
|
||||
cmd = " ".join([cmd.split(" ", 1)[0], "-S", cmd.split(" ", 1)[1]])
|
||||
|
||||
sproc = await asyncio.create_subprocess_shell(
|
||||
cmd,
|
||||
sproc = await asyncio.create_subprocess_exec(
|
||||
"/bin/bash", "-c", cmd,
|
||||
stdin=asyncio.subprocess.PIPE,
|
||||
stdout=asyncio.subprocess.PIPE,
|
||||
stderr=asyncio.subprocess.PIPE,
|
||||
|
@ -404,12 +405,11 @@ class TerminalMod(loader.Module):
|
|||
|
||||
if hash_msg(await message.get_reply_message()) in self.activecmds:
|
||||
try:
|
||||
kill_pids = self.activecmds[hash_msg(await message.get_reply_message())]
|
||||
if "-f" not in utils.get_args_raw(message):
|
||||
self.activecmds[
|
||||
hash_msg(await message.get_reply_message())
|
||||
].terminate()
|
||||
os.killpg(kill_pids.pid, signal.SIGTERM)
|
||||
else:
|
||||
self.activecmds[hash_msg(await message.get_reply_message())].kill()
|
||||
os.killpg(kill_pids.pid, signal.SIGKILL)
|
||||
except Exception:
|
||||
logger.exception("Killing process failed")
|
||||
await utils.answer(message, self.strings("kill_fail"))
|
||||
|
|
|
@ -697,10 +697,8 @@ class UpdaterMod(loader.Module):
|
|||
"""| stops your userbot"""
|
||||
|
||||
if "LAVHOST" in os.environ:
|
||||
await utils.answer(message, self.strings[" lavhost_stop"])
|
||||
await self.client.send_message("lavhostbot", "⏹ Stop")
|
||||
|
||||
await utils.answer(message, self.strings["ub_stop"].format(emoji=self.get_platform_emoji()))
|
||||
await self.client.send.message("lavhostbot", "⏹ Stop")
|
||||
else:
|
||||
await utils.answer(message, self.strings[" ub_stop"])
|
||||
await utils.answer(message, self.strings["ub_stop"].format(emoji=self.get_platform_emoji())_
|
||||
exit()
|
||||
|
||||
|
|
Loading…
Reference in New Issue