dpy 2.2.1

This commit is contained in:
AF 2023-03-02 01:19:42 +00:00
parent 834d9c159f
commit 54a9bb447f
3 changed files with 9 additions and 37 deletions

View File

@ -1,4 +1,4 @@
aiohttp>=3.7.4,<4
discord.py[voice]~=2.2.0
discord.py[voice]~=2.2.1
yt-dlp~=2023.2.17
typing_extensions~=4.4.0

View File

@ -351,4 +351,11 @@ presets: {shlex.join(allowed_presets)}
raise Explicit("queue not empty")
await vc.disconnect()
# @at('vtest')
# async def vtest(ctx: Context, _args: list[str]) -> None:
# guild: discord.Guild = ctx.client.get_guild(914448749873479692)
# channel: discord.VoiceChannel = guild.get_channel(914448750414540843)
# await channel.connect()
# print('connected')
return of

View File

@ -15,7 +15,7 @@ from v6d1tokens.client import *
from v6d2ctx.handle_content import *
from v6d2ctx.integration.event import *
from v6d2ctx.integration.targets import *
from v6d2ctx.pain import ABlockMonitor, ALog, SLog
from v6d2ctx.pain import ABlockMonitor
from v6d2ctx.serve import *
from v6d3music.api import *
from v6d3music.app import *
@ -180,45 +180,10 @@ async def amain(client: discord.Client):
print("exited")
async def initial_connection(self, data: dict[str, Any]) -> None:
state = self._connection
state.ssrc = data["ssrc"]
state.voice_port = data["port"]
state.endpoint_ip = data["ip"]
packet = bytearray(74)
struct.pack_into(">H", packet, 0, 1) # 1 = Send
struct.pack_into(">H", packet, 2, 70) # 70 = Length
struct.pack_into(">I", packet, 4, state.ssrc)
state.socket.sendto(packet, (state.endpoint_ip, state.voice_port))
recv = await self.loop.sock_recv(state.socket, 70)
# the ip is ascii starting at the 8th byte and ending at the first null
ip_start = 8
ip_end = recv.index(0, ip_start)
state.ip = recv[ip_start:ip_end].decode("ascii")
state.port = struct.unpack_from(">H", recv, 6)[0]
# there *should* always be at least one supported mode (xsalsa20_poly1305)
modes = [mode for mode in data["modes"] if mode in self._connection.supported_modes]
mode = modes[0]
await self.select_protocol(state.ip, state.port, mode)
__import__("discord.gateway").gateway.DiscordVoiceWebSocket.initial_connection = initial_connection
def main() -> None:
wst = __import__("discord.gateway").gateway.DiscordVoiceWebSocket
with (
_upgrade_abm(),
_db_ee(),
ALog(discord.VoiceClient, "connect_websocket"),
ALog(wst, "poll_event"),
ALog(wst, "received_message"),
ALog(wst, "initial_connection"),
ALog(wst, "select_protocol"),
):
serve(amain(_client), _client, loop)