DSharpPlus / DSharpPlus

A .NET library for making bots using the Discord API.
https://discord.gg/dsharpplus
MIT License
1.26k stars 310 forks source link

Updating channel region kills VNext #981

Open VelvetToroyashi opened 3 years ago

VelvetToroyashi commented 3 years ago

Discord "recently" shifted from guild region to per-channel regions, however updating this does not send requisite data that VNext expects to successfully reconnect to the session, which causes a null-ref to propagate up the call stack and through the AsyncEvent that fires when this happens. I don't know enough about VNext to handle this myself, though, hence the issue vs a PR.

VelvetToroyashi commented 3 years ago

The culprit is this line

Lulalaby commented 3 years ago

Lol since when? That's new for me, but explains a bit..

VelvetToroyashi commented 3 years ago

Since per-channel regions were introduced I'd assume

Lulalaby commented 3 years ago

What's with Lavalink?

VelvetToroyashi commented 3 years ago

What

Lulalaby commented 3 years ago

https://github.com/DSharpPlus/DSharpPlus/tree/master/DSharpPlus.Lavalink Do you think it gives Problems there too or is it handled on Lavalinks side?

Just remembered a few reports of the Hatsune Miku Bot. Using Lavalink & DSP, Big Bot. Some people reported that the bot can't connect anymore. We don't have enough informations about it, but I assume it happens in Lavalink too.

VelvetToroyashi commented 3 years ago

I don't use nor contribute to LL, so I couldn't know. I'm within the realm of components and other miscellaneous features that I implement

Lulalaby commented 3 years ago

I gotta request a few more infos. Will keep dsp updated about it in case it affects more then VNext

VelvetToroyashi commented 3 years ago

It shouldn't.

VelvetToroyashi commented 3 years ago

It's simply an issue with whatever payload Discord sends and not including the updated endpoint, so I'd assume VNext should just reconnect to the current endpoint, but I don't have time to investigate right now.

Lulalaby commented 3 years ago

Then I'll do

VelvetToroyashi commented 3 years ago

So an update on this, it would appear that updating a voice region while the bot is in the affected channel isn't an issue, but switching to a different channel with a different region DOES in some capacity affect VNext.

VelvetToroyashi commented 3 years ago

The behavior is far too inconsistent to make a repo for, though.

Lulalaby commented 3 years ago

Is it only when you switch will you're in a channel or if you were in a channel, disconnect and switch to a channel with a total different voice region?