From b39d608ae2dce5e1c2ad8e09e9d5e525f0da4966 Mon Sep 17 00:00:00 2001 From: Someone Date: Wed, 19 Oct 2022 23:00:52 +0200 Subject: [PATCH] modules/DialogManagedReport.py --- modules/DialogManagedReport.py | 35 ++++++++++++++++++++++++++++------ 1 file changed, 29 insertions(+), 6 deletions(-) diff --git a/modules/DialogManagedReport.py b/modules/DialogManagedReport.py index 99eeee1..7be68e5 100644 --- a/modules/DialogManagedReport.py +++ b/modules/DialogManagedReport.py @@ -16,7 +16,7 @@ class DialogManagedReport(AbstractCommand): CONFIG = {"display_name": "somebot-command", "auto_complete": True, "auto_complete_hint": " []", } - 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): @@ -51,12 +51,35 @@ class DialogManagedReport(AbstractCommand): "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, }] } @@ -70,4 +93,4 @@ class DialogManagedReport(AbstractCommand): 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```") -- 2.43.0