Skip to content

Instantly share code, notes, and snippets.

@DarkblooM-IO
Last active October 5, 2026 06:08
Show Gist options
  • Select an option

  • Save DarkblooM-IO/22b2f7a87b397790c443ecfa24f366bd to your computer and use it in GitHub Desktop.

Select an option

Save DarkblooM-IO/22b2f7a87b397790c443ecfa24f366bd to your computer and use it in GitHub Desktop.
Undertale name prompt
#!/usr/bin/env python3
"""
MIT LICENSE
Copyright © 2025 darkbloom
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the “Software”), to deal
in the Software without restriction, including without limitation the rights to
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
the Software, and to permit persons to whom the Software is furnished to do so,
subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED,
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A
PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
"""
import re
from os import system
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
if name.lower() == "gaster":
system("cat /dev/random")
return
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