mirror of
https://github.com/ihabunek/toot
synced 2024-12-23 15:37:47 +01:00
Add mentions-only parameter to notifications command
This commit is contained in:
parent
8f0bf27e5e
commit
0b6d4a9e87
@ -268,8 +268,9 @@ def single_status(app, user, status_id):
|
||||
return http.get(app, user, url).json()
|
||||
|
||||
|
||||
def get_notifications(app, user):
|
||||
return http.get(app, user, '/api/v1/notifications').json()
|
||||
def get_notifications(app, user, exclude_types=[], limit=20):
|
||||
params={"exclude_types[]": exclude_types, "limit": limit}
|
||||
return http.get(app, user, '/api/v1/notifications', params).json()
|
||||
|
||||
|
||||
def clear_notifications(app, user):
|
||||
|
@ -316,7 +316,12 @@ def notifications(app, user, args):
|
||||
print_out("<green>Cleared notifications</green>")
|
||||
return
|
||||
|
||||
notifications = api.get_notifications(app, user)
|
||||
exclude = []
|
||||
if args.mentions:
|
||||
# Filter everything except mentions
|
||||
# https://docs.joinmastodon.org/methods/notifications/
|
||||
exclude = ["follow", "favourite", "reblog", "poll", "follow_request"]
|
||||
notifications = api.get_notifications(app, user, exclude_types=exclude)
|
||||
if not notifications:
|
||||
print_out("<yellow>No notification</yellow>")
|
||||
return
|
||||
|
@ -229,6 +229,11 @@ READ_COMMANDS = [
|
||||
"default": False,
|
||||
"help": "Reverse the order of the shown notifications (newest on top)",
|
||||
}),
|
||||
(["-m", "--mentions"], {
|
||||
"action": "store_true",
|
||||
"default": False,
|
||||
"help": "Only print mentions",
|
||||
})
|
||||
],
|
||||
require_auth=True,
|
||||
),
|
||||
|
Loading…
Reference in New Issue
Block a user