samuri51 / chillybot

a turntable bot created by a moderator of straight_chillin11
12 stars 12 forks source link

Labeling #24

Closed ghost closed 11 years ago

ghost commented 11 years ago

To help me find what code belongs to which feature, can you label the blocks of code with a description saying that code block belongs to that feature/function of the chillybot.

samuri51 commented 11 years ago

are you trying to find anything in particular? some things in the non speak functions belong to more than one thing... the best way would probably to be to look at a command or something that you want to work with, then do a ctrl f and search for the variable name which will lead you to everything that belongs to that feature

samuri51 commented 11 years ago

i guess i can label the global variables at the top of the script though if you think that would help?

ghost commented 11 years ago

it would help and I was looking for the code block for the feature, Vote Skipping.

samuri51 commented 11 years ago

do you have a specific question about it? or do you want to know in general how it works? im labeling the globals right now btw

ghost commented 11 years ago

I want to know how it works.

samuri51 commented 11 years ago

alright i added comments about /skip to script on github if you wanna look at it, not going to go to that level of detail over everything....

however i can tell you its general behavior

  1. there is an empty global array on startup which holds the userid's of people who voted
  2. when someone uses the /skip command the bot checks this array to see if they have already voted
  3. if they are not in that array then they must not have voted, so it counts their vote
  4. if it makes it that far it puts their userid into the global array to make sure that they cant vote again
  5. if after counting down from by one from whatever the skip threshold was set to the amount of votes still needed to skip the song is zero, it removes the current dj from stage, assuming they aren;t in the master id;s list in which case they'd be exempt.
  6. otherwise if it does not hit zero votes left it displays in chat the amount of votes total needed to skip the song, and the current amount of people who have already voted to skip the song.

it also resets the global checkVotes array, every song as well as the votes remaing and current votes, to make sure that the totals are correct. you can find that in the 'newsong' event. it does not reset "HowManyVotesToSkip" because that represents the total amount of votes that a moderator has set as the voting threshold for a song to be skipped. that should always remain constant, otherwise you would need to manually reset it every song....

the amount of votes needed to skip a song is set by the /voteskipon command dynamically as the bot is running, or statically in the setup section of the bot at the top, if its set in one place you do not have to set it in the other....

ghost commented 11 years ago

cool