storage: copy guild.region into channel.rtc_region

close #130
This commit is contained in:
Luna 2022-08-13 22:46:31 -03:00
parent 5bd292422b
commit b5b168c388
1 changed files with 15 additions and 2 deletions

View File

@ -432,7 +432,7 @@ class Storage:
return {**row, **drow} return {**row, **drow}
elif chan_type == ChannelType.GUILD_VOICE: elif chan_type == ChannelType.GUILD_VOICE:
vrow = await self.db.fetchrow( voice_channel_data = await self.db.fetchrow(
""" """
SELECT bitrate, user_limit SELECT bitrate, user_limit
FROM guild_voice_channels FROM guild_voice_channels
@ -441,7 +441,20 @@ class Storage:
row["id"], row["id"],
) )
return {**row, **dict(vrow)} guild_region = await self.db.fetchval(
"""
SELECT region
FROM guilds
WHERE guild.id = $1
""",
guild_id,
row["guild_id"],
)
# see https://gitlab.com/litecord/litecord/-/issues/130
voice_channel_data["rtc_region"] = guild_region
return {**row, **dict(voice_channel_data)}
else: else:
# this only exists to trick mypy. this codepath is unreachable # this only exists to trick mypy. this codepath is unreachable
raise AssertionError("Unreachable code path.") raise AssertionError("Unreachable code path.")