Skip to content

Instantly share code, notes, and snippets.

@DarkblooM-IO
Last active March 14, 2025 10:26
Show Gist options
  • Save DarkblooM-IO/22b2f7a87b397790c443ecfa24f366bd to your computer and use it in GitHub Desktop.
Save DarkblooM-IO/22b2f7a87b397790c443ecfa24f366bd to your computer and use it in GitHub Desktop.
Undertale name prompt
#!/usr/bin/env python3
"""
Undertale name prompt
Copyright (C) 2025 ÐarkbloøM
All rights reserved.
"""
import re
FORBIDDEN = {
"Alphys": "D-don't do that.",
"Asgore": "You cannot.",
"Asriel": "...",
"Flowey": "I already CHOSE that name.",
"Sans": "nope.",
"Toriel": "I think you should think of your own name, my child.",
"Undyne": "Get your OWN name!"
}
ALLOWED = {
"Frisk": "WARNING: This name will make your life hell. Proceed anyway?",
"Murder|Mercy": "That's a little on-the-nose, isn't it...?",
"a+": "Not very creative...?",
"Aaron": "Is this name correct? ;)",
"Alphy": "Uh.... OK?",
"Catty": "Bratty! Bratty! That's MY name!",
"Bratty": "Like, OK I guess.",
"Bpants": "You are really scraping the bottom of the barrel.",
"Chara": "The true name.",
"DarkblooM": "Ayup.",
"Gerson": "Wah ha ha! Why not?",
"Jerry": "Jerry.",
"Metta|Mett|Mtt": "OOOOH!!! ARE YOU PROMOTING MY BRAND?",
"Napsta|Blooky": "............ (They are powerless to stop you.)",
"Papyru": "I'LL ALLOW IT!!!!",
"Shyren": "...?",
"Temmie": "hOI!",
"Woshua": "Clean name."
}
def validateName(name: str) -> bool:
for e in FORBIDDEN:
if re.match(f"^(?:{e})$", name, re.IGNORECASE):
print(FORBIDDEN[e])
return False
return True
def main() -> None:
while True:
try:
name = input("Name the fallen human: ").strip()
if name == "":
print("You must choose a name.")
continue
if not validateName(name):
continue
msg = "Is this name correct?"
for e in ALLOWED:
if re.match(f"^(?:{e})$", name, re.IGNORECASE):
msg = ALLOWED[e]
if input(f"{msg} [Y/n] ").strip().lower() not in ["yes","y",""]:
continue
print(f"Your name is {name}.")
return
except (EOFError, KeyboardInterrupt):
print("")
return
if __name__ == "__main__":
main()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment