[WÏP] Add lschan
This commit is contained in:
parent
d8f1538d68
commit
285215b0f6
1 changed files with 19 additions and 0 deletions
19
mmcli.py
19
mmcli.py
|
@ -167,6 +167,21 @@ def login(mm_api, parsed):
|
||||||
assert False
|
assert False
|
||||||
|
|
||||||
|
|
||||||
|
def lschan(mm_api: mattermost.MMApi, parsed):
|
||||||
|
teams = {}
|
||||||
|
|
||||||
|
for team in mm_api.get_teams():
|
||||||
|
teams[team["id"]] = team
|
||||||
|
teams[team["id"]]["joined"] = False
|
||||||
|
|
||||||
|
for team in mm_api._get(f"/v4/users/me/teams"):
|
||||||
|
teams[team["id"]] = team
|
||||||
|
teams[team["id"]]["joined"] = True
|
||||||
|
|
||||||
|
mm_api.get_team_channels()
|
||||||
|
mm_api.get_channels_for_user("me")
|
||||||
|
|
||||||
|
|
||||||
def cat(mm_api: mattermost.MMApi, parsed):
|
def cat(mm_api: mattermost.MMApi, parsed):
|
||||||
|
|
||||||
# channels = [
|
# channels = [
|
||||||
|
@ -286,6 +301,7 @@ def str_for_post(attribute, post, parsed):
|
||||||
|
|
||||||
|
|
||||||
ACTIONS = {
|
ACTIONS = {
|
||||||
|
"lschan": {"function": lschan},
|
||||||
"login": {"function": login, "accesstoken_required": False},
|
"login": {"function": login, "accesstoken_required": False},
|
||||||
"cat": {"function": cat},
|
"cat": {"function": cat},
|
||||||
"send": {"function": send},
|
"send": {"function": send},
|
||||||
|
@ -332,6 +348,9 @@ Hint: JSON output can be filtered on the command line with jq(1).
|
||||||
parser_login.add_argument("--password", default=os.getenv(ENVVAR_PASSWORD))
|
parser_login.add_argument("--password", default=os.getenv(ENVVAR_PASSWORD))
|
||||||
parser_login.add_argument("--totp", default=os.getenv(ENVVAR_TOTP))
|
parser_login.add_argument("--totp", default=os.getenv(ENVVAR_TOTP))
|
||||||
|
|
||||||
|
parser_cat = subparsers.add_parser("lschan", help="list channels")
|
||||||
|
parser_cat.add_argument("-f", "--follow", action="store_true", help="keep running, printing changes to channels as they come in")
|
||||||
|
|
||||||
# TODO support multiple channels
|
# TODO support multiple channels
|
||||||
# parser_cat = subparsers.add_parser("cat", help="list messages in channel(s)")
|
# parser_cat = subparsers.add_parser("cat", help="list messages in channel(s)")
|
||||||
# parser_cat.add_argument(
|
# parser_cat.add_argument(
|
||||||
|
|
Loading…
Reference in a new issue