shipgirlproject / Shoukaku

A stable, powerful and updated wrapper around Lavalink
https://guide.shoukaku.shipgirl.moe/
MIT License
273 stars 84 forks source link

enhancement: typesafe Lavalink extensions support #185

Open 0t4u opened 1 month ago

0t4u commented 1 month ago

Lavalink extensions may add API routes, and we might want to consider supporting extending the Rest class with more methods in a modular way without having to add all routes to one specific class, and without "chain subclassing".

Lavaclient does this by using reflection and manually declaring the extra functions (e.g. https://github.com/lavaclient/lavaclient/blob/master/packages/plugin/lavasearch/src/plugin.ts)

We may also revisit the old, significantly more complex router from v2, which makes use of reflection and proxy (https://github.com/shipgirlproject/Shoukaku/blob/v2/src/node/ShoukakuRouter.js)

There are many ways to accomplish this, e.g. prototype extension, reflection, mixins, chained decorators... etc.