Closed liquidnya closed 2 years ago
I would like to get some feedback about the message that is displayed when a !weightednext
level is chosen.
Currently it will say something like:
(weightednext) Now playing a ROMhack submitted by liquidnya with the highest wait time of 14.3%.
I think it would be a good idea to add the subscriber multiplier to the end of the response of the !odds
command.
This should be done only for subscribers and only if the multiplier is greater than 1.0
.
This PR adds:
!weightednext
command/order option. This will pick the use with the highest wait time.!list
will now list levels by weighted chance. (only ifweightednext
is present in the levels order)!position
will now show your weighted position. (only ifweightednext
is present in the levels order)!odds
will now show your weight multiplier. (only if it is bigger than 1.0)!odds
and!list
will show<0.1%
if someones chance is more than 0% but would have been rounded to0.0%
and will show>99.9%
if someones chance is less than 100% but would have been rounded to100.0%
.!weightedsubnext
and!weightedsubrandom
variants of!weightednext
and!weightedrandom
respectively, but only picks subscribers.This PR also merges #27, #31, and #35 and fixes #6, and fixes #9.
Configuration:
subscriberWeightMultiplier
to the configuration which can be set to a floating point number bigger than or equal to1.0
. This will multiply the weight for the weighted random chance for subscribers.Bug fixes:
!weightedrandom
the removal of their wait time / weighted random chance was not persisted and only saved to the./data/queue.json
file on the next save.Implementation details:
waitTime
will still be the time users waited in minutes. This value is not influenced by the subscriber multiplierweightMin
which stores the weight of the weighted random chance in minutes. This value will be initialized with thewaitTime
but is influenced by the subscriber multiplier.weightMsec
which stores the weight of the weighted random chance in milliseconds. This is needed because e.g. if the subscriber multiplier is 1.2 then this would add 1 minute and 12000 milliseconds. This value will always be between 0 (inclusive) and 59999 (inclusive).weightMin
+weightMsec
rounded to the nearest minute. E.g. 1 minute and 12000 milliseconds will give a weight of 1, and 9 minutes and 36000 milliseconds will give a weight of 10.!weightednext
will pick the user who is nearer to the top of the queue.devDependencies
have been upgraded to newer versions. Runnpm install
before runningnpm test
, but there is no need to usenpm install
for running the queue itself if it was upgraded from a previous version.