feat(commands/tools/clear): add --delete-command
This commit is contained in:
parent
d78bcc4c69
commit
2c4a0921a7
@ -55,9 +55,21 @@ async def clear(message):
|
||||
action="store_true",
|
||||
help="delete messages with reactions",
|
||||
)
|
||||
parser.add_argument(
|
||||
"-d",
|
||||
"--delete-command",
|
||||
action="store_true",
|
||||
help="delete the command message as well",
|
||||
)
|
||||
if not (args := await parser.parse_args(message, tokens)):
|
||||
return
|
||||
|
||||
if args.delete_command:
|
||||
try:
|
||||
await message.delete()
|
||||
except:
|
||||
pass
|
||||
|
||||
regex = None
|
||||
if r := args.regex:
|
||||
regex = re.compile(r, re.IGNORECASE if args.case_insensitive else 0)
|
||||
@ -83,6 +95,7 @@ async def clear(message):
|
||||
)
|
||||
)
|
||||
|
||||
if not args.delete_command:
|
||||
try:
|
||||
await utils.reply(
|
||||
message,
|
||||
|
Loading…
x
Reference in New Issue
Block a user