erela.js
erela.js copied to clipboard
Selection of the ideal Lavalink node according to the location of the Discord server
It is quite likely that there will be some errors in the code. I wrote this code in JavaScript and then transcribed it into TypeScript, a language I don't quite understand.
The principle is that I added the "region" option to the node options, which can be either a string or a array of strings. Furthermore, the Player now also has the "region" option, which is the region of the Discord server (string). If the user specifies the Node he wants to use when creating the Player, that one is selected (as before). If the user has provided the "region" option, the corresponding Nodes are selected.
- If none is found, null is returned
- If one matching Node is found, it will return
- If more than one matching Nodes are found, the best one will be selected according to the statistics of the given Node.
If no Node is returned or the "region" option is not provided, the best one is selected according to the statistics of that Node (as before)
Has this code been tested?
Has this code been tested?
yeah, I tested it - but in JavaScript => idk if I rewrote it to TypeScript correctly
Has this code been tested?
yeah, I tested it - but in JavaScript => idk if I rewrote it to TypeScript correctly
The thing you gotta realise is, Erela is our baby, hehe. We'd prefer it to be without bugs, and your codebase and amount of changes are almost too big to get a grasp of in one sitting. When we ask if your code has been tested, you respond with "only before, when I wrote it in a language I understand." What do we do with this? I suppose @acollierr17 & myself are forced to do quite some testing with this to avoid bugs if possible.
Has this code been tested?
yeah, I tested it - but in JavaScript => idk if I rewrote it to TypeScript correctly
The thing you gotta realise is, Erela is our baby, hehe. We'd prefer it to be without bugs, and your codebase and amount of changes are almost too big to get a grasp of in one sitting. When we ask if your code has been tested, you respond with "only before, when I wrote it in a language I understand." What do we do with this? I suppose @acollierr17 & myself are forced to do quite some testing with this to avoid bugs if possible.
I've already dealt with someone from you from Discord that I don't know much about TS. That man told me that someone would help me with the transport from JS to TS. I tried to make the code correct. Respectively, the code should be functional, I'm just not sure about the types of variables in the return and input methods.
there were a lot of commits, since I already made one pull request. Unfortunately, I was unable to reset changes to the repository. So that's the reason for so many commits