|
| 1 | +""" |
| 2 | +The MIT License (MIT) |
| 3 | +
|
| 4 | +Copyright (c) 2015-2021 Rapptz |
| 5 | +Copyright (c) 2021-present Pycord Development |
| 6 | +
|
| 7 | +Permission is hereby granted, free of charge, to any person obtaining a |
| 8 | +copy of this software and associated documentation files (the "Software"), |
| 9 | +to deal in the Software without restriction, including without limitation |
| 10 | +the rights to use, copy, modify, merge, publish, distribute, sublicense, |
| 11 | +and/or sell copies of the Software, and to permit persons to whom the |
| 12 | +Software is furnished to do so, subject to the following conditions: |
| 13 | +
|
| 14 | +The above copyright notice and this permission notice shall be included in |
| 15 | +all copies or substantial portions of the Software. |
| 16 | +
|
| 17 | +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS |
| 18 | +OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
| 19 | +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
| 20 | +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER |
| 21 | +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING |
| 22 | +FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER |
| 23 | +DEALINGS IN THE SOFTWARE. |
| 24 | +""" |
| 25 | + |
| 26 | +from typing import TYPE_CHECKING, Any |
| 27 | + |
| 28 | +from typing_extensions import deprecated |
| 29 | + |
| 30 | +if TYPE_CHECKING: |
| 31 | + from discord.voice import VoiceClient as VoiceClientC |
| 32 | + from discord.voice import VoiceProtocol as VoiceProtocolC |
| 33 | + |
| 34 | +""" |
| 35 | +since discord.voice raises an error when importing it without having the |
| 36 | +required package (ie davey) installed, we can't import it in __init__ because |
| 37 | +that would break the whole library, that is why this file is here. |
| 38 | +
|
| 39 | +the error would still be raised, but at least here we have more freedom on how we are typing it |
| 40 | +""" |
| 41 | + |
| 42 | +__all__ = ("VoiceProtocol", "VoiceClient") |
| 43 | + |
| 44 | + |
| 45 | +@deprecated( |
| 46 | + "discord.VoiceClient is deprecated in favour of discord.voice.VoiceClient since 2.7 and will be removed in 3.0", |
| 47 | +) |
| 48 | +def VoiceClient(*args: Any, **kwargs: Any) -> "VoiceClientC": |
| 49 | + from discord.voice import VoiceClient as VoiceClientC |
| 50 | + |
| 51 | + return VoiceClientC(*args, **kwargs) |
| 52 | + |
| 53 | + |
| 54 | +@deprecated( |
| 55 | + "discord.VoiceProtocol is deprecated in favour of discord.voice.VoiceProtocol since 2.7 and will be removed in 3.0", |
| 56 | +) |
| 57 | +def VoiceProtocol(*args: Any, **kwargs: Any) -> "VoiceProtocolC": |
| 58 | + from discord.voice import VoiceProtocol as VoiceProtocolC |
| 59 | + |
| 60 | + return VoiceProtocolC(*args, **kwargs) |
0 commit comments