From e7d021e75e38e44f473dc3873b88e79a9657c1fc Mon Sep 17 00:00:00 2001 From: Castro0o Date: Tue, 19 Mar 2019 13:02:48 +0100 Subject: [PATCH] direct message read script: added --- direct-msgs.py | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 direct-msgs.py diff --git a/direct-msgs.py b/direct-msgs.py new file mode 100644 index 0000000..2f614f0 --- /dev/null +++ b/direct-msgs.py @@ -0,0 +1,21 @@ +from mastodon import Mastodon +from pprint import pprint + +with open('token.txt', 'r') as token: + mastodon = Mastodon(access_token=token.read(), + api_base_url="https://post.lurk.org/") +''' +mastodon direct messages, are the same as toots: *status updates* +With the difference that their visibility rathern than +being public / unlisted / private, are direct status updates +''' + +my_credentials = mastodon.account_verify_credentials() +my_id = my_credentials['id'] +my_statuses = mastodon.account_statuses(id=my_id) + +for status in my_statuses: + if status['visibility'] == 'direct': # filter only direct msgs + # pprint(status) + pprint(status['mentions']) + print(status['content'], status['id'], status['created_at'], '\n')