diff --git a/bot.py b/bot.py index af77ac8..1fa9c4d 100644 --- a/bot.py +++ b/bot.py @@ -107,11 +107,17 @@ if post == None: match config.type: case "danbooru": - filename = f'{post["md5"]}.{post["file_ext"]}' + characters = post.get("tag_string_character") or "" + filename = f'image.{post["file_ext"]}' + post_url = config.url + "/posts/" + str(post["id"]) case "gelbooru": + characters = "" filename = post["image"] + post_url = "https://gelbooru.com/index.php?page=post&s=view&id=" + str(post["id"]) case _: + characters = "" filename = "img.png" + post_url = "" print(post) @@ -148,9 +154,9 @@ post_content = [ random.choice(config.text_filler), "\n\n", "Artist: " + post["tag_string_artist"] + "\n" if config.type == "danbooru" and len(post["tag_string_artist"]) > 0 else "", - "Score: " + str(post["score"]) + "\n", - "Source: " + post["source"] + "\n\n" if len(post["source"]) > 0 else "", - "\n\n" + post["url"] if config.type == "danbooru" else "" + "Characters: " + characters + "\n" if characters != "" else "", + "Source: " + post["source"] if len(post["source"]) > 0 else "", + "\n\n" + post_url if post_url != "" else "" ] mastodon = Mastodon(access_token=f"auth/{argv[1]}.auth.secret")