feat(commands/tools/clear): add --ignore-ids
This commit is contained in:
parent
78f2d0a568
commit
7a400da1ee
@ -60,6 +60,13 @@ async def clear(message):
|
|||||||
action="store_true",
|
action="store_true",
|
||||||
help="delete the command message as well",
|
help="delete the command message as well",
|
||||||
)
|
)
|
||||||
|
parser.add_argument(
|
||||||
|
"-I",
|
||||||
|
"--ignore-ids",
|
||||||
|
type=int,
|
||||||
|
action="append",
|
||||||
|
help="ignore messages with this id",
|
||||||
|
)
|
||||||
if not (args := await parser.parse_args(message, tokens)):
|
if not (args := await parser.parse_args(message, tokens)):
|
||||||
return
|
return
|
||||||
|
|
||||||
@ -74,6 +81,8 @@ async def clear(message):
|
|||||||
regex = re.compile(r, re.IGNORECASE if args.case_insensitive else 0)
|
regex = re.compile(r, re.IGNORECASE if args.case_insensitive else 0)
|
||||||
|
|
||||||
def check(m):
|
def check(m):
|
||||||
|
if m.id in args.ignore_ids:
|
||||||
|
return False
|
||||||
c = []
|
c = []
|
||||||
if regex:
|
if regex:
|
||||||
c.append(regex.search(m.content))
|
c.append(regex.search(m.content))
|
||||||
|
Loading…
x
Reference in New Issue
Block a user