CONFIG = {"display_name": "somebot-command", "auto_complete": True,
"auto_complete_hint": "<permalink> [<reason>]",
}
- CONFIG["auto_complete_desc"] = CONFIG["description"] = AbstractCommand.ICON_PRIVATE+"Report a post. Run in same channel. Opens dialog if no reason is given."
+ CONFIG["auto_complete_desc"] = CONFIG["description"] = AbstractCommand.ICON_PRIVATE+"Report given post. Run in same channel. Opens dialog if no reason is given."
def __init__(self, team_id, report_chan_id):
"submit_label":"Report",
"state": post["id"],
"elements":[{
- "display_name": "Reason",
- "placeholder": "Write the reason here.",
+ "display_name": "What's going on?",
"name": "report_reason",
- "type": "textarea",
- "help_text": "The reason is submitted to channel and team admin_as.",
+ "type": "radio",
+ "options": [{
+ "text": "It's annoying or not interesting",
+ "value": "not_interesting"
+ },{
+ "text": "I'm in this post and I don't like it",
+ "value": "im_in_it_and_i_dont_like_it"
+ },{
+ "text": "I think it shouldn't be on Mattermost",
+ "value": "should_not_be_on_mm"
+ },{
+ "text": "It's spam",
+ "value": "spam"
+ },{
+ "text": "Other (Fill in below)",
+ "value": "other"
+ }
+ ],
"optional": False,
+ "default": "other"
+ },{
+ "display_name": "Other reason or additional details",
+ "placeholder": "Write a custom reason or additional details here.",
+ "name": "report_other_reason",
+ "type": "textarea",
+ "help_text": "The report is submitted to channel and team admin_as.",
+ "optional": True,
}]
}
team = self.bot.api.get_team(data["team_id"])
chan = self.bot.api.get_channel(data["channel_id"])
- self.bot.api.create_post(self.report_chan_id, "``AUTODELETE-MONTH`` ``/"+self.TRIGGER+"`` used by ``@"+user["username"]+"`` in ``"+team["name"]+"::"+chan["name"]+"``\n#### Reported post: https://mattermost.fsinf.at/"+team["name"]+"/pl/"+data["state"]+"\nReason:\n```\n"+data["submission"]["report_reason"].strip()+"\n```")
+ self.bot.api.create_post(self.report_chan_id, "``AUTODELETE-MONTH`` ``/"+self.TRIGGER+"`` used by ``@"+user["username"]+"`` in ``"+team["name"]+"::"+chan["name"]+"``\n#### Reported post: https://mattermost.fsinf.at/"+team["name"]+"/pl/"+data["state"]+"\nReason: "+data["submission"]["report_reason"]+"\n```\n"+data["submission"]["report_other_reason"].strip()+"\n```")