voice: fix bugs

This commit is contained in:
Luna 2019-03-04 01:21:06 -03:00
parent 547353e8a5
commit 4a792966f1
1 changed files with 3 additions and 3 deletions

View File

@ -38,7 +38,7 @@ def _majority_region_count(regions: list) -> str:
async def _choose_random_region() -> str: async def _choose_random_region() -> str:
"""Give a random voice region.""" """Give a random voice region."""
regions = await app.db.fetchval(""" regions = await app.db.fetch("""
SELECT id SELECT id
FROM voice_regions FROM voice_regions
""") """)
@ -55,7 +55,7 @@ async def _majority_region_any(user_id) -> str:
"""Calculate the most likely region to make the user happy, but """Calculate the most likely region to make the user happy, but
this is based on the guilds the user is IN, instead of the guilds this is based on the guilds the user is IN, instead of the guilds
the user owns.""" the user owns."""
guilds = await app.storage.get_user_guilds(user_id) guilds = await app.user_storage.get_user_guilds(user_id)
if not guilds: if not guilds:
return await _choose_random_region() return await _choose_random_region()
@ -101,7 +101,7 @@ async def voice_regions():
user_id = await token_check() user_id = await token_check()
best_region = await majority_region(user_id) best_region = await majority_region(user_id)
regions = await app.storage.get_all_regions() regions = await app.storage.all_voice_regions()
for region in regions: for region in regions:
region['optimal'] = region['id'] == best_region region['optimal'] = region['id'] == best_region