mirror of https://gitlab.com/litecord/litecord.git
litecord.voice: add LVSPManager, LVSPConnection
This commit is contained in:
parent
62d1252975
commit
287368ad1c
|
|
@ -0,0 +1,23 @@
|
||||||
|
"""
|
||||||
|
|
||||||
|
Litecord
|
||||||
|
Copyright (C) 2018-2019 Luna Mendes
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, version 3 of the License.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
|
||||||
|
class LVSPConnection:
|
||||||
|
def __init__(self, app):
|
||||||
|
self.app = app
|
||||||
|
|
@ -0,0 +1,27 @@
|
||||||
|
"""
|
||||||
|
|
||||||
|
Litecord
|
||||||
|
Copyright (C) 2018-2019 Luna Mendes
|
||||||
|
|
||||||
|
This program is free software: you can redistribute it and/or modify
|
||||||
|
it under the terms of the GNU General Public License as published by
|
||||||
|
the Free Software Foundation, version 3 of the License.
|
||||||
|
|
||||||
|
This program is distributed in the hope that it will be useful,
|
||||||
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
GNU General Public License for more details.
|
||||||
|
|
||||||
|
You should have received a copy of the GNU General Public License
|
||||||
|
along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
|
"""
|
||||||
|
|
||||||
|
class LVSPManager:
|
||||||
|
"""Manager class for Litecord Voice Server Protocol (LVSP) connections.
|
||||||
|
|
||||||
|
Spawns :class:`LVSPConnection` as needed, etc.
|
||||||
|
"""
|
||||||
|
def __init__(self, app, voice):
|
||||||
|
self.app = app
|
||||||
|
self.voice = voice
|
||||||
|
|
@ -26,6 +26,7 @@ from logbook import Logger
|
||||||
from litecord.permissions import get_permissions
|
from litecord.permissions import get_permissions
|
||||||
from litecord.enums import ChannelType, VOICE_CHANNELS
|
from litecord.enums import ChannelType, VOICE_CHANNELS
|
||||||
from litecord.voice.state import VoiceState
|
from litecord.voice.state import VoiceState
|
||||||
|
from litecord.voice.lvsp_manager import LVSPManager
|
||||||
|
|
||||||
|
|
||||||
VoiceKey = Tuple[int, int]
|
VoiceKey = Tuple[int, int]
|
||||||
|
|
@ -47,8 +48,8 @@ class VoiceManager:
|
||||||
|
|
||||||
# double dict, first key is guild/channel id, second key is user id
|
# double dict, first key is guild/channel id, second key is user id
|
||||||
self.states = defaultdict(dict)
|
self.states = defaultdict(dict)
|
||||||
|
self.lvsp = LVSPManager(app, self)
|
||||||
|
|
||||||
# TODO: hold voice server LVSP connections
|
|
||||||
# TODO: map channel ids to voice servers
|
# TODO: map channel ids to voice servers
|
||||||
|
|
||||||
async def can_join(self, user_id: int, channel_id: int) -> int:
|
async def can_join(self, user_id: int, channel_id: int) -> int:
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue