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')