riffy-team / riffy

Riffy is a pro lavalink client. It is designed to be simple and easy to use, with a focus on stability and more features.
MIT License
37 stars 5 forks source link

Improve documentation and comments #18

Open AlexInCube opened 1 month ago

AlexInCube commented 1 month ago

Feature

I often don't understand what different methods or variables in a library do. I have to read the Riffy source code or use the debugger in the IDE to learn something.

Ideal solution or implementation

I suggest adding comments in the code to methods and variables.

For example: /* Represent in milliseconds current timeline position. / public position: number;

And by the way, everywhere where time is specified, it seems that milliseconds are used, but it is not written anywhere about it. For example in player.seek() method, the docs just say args is a "number".

Alternative solutions or implementations

This is example from Discord.js library, every property have description. So I don't even need to go to the documentation, the IDE can show me what the variable means.

/**

Other context

No response

AlexInCube commented 1 month ago

And variables like “player.position” should only be readonly.

UnschooledGamer commented 1 month ago

it seems that milliseconds are used, but it is not written anywhere about it. For example in player.seek() method, the docs just say args is a "number".

It's assumed as Riffy has the same properties Lavalink Gives, And I expect User must have seen the Lavalink docs at least once. And usually position like this Have in ms as it's easier to convert later.

UnschooledGamer commented 1 month ago

And variables like “player.position” should only be readonly.

I cannot agree with it, As player.position needs to be updated everytime it changes and read-only is like constant in JS (cannot be updated again atleast for Number)

AlexInCube commented 1 month ago

And variables like “player.position” should only be readonly.

I cannot agree with it, As player.position needs to be updated everytime it changes and read-only is like constant in JS (cannot be updated again atleast for Number)

okay, you can make player.position private, but user can player.get_position()

UnschooledGamer commented 1 month ago

okay, you can make player.position private, but user can player.get_position()

If we do that, We'll also need a setter as well. So currently it serves both purposes.