1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
import { fetchGiphy as fetchGiphy2 } from "https://esm.town/v/simply_say_m/fetchGiphy";
import { boredActivities } from "https://esm.town/v/simply_say_m/boredActivities";
export let getActivityAndGiphy =
(async (req: express.Request, res: express.Response) => {
const activity = await boredActivities();
const fetchGiphy = await fetchGiphy2(activity);
const { url } =
fetchGiphy[Math.floor(Math.random() * 10)].images.downsized_large;
return res.send(
`<div style='min-height:100vh; width: 100vw; margin:0; background: radial-gradient(circle, rgba(251,159,63,1) 54%, rgba(255,186,253,1) 100%);'>
<section style='display: flex; flex-direction: column; align-items: center;max-width: 980px; margin: 0 auto;'>
<h1 style='color: orangered; font-family: Palatino; font-size: 3rem; text-align: center;'> You are bored? Maybe:</h1>
<h1 style='color: orangered; font-family: Palatino; font-size: 3rem; text-align: center;'>${activity}</h1>
<img src='${url}'>
</section>
</div>`,
);
});