(key: str, value: str, text: str)
| 97 | content = VM_ENV_PATH.read_text() if VM_ENV_PATH.exists() else "" |
| 98 | |
| 99 | def upsert(key: str, value: str, text: str) -> str: |
| 100 | if f"{key}=" in text: |
| 101 | return re.sub(rf"{key}=.*", f"{key}={value}", text) |
| 102 | return text + f"\n{key}={value}" |
| 103 | |
| 104 | content = upsert("DISCORD_BOT_TOKEN", token, content) |
| 105 | if slash_command: |