fetching cargo mommy prompts on mommify
This commit is contained in:
parent
cc5b7ae55e
commit
ad61ad4643
@ -1,7 +1,7 @@
|
|||||||
[project]
|
[project]
|
||||||
description = "Mommy's here to support you when running python (in a virtual enviroment)~ ❤️"
|
description = "Mommy's here to support you when running python (in a virtual enviroment)~ ❤️"
|
||||||
name = "python_mommy_venv"
|
name = "python_mommy_venv"
|
||||||
dependencies = ["toml"]
|
dependencies = ["toml", "requests"]
|
||||||
authors = []
|
authors = []
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
requires-python = ">=3.9"
|
requires-python = ">=3.9"
|
||||||
|
@ -5,12 +5,13 @@ import os
|
|||||||
import logging
|
import logging
|
||||||
import toml
|
import toml
|
||||||
import random
|
import random
|
||||||
|
import requests
|
||||||
|
|
||||||
|
|
||||||
logger = logging.Logger(__name__)
|
logger = logging.Logger(__name__)
|
||||||
PREFIX = "MOMMY"
|
PREFIX = "MOMMY"
|
||||||
|
|
||||||
|
RESPONSES_URL = "https://raw.githubusercontent.com/diamondburned/go-mommy/refs/heads/main/responses.json"
|
||||||
RESPONSES_FILE = Path(__file__).parent / "responses.json"
|
RESPONSES_FILE = Path(__file__).parent / "responses.json"
|
||||||
ADDITIONAL_ENV_VARS = {
|
ADDITIONAL_ENV_VARS = {
|
||||||
"pronoun": "PRONOUNS",
|
"pronoun": "PRONOUNS",
|
||||||
@ -116,11 +117,17 @@ def _get_env_value(name: str) -> Optional[str]:
|
|||||||
return val
|
return val
|
||||||
|
|
||||||
|
|
||||||
|
def compile_config(disable_requests: bool = False):
|
||||||
def compile_config():
|
global RESPONSES_FILE, RESPONSES_URL
|
||||||
global RESPONSES_FILE
|
|
||||||
|
|
||||||
data = json.loads(RESPONSES_FILE.read_text())
|
data = json.loads(RESPONSES_FILE.read_text())
|
||||||
|
|
||||||
|
if not disable_requests:
|
||||||
|
print("mommy downloads newest responses for her girl~")
|
||||||
|
print(RESPONSES_URL)
|
||||||
|
r = requests.get(RESPONSES_URL)
|
||||||
|
data = r.json()
|
||||||
|
|
||||||
config_definition: Dict[str, dict] = data["vars"]
|
config_definition: Dict[str, dict] = data["vars"]
|
||||||
mood_definitions: Dict[str, dict] = data["moods"]
|
mood_definitions: Dict[str, dict] = data["moods"]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user