kopia lustrzana https://github.com/ihabunek/toot
Added toot list_remove_account command
rodzic
80f05e8147
commit
2e0f2548e6
|
@ -559,5 +559,5 @@ def add_accounts_to_list(app, user, list_id, account_ids):
|
||||||
|
|
||||||
def remove_accounts_from_list(app, user, list_id, account_ids):
|
def remove_accounts_from_list(app, user, list_id, account_ids):
|
||||||
url = f"/api/v1/lists/{list_id}/accounts"
|
url = f"/api/v1/lists/{list_id}/accounts"
|
||||||
json = {'account_ids[]': account_ids}
|
json = {'account_ids': account_ids}
|
||||||
return http.delete(app, user, url, json=json)
|
return http.delete(app, user, url, json=json)
|
||||||
|
|
|
@ -462,6 +462,22 @@ def list_add_account(app, user, args):
|
||||||
print_out(f"<red>{ex}</red>")
|
print_out(f"<red>{ex}</red>")
|
||||||
|
|
||||||
|
|
||||||
|
def list_remove_account(app, user, args):
|
||||||
|
list_id = args.id if args.id else api.find_list_id(app, user, args.title)
|
||||||
|
if not list_id:
|
||||||
|
print_out("<red>List not found</red>")
|
||||||
|
return
|
||||||
|
account = find_account(app, user, args.account)
|
||||||
|
if not account:
|
||||||
|
print_out("<red>Account not found</red>")
|
||||||
|
return
|
||||||
|
try:
|
||||||
|
api.remove_accounts_from_list(app, user, list_id, [account['id']])
|
||||||
|
print_out(f"<green>✓ Removed account \"{args.account}\"</green>")
|
||||||
|
except Exception as ex:
|
||||||
|
print_out(f"<red>{ex}</red>")
|
||||||
|
|
||||||
|
|
||||||
def mute(app, user, args):
|
def mute(app, user, args):
|
||||||
account = find_account(app, user, args.account)
|
account = find_account(app, user, args.account)
|
||||||
api.mute(app, user, account['id'])
|
api.mute(app, user, account['id'])
|
||||||
|
|
|
@ -798,6 +798,25 @@ LIST_COMMANDS = [
|
||||||
],
|
],
|
||||||
require_auth=True,
|
require_auth=True,
|
||||||
),
|
),
|
||||||
|
Command(
|
||||||
|
name="list_remove_account",
|
||||||
|
description="Remove account from list",
|
||||||
|
arguments=[
|
||||||
|
(["--id"], {
|
||||||
|
"type": str,
|
||||||
|
"help": "ID of the list"
|
||||||
|
}),
|
||||||
|
(["--title"], {
|
||||||
|
"type": str,
|
||||||
|
"help": "title of the list"
|
||||||
|
}),
|
||||||
|
(["--account"], {
|
||||||
|
"type": str,
|
||||||
|
"help": "Account to remove"
|
||||||
|
}),
|
||||||
|
],
|
||||||
|
require_auth=True,
|
||||||
|
),
|
||||||
]
|
]
|
||||||
COMMAND_GROUPS = [
|
COMMAND_GROUPS = [
|
||||||
("Authentication", AUTH_COMMANDS),
|
("Authentication", AUTH_COMMANDS),
|
||||||
|
|
Ładowanie…
Reference in New Issue