fix for last message id in mastodon api

workspace
Brendan Howell 4 years ago
parent 3065a671b4
commit 59c6b88836

@ -60,7 +60,7 @@ class PublicRelations(Bureau):
to_file=MASTO_CREDS) to_file=MASTO_CREDS)
# TODO: catch the error when our token is too old and throw it out # TODO: catch the error when our token is too old and throw it out
self.masto = Mastodon(client_id=MASTO_CREDS, self.masto = Mastodon(client_id=MASTO_CREDS,
api_base_url=masto_server) api_base_url=masto_server)
masto_user = self.config["mastodon"]["user"] masto_user = self.config["mastodon"]["user"]
masto_pass = self.config["mastodon"]["password"] masto_pass = self.config["mastodon"]["password"]
self.masto.log_in(masto_user, masto_pass) self.masto.log_in(masto_user, masto_pass)
@ -353,7 +353,7 @@ class PublicRelations(Bureau):
# store the last notification id # store the last notification id
self.last_mast_notif = notifications[0].id self.last_mast_notif = notifications[0].id
with self.dbenv.begin(db=self.tweetdb, write=True) as txn: with self.dbenv.begin(db=self.tweetdb, write=True) as txn:
txn.put(b"last_mast_notif", self.last_mast_notif.encode()) txn.put(b"last_mast_notif", self.last_mast_notif)
for note in notifications: for note in notifications:
username = note.account.display_name.encode("cp437", "ignore") + \ username = note.account.display_name.encode("cp437", "ignore") + \
b" (" + note.account.acct.encode("cp437", "ignore") + b")" b" (" + note.account.acct.encode("cp437", "ignore") + b")"

Loading…
Cancel
Save