From de357dd524adb65d69a685be30dbc7b76febaace Mon Sep 17 00:00:00 2001 From: Luna Date: Wed, 29 Jul 2020 17:22:40 -0300 Subject: [PATCH] add guild-specific voice region list support --- litecord/blueprints/voice.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/litecord/blueprints/voice.py b/litecord/blueprints/voice.py index 7011211..dd3cad5 100644 --- a/litecord/blueprints/voice.py +++ b/litecord/blueprints/voice.py @@ -104,9 +104,7 @@ async def majority_region(user_id: int) -> Optional[str]: return _majority_region_count(regions) -@bp.route("/regions", methods=["GET"]) -async def voice_regions(): - """Return voice regions.""" +async def _all_regions(): user_id = await token_check() best_region = await majority_region(user_id) @@ -116,3 +114,16 @@ async def voice_regions(): region["optimal"] = region["id"] == best_region return jsonify(regions) + + +@bp.route("/regions", methods=["GET"]) +async def voice_regions(): + """Return voice regions.""" + return await _all_regions() + + +@bp.route("/guilds//regions", methods=["GET"]) +async def guild_voice_regions(): + """Return voice regions.""" + # we return the same list as the normal /regions route on purpose. + return await _all_regions()