From f6b17bb917f1d0e58ce0ca1dfffb7edd6c517e5e Mon Sep 17 00:00:00 2001 From: xtaodada <1344089750@qq.com> Date: Sun, 5 Apr 2020 21:10:47 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=94=A8=20=E5=B0=9D=E8=AF=95=E4=BF=AE?= =?UTF-8?q?=E5=A4=8D=20fbcon=20=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- pagermaid/modules/status.py | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/pagermaid/modules/status.py b/pagermaid/modules/status.py index 912727a..77854d0 100644 --- a/pagermaid/modules/status.py +++ b/pagermaid/modules/status.py @@ -41,7 +41,7 @@ async def tty(context): """ Screenshots a TTY and prints it. """ await context.edit("拍摄帧缓冲控制台的屏幕截图中 . . .") reply_id = context.message.reply_to_msg_id - result = await execute("fbdump | magick - image.png") + result = await execute("fbdump | convert - image.png") if result == "/bin/sh: fbdump: command not found": await context.edit("出错了呜呜呜 ~ 此系统上没有安装 fbdump") remove("image.png") @@ -52,15 +52,17 @@ async def tty(context): return if result == "Failed to open /dev/fb0: Permission denied": await context.edit("出错了呜呜呜 ~ 运行 PagerMaid-Modify 的用户不在视频组中。") - remove("image.png") return - if not await upload_attachment("image.png", context.chat_id, reply_id, + if not await upload_attachment("./image.png", context.chat_id, reply_id, caption="绑定的帧缓冲区的屏幕截图。", preview=False, document=False): - await context.edit("出错了呜呜呜 ~ 由于发生意外错误,导致文件生成失败。") + await context.edit("出错了呜呜呜 ~ 由于发生意外错误,导致文件生成失败。请确保已安装 apt 包 fbcat 和 imagemagick,且你的机器有显卡。") return await context.delete() - remove("image.png") + try: + remove("./image.png") + except: + pass await log("Screenshot of binded framebuffer console taken.")