Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Let !!/allspam accept a custom close reason #12818

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 16 additions & 2 deletions chatcommands.py
Original file line number Diff line number Diff line change
Expand Up @@ -2112,14 +2112,21 @@ def report(msg, args, alias_used="report"):

# noinspection PyIncorrectDocstring,PyUnusedLocal
@command(str, whole_msg=True, privileged=True, aliases=['reportuser'])
def allspam(msg, url):
def allspam(msg, args):
"""
Reports all of a user's posts as spam

Optionally allows for a custom reason, which should follow the URL and be
enclosed by double quotes.

:param msg:
:param url: A user profile URL
:param args:
:return:
"""

argsraw = args.split(' "', 1)
url = argsraw[0]

crn, wait = can_report_now(msg.owner.id, msg._client.host)
if not crn:
raise CmdException("You can execute the !!/allspam command again in {} seconds. "
Expand Down Expand Up @@ -2220,7 +2227,14 @@ def allspam(msg, url):
if len(user_posts) > 15:
raise CmdException("The specified user has an abnormally high number of spam posts. Please consider flagging "
"for moderator attention, otherwise use !!/report on the posts individually.")

why_info = u"User manually reported by *{}* in room *{}*.\n".format(msg.owner.name, msg.room.name)
try:
custom_reason = argsraw[1][:-1] if argsraw[1].endswith('"') else argsraw[1]
why_info += "Reason: {}".format(custom_reason)
except IndexError:
pass

# Handle all posts
for index, post in enumerate(user_posts, start=1):
batch = ""
Expand Down