mirror of https://github.com/coddrago/Heroku
update scam protection
parent
0864f61f1a
commit
9c1b18ffe4
|
@ -518,6 +518,7 @@ loader:
|
||||||
clearmodules: "🗑 Clear modules"
|
clearmodules: "🗑 Clear modules"
|
||||||
cancel: "🚫 Cancel"
|
cancel: "🚫 Cancel"
|
||||||
overwrite_module: "<emoji document_id=5454225457916420314>😖</emoji> <b>This module attempted to override the core one (</b><code>{}</code><b>)</b>\n\n<emoji document_id=5472146462362048818>💡</emoji><i> Don't report it as bug. It's a security measure to prevent replacing core modules with some junk</i>"
|
overwrite_module: "<emoji document_id=5454225457916420314>😖</emoji> <b>This module attempted to override the core one (</b><code>{}</code><b>)</b>\n\n<emoji document_id=5472146462362048818>💡</emoji><i> Don't report it as bug. It's a security measure to prevent replacing core modules with some junk</i>"
|
||||||
|
scam_module: "<emoji document_id=5454225457916420314>😖</emoji> <b>The module</b> <code>{name}</code> <b>is a scam, please report it to the support group (</b><code>{prefix}support</code><b>)</b>\n\n<tg-spoiler><i>Protection has stopped its loading.</i></tg-spoiler>"
|
||||||
overwrite_command: "<emoji document_id=5454225457916420314>😖</emoji> <b>This module attempted to override the core command (</b><code>{}{}</code><b>)</b>\n\n<emoji document_id=5472146462362048818>💡</emoji><i> Don't report it as bug. It's a security measure to prevent replacing core modules' commands with some junk</i>"
|
overwrite_command: "<emoji document_id=5454225457916420314>😖</emoji> <b>This module attempted to override the core command (</b><code>{}{}</code><b>)</b>\n\n<emoji document_id=5472146462362048818>💡</emoji><i> Don't report it as bug. It's a security measure to prevent replacing core modules' commands with some junk</i>"
|
||||||
unload_core: "<emoji document_id=5454225457916420314>😖</emoji> <b>You can't unload core module</b> <code>{}</code><b></b>\n\n<emoji document_id=5472146462362048818>💡</emoji><i> Don't report it as bug. It's a security measure to prevent replacing core modules with some junk</i>"
|
unload_core: "<emoji document_id=5454225457916420314>😖</emoji> <b>You can't unload core module</b> <code>{}</code><b></b>\n\n<emoji document_id=5472146462362048818>💡</emoji><i> Don't report it as bug. It's a security measure to prevent replacing core modules with some junk</i>"
|
||||||
cannot_unload_lib: "<emoji document_id=5454225457916420314>😖</emoji> <b>You can't unload library</b>"
|
cannot_unload_lib: "<emoji document_id=5454225457916420314>😖</emoji> <b>You can't unload library</b>"
|
||||||
|
|
|
@ -488,6 +488,7 @@ loader:
|
||||||
clearmodules: "🗑 Выгрузить модули"
|
clearmodules: "🗑 Выгрузить модули"
|
||||||
cancel: "🚫 Отмена"
|
cancel: "🚫 Отмена"
|
||||||
overwrite_module: "<emoji document_id=5454225457916420314>😖</emoji> <b>Этот модуль попытался перезаписать встроенный (</b><code>{}</code><b>)</b>\n\n<emoji document_id=5472146462362048818>💡</emoji><i> Это не ошибка, а мера безопасности, требуемая для предотвращения замены встроенных модулей всяким хламом. Не сообщайте о ней в support чате</i>"
|
overwrite_module: "<emoji document_id=5454225457916420314>😖</emoji> <b>Этот модуль попытался перезаписать встроенный (</b><code>{}</code><b>)</b>\n\n<emoji document_id=5472146462362048818>💡</emoji><i> Это не ошибка, а мера безопасности, требуемая для предотвращения замены встроенных модулей всяким хламом. Не сообщайте о ней в support чате</i>"
|
||||||
|
scam_module: "<emoji document_id=5454225457916420314>😖</emoji> <b>Модуль</b> <code>{name}</code> <b>является скамом, сообщите о нём, пожалуйста, в группу поддержки (</b><code>{prefix}support</code><b>)</b>\n\n<tg-spoiler><i>Защита остановила его загрузку.</i></tg-spoiler>"
|
||||||
overwrite_command: "<emoji document_id=5454225457916420314>😖</emoji> <b>Этот модуль попытался перезаписать встроенную команду (</b><code>{}</code><b>)</b>\n\n<emoji document_id=5472146462362048818>💡</emoji><i> Это не ошибка, а мера безопасности, требуемая для предотвращения замены команд встроенных модулей всяким хламом. Не сообщайте о ней в support чате</i>"
|
overwrite_command: "<emoji document_id=5454225457916420314>😖</emoji> <b>Этот модуль попытался перезаписать встроенную команду (</b><code>{}</code><b>)</b>\n\n<emoji document_id=5472146462362048818>💡</emoji><i> Это не ошибка, а мера безопасности, требуемая для предотвращения замены команд встроенных модулей всяким хламом. Не сообщайте о ней в support чате</i>"
|
||||||
unload_core: "<emoji document_id=5454225457916420314>😖</emoji> <b>Ты не можешь выгрузить встроенный модуль</b> <code>{}</code><b></b>\n\n<emoji document_id=5472146462362048818>💡</emoji><i> Это не ошибка, а мера безопасности, требуемая для предотвращения замены встроенных модулей всяким хламом. Не сообщайте о ней в support чате</i>"
|
unload_core: "<emoji document_id=5454225457916420314>😖</emoji> <b>Ты не можешь выгрузить встроенный модуль</b> <code>{}</code><b></b>\n\n<emoji document_id=5472146462362048818>💡</emoji><i> Это не ошибка, а мера безопасности, требуемая для предотвращения замены встроенных модулей всяким хламом. Не сообщайте о ней в support чате</i>"
|
||||||
cannot_unload_lib: "<emoji document_id=5454225457916420314>😖</emoji> <b>Ты не можешь выгрузить библиотеку</b>"
|
cannot_unload_lib: "<emoji document_id=5454225457916420314>😖</emoji> <b>Ты не можешь выгрузить библиотеку</b>"
|
||||||
|
|
|
@ -36,6 +36,7 @@ import requests
|
||||||
from herokutl.errors.rpcerrorlist import MediaCaptionTooLongError
|
from herokutl.errors.rpcerrorlist import MediaCaptionTooLongError
|
||||||
from herokutl.tl.functions.channels import JoinChannelRequest
|
from herokutl.tl.functions.channels import JoinChannelRequest
|
||||||
from herokutl.tl.types import Channel, Message, PeerUser
|
from herokutl.tl.types import Channel, Message, PeerUser
|
||||||
|
from herokutl.errors.common import ScamDetectionError
|
||||||
|
|
||||||
from .. import loader, main, utils
|
from .. import loader, main, utils
|
||||||
from .._local_storage import RemoteStorage
|
from .._local_storage import RemoteStorage
|
||||||
|
@ -700,7 +701,7 @@ class LoaderMod(loader.Module):
|
||||||
except CoreOverwriteError as e:
|
except CoreOverwriteError as e:
|
||||||
await core_overwrite(e)
|
await core_overwrite(e)
|
||||||
return
|
return
|
||||||
except loader.LoadError as e:
|
except (loader.LoadError, ScamDetectionError) as e:
|
||||||
with contextlib.suppress(Exception):
|
with contextlib.suppress(Exception):
|
||||||
await self.allmodules.unload_module(instance.__class__.__name__)
|
await self.allmodules.unload_module(instance.__class__.__name__)
|
||||||
|
|
||||||
|
@ -708,13 +709,24 @@ class LoaderMod(loader.Module):
|
||||||
self.allmodules.modules.remove(instance)
|
self.allmodules.modules.remove(instance)
|
||||||
|
|
||||||
if message:
|
if message:
|
||||||
await utils.answer(
|
if isinstance(e, loader.LoadError):
|
||||||
message,
|
await utils.answer(
|
||||||
(
|
message,
|
||||||
"<emoji document_id=5454225457916420314>😖</emoji>"
|
(
|
||||||
f" <b>{utils.escape_html(str(e))}</b>"
|
"<emoji document_id=5454225457916420314>😖</emoji>"
|
||||||
),
|
f" <b>{utils.escape_html(str(e))}</b>"
|
||||||
)
|
),
|
||||||
|
)
|
||||||
|
elif isinstance(e, ScamDetectionError):
|
||||||
|
await utils.answer(
|
||||||
|
message,
|
||||||
|
(
|
||||||
|
self.strings('scam_module').format(
|
||||||
|
name=instance.__class__.__name__,
|
||||||
|
prefix=self.get_prefix(),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
return
|
return
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
logger.exception("Loading external module failed due to %s", e)
|
logger.exception("Loading external module failed due to %s", e)
|
||||||
|
@ -770,7 +782,7 @@ class LoaderMod(loader.Module):
|
||||||
except CoreOverwriteError as e:
|
except CoreOverwriteError as e:
|
||||||
await core_overwrite(e)
|
await core_overwrite(e)
|
||||||
return
|
return
|
||||||
except loader.LoadError as e:
|
except (loader.LoadError, ScamDetectionError) as e:
|
||||||
with contextlib.suppress(Exception):
|
with contextlib.suppress(Exception):
|
||||||
await self.allmodules.unload_module(instance.__class__.__name__)
|
await self.allmodules.unload_module(instance.__class__.__name__)
|
||||||
|
|
||||||
|
@ -778,13 +790,24 @@ class LoaderMod(loader.Module):
|
||||||
self.allmodules.modules.remove(instance)
|
self.allmodules.modules.remove(instance)
|
||||||
|
|
||||||
if message:
|
if message:
|
||||||
await utils.answer(
|
if isinstance(e, loader.LoadError):
|
||||||
message,
|
await utils.answer(
|
||||||
(
|
message,
|
||||||
"<emoji document_id=5454225457916420314>😖</emoji>"
|
(
|
||||||
f" <b>{utils.escape_html(str(e))}</b>"
|
"<emoji document_id=5454225457916420314>😖</emoji>"
|
||||||
),
|
f" <b>{utils.escape_html(str(e))}</b>"
|
||||||
)
|
),
|
||||||
|
)
|
||||||
|
elif isinstance(e, ScamDetectionError):
|
||||||
|
await utils.answer(
|
||||||
|
message,
|
||||||
|
(
|
||||||
|
self.strings('scam_module').format(
|
||||||
|
name=instance.__class__.__name__,
|
||||||
|
prefix=self.get_prefix(),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
)
|
||||||
return
|
return
|
||||||
except loader.SelfUnload as e:
|
except loader.SelfUnload as e:
|
||||||
logger.debug("Unloading %s, because it raised `SelfUnload`", instance)
|
logger.debug("Unloading %s, because it raised `SelfUnload`", instance)
|
||||||
|
|
Loading…
Reference in New Issue