|
|
@@ -43,6 +43,7 @@ from actions import (
|
|
|
run,
|
|
|
)
|
|
|
from utils import (
|
|
|
+ Command,
|
|
|
make_temporary_filename,
|
|
|
make_cache_filename,
|
|
|
parse_kind,
|
|
|
@@ -543,6 +544,15 @@ async def run_handler(bot, event, command):
|
|
|
await event.reply("<Telegram не смог декодировать текст сообщения>")
|
|
|
|
|
|
|
|
|
+async def bash_handler(bot, event, command):
|
|
|
+ try:
|
|
|
+ _, _, result = await run(f"bash {command.args_string}")
|
|
|
+
|
|
|
+ await event.reply(result)
|
|
|
+ except (ValueError, MessageEmptyError):
|
|
|
+ await event.reply("<Telegram не смог декодировать текст сообщения>")
|
|
|
+
|
|
|
+
|
|
|
async def sylvy_handler(bot, event, command):
|
|
|
if command.argc < 1:
|
|
|
await event.reply("Пожалуйста, не оставляйте ввод пустым!")
|
|
|
@@ -1120,7 +1130,7 @@ async def wand_handler(bot, event, command):
|
|
|
is_document = True
|
|
|
|
|
|
if media is None:
|
|
|
- image = b"\x89WSP\r\n\x1a\n" + pack("!BHHBBBB", 0x63, 128, 128, 0, 0, 0, 0)
|
|
|
+ image = b"\x89WSP\r\n\x1a\n" + pack("!BHHBBBB", 0x63, 1, 1, 0, 0, 0, 0)
|
|
|
is_document = True
|
|
|
is_wsp = True
|
|
|
else:
|
|
|
@@ -1157,7 +1167,7 @@ async def wand_handler(bot, event, command):
|
|
|
force_document=is_document,
|
|
|
)
|
|
|
|
|
|
-
|
|
|
+_bash_handler = Handler(bash_handler, is_public=True)
|
|
|
_wand_handler = Handler(wand_handler, is_public=True)
|
|
|
|
|
|
COMMANDS = {
|
|
|
@@ -1176,6 +1186,8 @@ COMMANDS = {
|
|
|
# "vpn": Handler(vpn_handler),
|
|
|
"sylvy": Handler(sylvy_handler, is_public=True),
|
|
|
"run": Handler(run_handler, is_public=True),
|
|
|
+ "bash": _bash_handler,
|
|
|
+ "sh": _bash_handler,
|
|
|
"say": Handler(say_handler, is_public=True),
|
|
|
"roll": Handler(roll_handler, is_public=True),
|
|
|
"chess": _chess_handler,
|