danbooru-bot/extensions.py
mctaylors 8b97a60a34
refactor: explicitly define parameter types
Signed-off-by: mctaylors <cantsendmails@mctaylors.ru>
2025-03-10 00:21:20 +03:00

30 lines
729 B
Python

import re
def humanize_tags_from_json(value: str, default: str):
if value != "":
output = str()
tags = value.split()
for t in tags:
output += f"{re.sub('_\\(.*', '', t)}, "
output = output[:-2]
return output
return default
def format_rating(value: str):
match value:
case "g":
# Negative Squared Latin Capital Letter G
return "๐Ÿ…ถ"
case "s":
# Negative Squared Latin Capital Letter S
return "๐Ÿ†‚"
case "q":
# Negative Squared Latin Capital Letter Q
return "๐Ÿ†€"
case "e":
# Negative Squared Latin Capital Letter E
return "๐Ÿ…ด"