Improved unsupported message type alert

This commit is contained in:
Ashinch 2021-07-01 17:48:18 +08:00 committed by XYenon
parent ffcb564d1a
commit bbfb732f85
2 changed files with 10 additions and 3 deletions

View File

@ -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)

View File

@ -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]