feat(commands/tools/clear): add --contains

This commit is contained in:
Ryan 2024-12-30 22:19:44 -05:00
parent 025e5fc653
commit d81821bc51
Signed by: ErrorNoInternet
GPG Key ID: 2486BFB7B1E6A4A3

View File

@ -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: