Skip to content

Ugly javascript to automate google forms creation/summation & output to google sheets + discord.

Notifications You must be signed in to change notification settings

tyrannasaurusbanks/leroy-discord-webhook

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

Inspired by Google forms to discord.

What (words)

Ugly javascript which:

  • Automates creation of google forms for daily fantasty football auctions
  • Sends auction/form links, reminders & end summary/winners to a discord channel
  • Read/Writes auction state and team rosters/budgets to a google sheet.

What (pictures)

Screenshot 2021-05-08 at 15 33 48

Screenshot 2021-05-04 at 20 20 29

Screenshot 2021-05-04 at 20 22 11

Screenshot 2021-05-04 at 20 17 44

Screenshot 2021-05-04 at 20 20 46

Screenshot 2021-05-04 at 20 35 07

Why

Used for Casa Del Leroy Fantasy Football league to conduct daily Vickery blind-auctions for a slow Fantasy football draft. We were converting from redraft to dyansty & we thought we'd do something special for the startup auction whilst lock down was going on.

How

This section will be a guide for a Leroy on how to create form (any special formatting), how to attach the script, any options to toggle on form.

Form info

Daily auction are created from a auctions sheet. The nomination list needs to be in the following format:

| playerA | playerB | auction date - dd/mm/yyyy | form-url - this will be filled in by script |
| Tom Brady |	Cam Newton |	4/20/2020 |	https://docs.google.com/forms/d/<UID>/edit |

PlayerA and auction date a mandatory.

Running createWeeklyAuctionForms() will:

  • read all the auctions entries from a google sheet tab
  • filter out ones which already have a form (as evident by presence of a form-url)
  • create a form for playerA (and playerB if present)
  • attach a onSubmit() trigger to the form which will log bids as they come in (for audit purposes in case some jackass disputes)
  • attach a datetime trigger to close & summarise the auction at a set time
  • submit a dummy $1 bid in place of the person who nominated the players
  • post a link of all auctions created to discord.

We run this once a week:

  • we take nominations in a free form on Sunday day
  • format them into 1 or 2 player per-day in the auctions sheet
  • run the script to create auctions for the coming week.

End of day summaries

The timer trigger assigned to the forms at creation are scheduled to run the function endDailyAuctions() on the day which auction finishes. It will read the auctions list, filter out any not ending today (the date the script is running), and will order the bids, find a winner, and send a summary to discord.

It' all write results to a separate tab in th summary spreadsheet in the following format:

| user |	player |	bid |	time |	win |
| bidder@gmail.com	| Justin Jackson|	1	| 4/16/2020	| |

Summary note for the auction

A receipt of your form submission will be sent to the specified email address.
You will need a valid email to bid - please use the same email for every auction - this will allow us to track budgets.

Live budgets can be found here: <link to google sheet>

Auction Rules:
- Starting budget is $10,000.
- The auction will close at 9pm GMT, at which point the form will lock.
- You can edit your bids as many times as you want.
- You need to draft a full roster (15 players) but it doesn't have to be a valid starting lineup.
- As soon as you have 15 players, your draft ends.                                   

Auction Format:
- Auctions are conducted using the Vickery Method.
- Bids are blind & sealed.
- The highest bidder wins but the price paid is the second-highest bid.
- Nominations are effectively a $1 bid from the nominating-team.

Auction Technical Details:
- Bids should be whole numbers - decimals will be rounded down.
- Max bid = remaining budget - num players needed to complete roster + 1
- If you bid more than your 'max bid' then your bid will be struck off. 
- If you win both auctions but cannot afford both players then the highest bid will take priority and your bids from the other player auction(s) will be stuck off.
- If you win both auctions with equal bids, the first listed auction will take priority.

Auction Results:
- Full results (who bid what) will be send to the Leroy Discord channel & draft summary spread sheet after auction closes.
- If you don't want to bid on a player, leave the player's box empty.
- If you don't want to bid on any players, don't even need to submit the form.

Auction Tie Breakers
- In the event of equal bids, earliest bid wins.```

Useful

This was super useful: https://leovoel.github.io/embed-visualizer/

About

Ugly javascript to automate google forms creation/summation & output to google sheets + discord.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published