BYB-BOT

== About ==
This discord bot is used in the reddit BYB league discord
== Commands ==
=== !draft ===
Used to draft and manage a draft for backyard baseball leagues. It will follow the google sheet and notify coaches when they are up to pick. It will also fill in the draft board with the players drafted. If a player is already drafted, they will be "undraftable" to set a player back to undrafted use the !draft fix command.
* !draft AB -> drafts a player based on the Character Code
* !draft Pablo Sanchez -> drafts a player based on name (it will find the closest match, so mispellings are okay.)
* !draft undo -> Undoes the most recent draft pick.
* !draft set 20 -> sets the draft to pick 20 on the google sheet.
* !draft reset -> resets the entire draft.
* !draft unlock ->unlocks the draft.
* !draft lock -> locks the draft.
* !draft fix AB 'undrafted' 0 -> Sets player with character code AB to undrafted at pick 0.
*!draft fix syntax has changed to be !draft fix [coach_code] [pick_num] [player_name]
* !draft fix AB GG 23 -> Sets the player with character code AB to team GG at pick 23.
*!draft set auto -> will set the pick to the next open spot on the spreadsheet
*!draft audit -> will check for inconsistencies between the spreadsheet and database and list errors
*!draft sync -> will fix the errors found by draft audit
=== !ratings ===
Used to show ratings of players or gather a list of the players that have a certain rating. 
* !ratings Achmed Khan
* !ratings Speed 6
=== !clankycoins ===
Keeps track of made up coins for anybody. Only awarded by people with a "Commissioner" role.
* !clankycoins @jibbodahibbo -> displays jibbodahibbo's coin totals.
* !clankycoins add @Jlund24 300 -> gives JLund24 300 coins.
* !clankycoins remove @jibbodahibbo 50 -> removes 50 coins from jibbodahibbo. 
* !clankycoins ledger -> shows all the users who have clankycoins
* !clankycoins unbank 209348567293-> using the user id, it deletes a user from the ledger
=== !schedules ===
A commissioner only command that can schedule league games for coaches.
* !schedules lulu 3 @Monsters BB @Twins MB -> This creates a lulu league week 3 matchup between the Monsters AT the Twins. The initials MB and BB are manager initials.
* !schedules view lulu 3 -> This shows the schedule for week 3 in lulu league, also shows which teams have confirmed results.
* !schedules delete 43 - > Each matchup will have an ID, you can see this with the view command. This is how you can delete a matchup if it was a mistake. 
*!schedules fixcoach jorge AA BB -> Changes the coach in the jorge league from AA to BB. This may need to happen if a coaches drop out, or take over other teams.
=== !standings ===
Shows the standings for a certain league (Uses the google sheets data)
=== !result ===
Submit a result to the schedule. This is for coaches to submit matches privately. The bot will display both images when both coaches have submitted their results.
This command requires an image, league, coach initials, Game# and optionally a score
Commissioner can clear a result for players with !result clear [league] [game#] [Coach initials]
Commisioners can spy on a result to ensure that it was not a mistake submission !result spy [league] [coach id] [game number]
*!result clear lulu 1 EX -> clears any result submissions that are in lulu league, by coach EX in game 1.
* !result spy s8 EX 1 -> this will dm the commissioner the image that was submitted by coach EX for game 1 in the LULU league.
== How to start a new Rbbl Season ==
# Check #Bot-Talk pins for any updates/errors/changes
# Draft Setup
## Add new database models to dbinit.js, export them in the module.export at the end of script.
## sync database models in byb-bot.js
## Update the players_01.js and players_03.js files for custom players or any updates.
## Update draft2001Channel and draft2003Channel in draft.js
## Update the const draft_sheet_id in draft.js
## Update coaches_01.js and coaches_03.js
## Get write/edit permissions from new google sheet
## Run the Draft ## reset command
# Schedule Setup
## s##01_schedule.js and s##03_schedule.js
## Inject schedule from json, update commands/schesules.js file for the new schedule files.
#Result Submission Setup
##Update result channel id's?
##add new season prefixes/id's/names to league_list array, must be lowercase
#Season Schedule Injection.
##Create 01 and 03 schedules.js files by duplicating the previous season.
##Change the teams const at the top for the new roles.
##Update variable and module names so that they match the new season
##Use the csv conversion tool to create a json file of the schedule and paste it for the new seasons.
##In command/sschedule.js swap out all references of the previous season and use the current season (variable declaration at the top and, inject function).
#Inject schedule using discord command
##!schedules inject s12 --> injects the season 12 schedules for both 01 and 03
##Check each week with !schedules view seasonnickname03 week# example; "!schedules view funnybones03 4" --> Will display the week 4 of the 03 league.