Fix renoting for images sourced from the fediverse

This commit is contained in:
dotnet 2023-10-20 23:33:40 -04:00
parent 14ededdf4e
commit e341bf7adc
1 changed files with 2 additions and 2 deletions

View File

@ -119,9 +119,9 @@ class BotInstance:
post_request = requests.post(self.misskey_url + "ap/show", json = {"uri": image_src, "i": self.misskey_token})
if post_request.status_code == 200:
post_json = post_request.json()
if 'id' in post_json:
if 'type' in post_json and post_json['type'] == 'Note' and 'object' in post_json and 'id' in post_json['object']:
# Submit a /notes/create request to Misskey
create_note_request = requests.post(self.misskey_url + "notes/create", json = {"renoteId": post_json['id'], "text":"", "i": self.misskey_token})
create_note_request = requests.post(self.misskey_url + "notes/create", json = {"renoteId": post_json['object']['id'], "i": self.misskey_token})
# If error, print error and exit
if create_note_request.status_code != 200:
print(self.cfg_name + ": Error: ", file=log_file)