Fix renoting for images sourced from the fediverse
This commit is contained in:
parent
14ededdf4e
commit
e341bf7adc
|
@ -119,9 +119,9 @@ class BotInstance:
|
||||||
post_request = requests.post(self.misskey_url + "ap/show", json = {"uri": image_src, "i": self.misskey_token})
|
post_request = requests.post(self.misskey_url + "ap/show", json = {"uri": image_src, "i": self.misskey_token})
|
||||||
if post_request.status_code == 200:
|
if post_request.status_code == 200:
|
||||||
post_json = post_request.json()
|
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
|
# 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 error, print error and exit
|
||||||
if create_note_request.status_code != 200:
|
if create_note_request.status_code != 200:
|
||||||
print(self.cfg_name + ": Error: ", file=log_file)
|
print(self.cfg_name + ": Error: ", file=log_file)
|
||||||
|
|
Loading…
Reference in New Issue