From 07eca7a7612a5d3bc7ded941a7feb8d839ae75c2 Mon Sep 17 00:00:00 2001 From: taylor Date: Sat, 2 Nov 2024 14:33:19 -0600 Subject: [PATCH] trim comment --- .../views/components/strategy/Comment.svelte | 2 +- scripts/SEND_EMAILS.ts | 31 +++++++++++++++++++ 2 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 scripts/SEND_EMAILS.ts diff --git a/client/views/components/strategy/Comment.svelte b/client/views/components/strategy/Comment.svelte index a6a8f11db..f506df76e 100644 --- a/client/views/components/strategy/Comment.svelte +++ b/client/views/components/strategy/Comment.svelte @@ -20,7 +20,7 @@ onMount(() => { strategy.on('update', update); - comment = strategy.comment; + comment = strategy.comment.trim(); if (!comment) defaultComment(); return () => { diff --git a/scripts/SEND_EMAILS.ts b/scripts/SEND_EMAILS.ts new file mode 100644 index 000000000..605578c77 --- /dev/null +++ b/scripts/SEND_EMAILS.ts @@ -0,0 +1,31 @@ +import { TBA } from "../server/utilities/tba/tba"; +import { Loop } from "../shared/loop"; +import { Email, EmailType } from "../server/utilities/email"; + +const main = async () => { + const loop = new Loop(async () => { + const matches = (await TBA.get('/event/2024cabl/matches/simple')).unwrap(); + console.log('Matches:', matches); + if (!matches) return; + if (matches.length === 0) return; + const e = new Email( + ['taylor.reese.king@gmail.com', 'stuart.king@boiseschools.org', 'stuking65@gmail.com', 'raygenrrupe@gmail.com'], + 'Cabl Match Schedule Released', + EmailType.text, + { + constructor: { + message: 'The match schedule for the upcoming competition has been released. Please check the schedule to see when your team is competing.', + title: 'CABL Match Schedule Released', + } + } + ); + console.log('Sending email'); + (await e.send()).unwrap(); + process.exit(0); + }, 5 * 60 * 1000); + + + loop.start(); +}; + +main(); \ No newline at end of file