mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-28 08:41:29 +00:00
Adjust filter structure
This commit is contained in:
16
app.py
16
app.py
@ -24,7 +24,6 @@ def _handle_wx_message():
|
||||
|
||||
|
||||
def _main(ctx_msg: dict):
|
||||
_preprocess_ctx_msg(ctx_msg)
|
||||
try:
|
||||
if ctx_msg.get('post_type') != 'receive_message':
|
||||
raise SkipException
|
||||
@ -37,21 +36,6 @@ def _main(ctx_msg: dict):
|
||||
return '', 204
|
||||
|
||||
|
||||
def _preprocess_ctx_msg(ctx_msg: dict):
|
||||
if 'group_uid' in ctx_msg:
|
||||
ctx_msg['group_uid'] = str(ctx_msg['group_uid'])
|
||||
if 'sender_uid' in ctx_msg:
|
||||
ctx_msg['sender_uid'] = str(ctx_msg['sender_uid'])
|
||||
if 'sender_id' in ctx_msg:
|
||||
ctx_msg['sender_id'] = str(ctx_msg['sender_id'])
|
||||
if 'discuss_id' in ctx_msg:
|
||||
ctx_msg['discuss_id'] = str(ctx_msg['discuss_id'])
|
||||
if 'group_id' in ctx_msg:
|
||||
ctx_msg['group_id'] = str(ctx_msg['group_id'])
|
||||
if 'id' in ctx_msg:
|
||||
ctx_msg['id'] = str(ctx_msg['id'])
|
||||
|
||||
|
||||
def _load_filters():
|
||||
filter_mod_files = filter(
|
||||
lambda filename: filename.endswith('.py') and not filename.startswith('_'),
|
||||
|
Reference in New Issue
Block a user