MCPcopy Create free account
hub / github.com/dedsec1121fk/DedSec / edit_profile

Function edit_profile

Scripts/Games/Buzz.py:223–250  ·  view source on GitHub ↗
(profiles: dict)

Source from the content-addressed store, hash-verified

221 return p
222
223def edit_profile(profiles: dict) -> None:
224 clear()
225 print("=== EDIT PROFILES ===\n")
226 names = list(profiles["players"].keys())
227 if not names:
228 print("No profiles yet.")
229 pause()
230 return
231 for i, n in enumerate(names, start=1):
232 p = profiles["players"][n]
233 print(f"{i}) {n} (nick: {p.get('nickname', n)})")
234 print("0) Back")
235 c = input("\nChoose: ").strip()
236 if c == "0":
237 return
238 if c.isdigit():
239 idx = int(c)-1
240 if 0 <= idx < len(names):
241 key = names[idx]
242 p = profiles["players"][key]
243 clear()
244 print(f"Editing: {key}\n")
245 new_nick = input(f"New nickname (current: {p.get('nickname', key)}): ").strip()
246 if new_nick:
247 p["nickname"] = new_nick
248 save_json(PROFILES_PATH, profiles)
249 print("Saved.")
250 pause()
251
252# -------------------- Highscores / Leaderboards --------------------
253def init_highscores() -> dict:

Callers 1

mainFunction · 0.70

Calls 5

printFunction · 0.85
inputFunction · 0.85
clearFunction · 0.70
pauseFunction · 0.70
save_jsonFunction · 0.70

Tested by

no test coverage detected