mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-09 12:48:54 -05:00
[V3 instance setup] Warn and request confirmation if instance name already in use (#1469)
This commit is contained in:
parent
61b34e835e
commit
9ecea9e1d5
@ -63,6 +63,14 @@ def save_config(name, data, remove=False):
|
|||||||
if remove and name in config:
|
if remove and name in config:
|
||||||
config.pop(name)
|
config.pop(name)
|
||||||
else:
|
else:
|
||||||
|
if name in config:
|
||||||
|
print(
|
||||||
|
"WARNING: An instance already exists with this name. "
|
||||||
|
"Continuing will overwrite the existing instance config."
|
||||||
|
)
|
||||||
|
if not confirm("Are you absolutely certain you want to continue (y/n)? "):
|
||||||
|
print("Not continuing")
|
||||||
|
sys.exit(0)
|
||||||
config[name] = data
|
config[name] = data
|
||||||
JsonIO(config_file)._save_json(config)
|
JsonIO(config_file)._save_json(config)
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user