Closed GeeLeonidas closed 1 year ago
Think it would be better to simply change VoiceOp to const. Will fix in a day or two.
Think the solution given is best
Add an Unknown
value to the enum which is used when the opcode isn't in the range of FirstGoodValue..LastValue
Switching to const would remove some type safety and make it a bit more unclean imo
The issue is fixed, should be fine now.
Description
I've recently noticed that my bot crashed every time it was trying to play audio, apparently a new voice op code is being given to be handled and it is not defined in the VoiceOp enum. Error message is the one in the title. Traceback points to
dimscord-#head/dimscord/voice.nim(398) handleSocketMessageIter
: https://github.com/krisppurg/dimscord/blob/41eea2aeafe2f6ea3ab861efa8e1d4ddbf214dc1/dimscord/voice.nim#L398Temporary solution
Quite inelegant and probably troublesome, but hey it works™ (i.e. stops crashing):
How to reproduce
Using
examples/voice.nim
anddimscord#head
should suffice (https://github.com/krisppurg/dimscord/blob/41eea2aeafe2f6ea3ab861efa8e1d4ddbf214dc1/examples/voice.nim)