From c16a089c4259327f568d78cfc88d53dcb9e42363 Mon Sep 17 00:00:00 2001 From: Midgard Date: Sat, 7 Aug 2021 19:23:14 +0200 Subject: [PATCH] Remove functionality that is broken in the API --- mmcli.py | 10 +--------- 1 file changed, 1 insertion(+), 9 deletions(-) diff --git a/mmcli.py b/mmcli.py index 9628035..5aa6a00 100755 --- a/mmcli.py +++ b/mmcli.py @@ -328,20 +328,13 @@ def status(mm_api: mattermost.MMApi, cmdline_args): if not cmdline_args.status: raise ValueError("No status selected") - until = None - if cmdline_args.until: - if cmdline_args.status != "dnd": - raise ValueError("--until works only with --dnd due to an API limitation") - until = parse_datetime_to_utc(cmdline_args.until) - # This API endpoint requires the user ID to be passed explicitly in the request body, # duplicating the info in the URL. But "me" does not suffice here. my_user_id = mm_api.get_user()["id"] mm_api._put(f"/v4/users/me/status", data={ "user_id": my_user_id, - "status": cmdline_args.status, - "dnd_end_time": int(until.timestamp()) if until else None + "status": cmdline_args.status }) @@ -472,7 +465,6 @@ Hint: JSON output can be filtered on the command line with jq(1). parser_status.add_argument("--away", dest="status", action="store_const", const="away", help="Set status to away") parser_status.add_argument("--dnd", dest="status", action="store_const", const="dnd", help="Set status to 'do not disturb'") parser_status.add_argument("--offline", dest="status", action="store_const", const="offline", help="Set status to offline") - parser_status.add_argument("--until", help="Datetime of when to clear the status (only for --dnd)") parser_customstatus = subparsers.add_parser("customstatus", help="update custom user status (emoji and message)")