def invite_failure_attachments(email: str, error: str) -> list: attachments = [ { "text": "", "callback_id": "ticket_status", "response_type": "in_channel", "fallback": "", "fields": [ {"title": "Email", "value": f"{email}", "short": True}, {"title": "Error", "value": f"{error}", "short": True}, ], "actions": [ { "name": "status", "text": "Current Status", "type": "select", "selected_options": [ {"text": "Not Started", "value": "notStarted"} ], "options": [ {"text": text, "value": value} for value, text in TICKET_OPTIONS.items() ], } ], }, not_claimed_attachment(), ] return attachments
async def reset_claim(action: Action, app: SirBot): """ Provides basic "unclaim" functionality for use-cases that don't have any other effects. Updates the button back to its initial state """ response = base_response(action) attachments = action["original_message"]["attachments"] for index, attachment in enumerate(attachments): if "callback_id" in attachment and attachment[ "callback_id"] == "claimed": attachments[index] = not_claimed_attachment() response["attachments"] = attachments await app.plugins["slack"].api.query(methods.CHAT_UPDATE, response)
async def slash_report(command: Command, app: SirBot): """ Sends text supplied with the /report command to the moderators channel along with a button to claim the issue """ slack_id = command["user_id"] text = command["text"] slack = app["plugins"]["slack"].api message = f"<@{slack_id}> sent report: {text}" response = { "text": message, "channel": MODERATOR_CHANNEL, "attachments": [not_claimed_attachment()], } await slack.query(methods.CHAT_POST_MESSAGE, response)
async def slash_report(command: Command, app: SirBot): """ Sends text supplied with the /report command to the moderators channel along with a button to claim the issue """ slack_id = command['user_id'] text = command['text'] slack = app["plugins"]["slack"].api message = f'<@{slack_id}> sent report: {text}' response = { 'text': message, 'channel': REPORT_CHANNEL, 'attachments': not_claimed_attachment(), } await slack.query(methods.CHAT_POST_MESSAGE, response)