feat(commands/tools/clear): add --contains
This commit is contained in:
parent
025e5fc653
commit
d81821bc51
@ -16,12 +16,19 @@ async def clear(message):
|
||||
type=lambda c: arguments.range_type(c, min=1, max=1000),
|
||||
help="amount of messages to delete",
|
||||
)
|
||||
parser.add_argument(
|
||||
group = parser.add_mutually_exclusive_group()
|
||||
group.add_argument(
|
||||
"-r",
|
||||
"--regex",
|
||||
required=False,
|
||||
help="delete messages with content matching this regex",
|
||||
)
|
||||
group.add_argument(
|
||||
"-c",
|
||||
"--contains",
|
||||
required=False,
|
||||
help="delete messages with content containing this substring",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-i",
|
||||
"--author-id",
|
||||
@ -48,6 +55,8 @@ async def clear(message):
|
||||
c = []
|
||||
if r := args.regex:
|
||||
c.append(re.match(r, m.content))
|
||||
if s := args.contains:
|
||||
c.append(s in m.content)
|
||||
if i := args.author_id:
|
||||
c.append(m.author.id in i)
|
||||
if args.reactions:
|
||||
|
Loading…
x
Reference in New Issue
Block a user