增加新的接收信息装饰器, 并支持自定义函数接受信息类型, 增加防撤回
This commit is contained in:
parent
f321ed6d85
commit
15a6264f0d
@ -98,6 +98,7 @@ def main():
|
|||||||
撤回消息函数装饰器
|
撤回消息函数装饰器
|
||||||
"""
|
"""
|
||||||
print(msg)
|
print(msg)
|
||||||
|
print(msg.get_revoke_msg())
|
||||||
|
|
||||||
def judge(msg: WxMsg):
|
def judge(msg: WxMsg):
|
||||||
"""
|
"""
|
||||||
|
@ -83,6 +83,7 @@ def main():
|
|||||||
撤回消息函数装饰器
|
撤回消息函数装饰器
|
||||||
"""
|
"""
|
||||||
print(msg)
|
print(msg)
|
||||||
|
print(msg.get_revoke_msg())
|
||||||
|
|
||||||
def judge(msg: WxMsg):
|
def judge(msg: WxMsg):
|
||||||
"""
|
"""
|
||||||
|
@ -144,8 +144,6 @@ class Register(Event):
|
|||||||
raise NotImplementedError
|
raise NotImplementedError
|
||||||
|
|
||||||
def group_changed_register(self,
|
def group_changed_register(self,
|
||||||
isGroup: bool = False,
|
|
||||||
isDivision: bool = False,
|
|
||||||
isPyq: bool = False,
|
isPyq: bool = False,
|
||||||
allow_other_receive: bool = True):
|
allow_other_receive: bool = True):
|
||||||
"""
|
"""
|
||||||
|
@ -79,7 +79,9 @@ def _processing_async_func(self,
|
|||||||
return await func(bot, message)
|
return await func(bot, message)
|
||||||
except:
|
except:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
||||||
return __async_func
|
return __async_func
|
||||||
|
|
||||||
return _async_func
|
return _async_func
|
||||||
|
|
||||||
|
|
||||||
@ -109,7 +111,9 @@ def _processing_universal_func(self,
|
|||||||
return func(bot, message)
|
return func(bot, message)
|
||||||
except:
|
except:
|
||||||
traceback.print_exc()
|
traceback.print_exc()
|
||||||
|
|
||||||
return universal_func
|
return universal_func
|
||||||
|
|
||||||
return _universal_func
|
return _universal_func
|
||||||
|
|
||||||
|
|
||||||
@ -144,8 +148,6 @@ def revoke_message_register(self,
|
|||||||
|
|
||||||
|
|
||||||
def group_changed_register(self,
|
def group_changed_register(self,
|
||||||
isGroup: bool = False,
|
|
||||||
isDivision: bool = False,
|
|
||||||
isPyq: bool = False,
|
isPyq: bool = False,
|
||||||
allow_other_receive: bool = True):
|
allow_other_receive: bool = True):
|
||||||
def judge_msg(msg):
|
def judge_msg(msg):
|
||||||
@ -154,9 +156,9 @@ def group_changed_register(self,
|
|||||||
return True
|
return True
|
||||||
return False
|
return False
|
||||||
|
|
||||||
return self._processing_async_func(isGroup,
|
return self._processing_async_func(isPyq=isPyq,
|
||||||
isDivision,
|
isGroup=True,
|
||||||
isPyq,
|
isDivision=True,
|
||||||
register_name='groupChanged',
|
register_name='groupChanged',
|
||||||
allow_other_receive=allow_other_receive,
|
allow_other_receive=allow_other_receive,
|
||||||
judge_msg=judge_msg)
|
judge_msg=judge_msg)
|
||||||
|
@ -9,7 +9,7 @@ class messageList(list):
|
|||||||
super(messageList, self).__init__(*args, **kwargs)
|
super(messageList, self).__init__(*args, **kwargs)
|
||||||
self.__isRunning = True
|
self.__isRunning = True
|
||||||
self.__th = None
|
self.__th = None
|
||||||
self.__time_step = 2*60
|
self.__time_step = 3*60
|
||||||
self.__msg_queen = queue.Queue()
|
self.__msg_queen = queue.Queue()
|
||||||
self.start()
|
self.start()
|
||||||
|
|
||||||
|
@ -40,6 +40,8 @@ class WxMsgV2(WxMsg):
|
|||||||
"""
|
"""
|
||||||
|
|
||||||
def __init__(self, msg: WxMsg) -> None:
|
def __init__(self, msg: WxMsg) -> None:
|
||||||
|
self._is_group = msg._is_group
|
||||||
|
self._is_self = msg._is_self
|
||||||
self._type = msg.type
|
self._type = msg.type
|
||||||
self._id = msg.id
|
self._id = msg.id
|
||||||
self._ts = msg.ts
|
self._ts = msg.ts
|
||||||
|
Loading…
Reference in New Issue
Block a user