mirror of
https://github.com/Cog-Creators/Red-DiscordBot.git
synced 2025-11-06 11:18:54 -05:00
[Audio] Rename current_build to current_version in Config (#2219)
Renames the `current_build` key to `current_version`. This means the `current_version` key will always be a dict and never a list, and `current_build` having no defaults means it won't mess with `[p]audioset settings`. Signed-off-by: Toby Harradine <tobyharradine@gmail.com>
This commit is contained in:
parent
094735566d
commit
8b2d115335
@ -34,14 +34,14 @@ async def download_lavalink(session):
|
||||
|
||||
async def maybe_download_lavalink(loop, cog):
|
||||
jar_exists = LAVALINK_JAR_FILE.exists()
|
||||
current_build = redbot.core.VersionInfo.from_json(await cog.config.current_build())
|
||||
current_build = redbot.core.VersionInfo.from_json(await cog.config.current_version())
|
||||
|
||||
if not jar_exists or current_build < redbot.core.version_info:
|
||||
log.info("Downloading Lavalink.jar")
|
||||
LAVALINK_DOWNLOAD_DIR.mkdir(parents=True, exist_ok=True)
|
||||
async with ClientSession(loop=loop) as session:
|
||||
await download_lavalink(session)
|
||||
await cog.config.current_build.set(redbot.core.version_info.to_json())
|
||||
await cog.config.current_version.set(redbot.core.version_info.to_json())
|
||||
|
||||
shutil.copyfile(str(BUNDLED_APP_YML_FILE), str(APP_YML_FILE))
|
||||
|
||||
|
||||
@ -48,7 +48,7 @@ class Audio(commands.Cog):
|
||||
"ws_port": "2332",
|
||||
"password": "youshallnotpass",
|
||||
"status": False,
|
||||
"current_build": redbot.core.VersionInfo.from_str("3.0.0a0").to_json(),
|
||||
"current_version": redbot.core.VersionInfo.from_str("3.0.0a0").to_json(),
|
||||
"use_external_lavalink": False,
|
||||
}
|
||||
|
||||
|
||||
@ -193,7 +193,10 @@ class Group(Value):
|
||||
async def _get(self, default: Dict[str, Any] = ...) -> Dict[str, Any]:
|
||||
default = default if default is not ... else self.defaults
|
||||
raw = await super()._get(default)
|
||||
return self.nested_update(raw, default)
|
||||
if isinstance(raw, dict):
|
||||
return self.nested_update(raw, default)
|
||||
else:
|
||||
return raw
|
||||
|
||||
# noinspection PyTypeChecker
|
||||
def __getattr__(self, item: str) -> Union["Group", Value]:
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user