inject rating tag into post.tag_string
This commit is contained in:
parent
6f3ce2ab02
commit
8a3a47a8af
16
main.py
16
main.py
|
@ -194,7 +194,21 @@ async def fetch_post(ctx, md5) -> Optional[dict]:
|
||||||
if not rows:
|
if not rows:
|
||||||
return None
|
return None
|
||||||
assert len(rows) == 1
|
assert len(rows) == 1
|
||||||
return json.loads(rows[0][0])
|
post = json.loads(rows[0][0])
|
||||||
|
post_rating = post["rating"]
|
||||||
|
match post_rating:
|
||||||
|
case "g":
|
||||||
|
rating_tag = "general"
|
||||||
|
case "s":
|
||||||
|
rating_tag = "sensitive"
|
||||||
|
case "q":
|
||||||
|
rating_tag = "questionable"
|
||||||
|
case "e":
|
||||||
|
rating_tag = "explicit"
|
||||||
|
case _:
|
||||||
|
raise AssertionError("invalid post rating {post_rating!r}")
|
||||||
|
post["tag_string"] = post["tag_string"] + " " + rating_tag
|
||||||
|
return post
|
||||||
|
|
||||||
|
|
||||||
async def insert_post(ctx, post):
|
async def insert_post(ctx, post):
|
||||||
|
|
Loading…
Reference in New Issue