From 6c05e4d1dcddf250f6e97b4ae7c4a4d4d3c3efb3 Mon Sep 17 00:00:00 2001 From: Simon Tatham Date: Sat, 2 Dec 2023 18:12:39 +0000 Subject: [PATCH] Proof of concept fetching my notifications timeline. --- mastodonochrome | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/mastodonochrome b/mastodonochrome index b857039..7a23260 100755 --- a/mastodonochrome +++ b/mastodonochrome @@ -21,6 +21,17 @@ class TimelineUI(client.Client): for line in thing.render(80): print(line.ecma48()) +class MentionsUI(client.Client): + def run(self): + login.setup_client(self) + for item in reversed(self.get("notifications", limit=40)): + if item['type'] != 'mention': + continue + p = client.Status(item['status']) + for thing in p.text(): + for line in thing.render(80): + print(line.ecma48()) + class MyTestLoader(unittest.TestLoader): def loadTestsFromModule(self, module): suite = super().loadTestsFromModule(module) @@ -39,6 +50,9 @@ def main(): parser.add_argument("--timeline", action="store_const", dest="action", const=TimelineUI, help="Temporary mode to fetch " "the user's timeline and print it on the terminal.") + parser.add_argument("--mentions", action="store_const", dest="action", + const=MentionsUI, help="Temporary mode to fetch " + "the user's mentions and print them on the terminal.") parser.add_argument("--login", action="store_const", dest="action", const=login.LoginUI, help="Log in to a user account.") parser.set_defaults(action=cursesclient.CursesUI) -- 2.30.2