From bbfb732f853d5d3a394ff41321d7bf23d1f0e827 Mon Sep 17 00:00:00 2001 From: Ashinch Date: Thu, 1 Jul 2021 17:48:18 +0800 Subject: [PATCH] Improved unsupported message type alert --- efb_qq_plugin_go_cqhttp/GoCQHttp.py | 6 +++--- efb_qq_plugin_go_cqhttp/MsgDecorator.py | 7 +++++++ 2 files changed, 10 insertions(+), 3 deletions(-) diff --git a/efb_qq_plugin_go_cqhttp/GoCQHttp.py b/efb_qq_plugin_go_cqhttp/GoCQHttp.py index 6ea1f1c..62976c9 100644 --- a/efb_qq_plugin_go_cqhttp/GoCQHttp.py +++ b/efb_qq_plugin_go_cqhttp/GoCQHttp.py @@ -560,9 +560,9 @@ class GoCQHttp(BaseClient): try: func = getattr(self.msg_decorator, 'qq_{}_wrapper'.format(msg_type)) except AttributeError: - self.deliver_alert_to_master(self._(f"Unsupported message type: {msg_type}")) - self.logger.error(f"Unsupported message type: {msg_type}") - return [] + msg = f"Unsupported message type: {msg_type}" + self.logger.error(msg) + return self.msg_decorator.qq_unsupported_wrapper(msg) else: return func(*args) diff --git a/efb_qq_plugin_go_cqhttp/MsgDecorator.py b/efb_qq_plugin_go_cqhttp/MsgDecorator.py index 087156b..e94e41b 100644 --- a/efb_qq_plugin_go_cqhttp/MsgDecorator.py +++ b/efb_qq_plugin_go_cqhttp/MsgDecorator.py @@ -271,3 +271,10 @@ class QQMsgProcessor: mime=mime ) return [efb_msg] + + def qq_unsupported_wrapper(self, data, chat: Chat = None): + efb_msg = Message( + type=MsgType.Unsupported, + text=data + ) + return [efb_msg]