mirror of
https://github.com/nonebot/nonebot2.git
synced 2025-07-28 08:41:29 +00:00
Add sudo.block
This commit is contained in:
18
filters/intercept_blocked_target_100.py
Normal file
18
filters/intercept_blocked_target_100.py
Normal file
@ -0,0 +1,18 @@
|
||||
"""
|
||||
This filter intercepts messages from blocked targets (blocked using sudo.block command).
|
||||
"""
|
||||
|
||||
from commands import sudo
|
||||
from filter import as_filter
|
||||
from little_shit import get_target
|
||||
|
||||
|
||||
@as_filter(priority=100)
|
||||
def _filter(ctx_msg):
|
||||
target = get_target(ctx_msg)
|
||||
if not target:
|
||||
return True
|
||||
|
||||
if target in sudo.block_list('', ctx_msg, internal=True):
|
||||
return False
|
||||
return True
|
Reference in New Issue
Block a user