feat: add HTML template rendering and test notification functionality
This commit is contained in:
+14
-9
@@ -6,12 +6,8 @@ from pathlib import Path
|
||||
|
||||
|
||||
DEFAULT_TEMPLATES: dict[str, dict] = {
|
||||
"reminder_halftime": {
|
||||
"text": "Half-time in 5 minutes!",
|
||||
"color": 0xE67E22,
|
||||
},
|
||||
"halftime": {
|
||||
"text": "Half-time!",
|
||||
"420": {
|
||||
"text": "Blaze it!",
|
||||
"color": 0x2ECC71,
|
||||
"image_url": "https://copyparty.allucanget.biz/img/weed.png",
|
||||
},
|
||||
@@ -19,11 +15,19 @@ DEFAULT_TEMPLATES: dict[str, dict] = {
|
||||
"text": "This is your 5 minute reminder to 420!",
|
||||
"color": 0xE67E22,
|
||||
},
|
||||
"420": {
|
||||
"text": "Blaze it!",
|
||||
"halftime": {
|
||||
"text": "Half-time!",
|
||||
"color": 0x2ECC71,
|
||||
"image_url": "https://copyparty.allucanget.biz/img/weed.png",
|
||||
},
|
||||
"reminder_halftime": {
|
||||
"text": "Half-time in 5 minutes!",
|
||||
"color": 0xE67E22,
|
||||
},
|
||||
"test": {
|
||||
"text": "This is a test notification.",
|
||||
"color": 0x3498DB,
|
||||
},
|
||||
}
|
||||
|
||||
|
||||
@@ -73,7 +77,8 @@ def save_templates(path: str | Path, templates: dict) -> None:
|
||||
|
||||
p.parent.mkdir(parents=True, exist_ok=True)
|
||||
tmp = p.with_suffix(p.suffix + ".tmp")
|
||||
tmp.write_text(json.dumps(normalized, indent=2, sort_keys=True) + "\n", encoding="utf-8")
|
||||
tmp.write_text(json.dumps(normalized, indent=2,
|
||||
sort_keys=True) + "\n", encoding="utf-8")
|
||||
tmp.replace(p)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user