mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-09-08 04:56:45 +00:00
Add filter support
This commit is contained in:
10
filters/message_logger.py
Normal file
10
filters/message_logger.py
Normal file
@ -0,0 +1,10 @@
|
||||
from filter import add_filter
|
||||
|
||||
|
||||
def _log_message(ctx_msg):
|
||||
print(ctx_msg.get('sender', '')
|
||||
+ (('@' + ctx_msg.get('group')) if ctx_msg.get('type') == 'group_message' else '')
|
||||
+ ': ' + ctx_msg.get('content'))
|
||||
|
||||
|
||||
add_filter(_log_message, 1000)
|
Reference in New Issue
Block a user