Skip to content

Commit

Permalink
Implement !!/scan-time and !!/scan-force-time
Browse files Browse the repository at this point in the history
autopull
  • Loading branch information
makyen committed Oct 27, 2024
1 parent c67bbf7 commit 82d6711
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion chatcommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -2075,7 +2075,7 @@ def invite(msg, room_id, roles):
# --- Post Responses --- #
# noinspection PyIncorrectDocstring
@command(str, whole_msg=True, privileged=False, give_name=True,
aliases=["scan", "scan-force", "report-force", "report-direct"])
aliases=["scan", "scan-force", "report-force", "report-direct", "scan-time", "scan-force-time"])
def report(msg, args, alias_used="report"):
"""
Report a post (or posts)
Expand All @@ -2093,6 +2093,10 @@ def report(msg, args, alias_used="report"):
"wait 30 seconds after you've reported multiple posts in "
"one go.".format(alias_used, wait))

is_timed = "-time" in alias_used
alias_used = alias_used.replace("-time", "")
start_time = time.time()

alias_used = alias_used or "report"

argsraw = args.split(' "', 1)
Expand Down Expand Up @@ -2122,6 +2126,8 @@ def report(msg, args, alias_used="report"):
if output:
if 1 < len(urls) > output.count("\n") + 1:
add_or_update_multiple_reporter(msg.owner.id, msg._client.host, time.time())
if is_timed:
output += "\nScanning took {} seconds.".format(round(time.time() - start_time, 3))
return output


Expand Down

0 comments on commit 82d6711

Please sign in to comment.