3export const telegramSendPhoto = async (botToken: string, options: TelegramSendPhotoOptions) =>
4 fetchJSON(
5 `https://api.telegram.org/bot${botToken}/sendPhoto`,
6 {
7 method: "POST",
1Migrated from folder: Archive/telegramValTownAPI
3async function getOpenAI() {
4 // if you don't have a key, use our std library version
5 if (Deno.env.get("OPENAI_API_KEY") === undefined) {
6 const { OpenAI } = await import("https://esm.town/v/std/openai");
7 return new OpenAI();
13 <link rel="shortcut icon" href="/favicon.png">
14 <meta name="theme-color" content="#224946">
15 <link rel="preconnect" href="https://fonts.googleapis.com">
16 <link rel="preconnect" href="https://fonts.gstatic.com" crossorigin="">
17 <link href="https://fonts.googleapis.com/css2?family=Outfit:wght@400;800&display=swap" rel="stylesheet">
18 <style>
19 body {
1026
1027 <section class="canibuild-search-widget">
1028 <div id="canibuild-widget-search-root" data-token="embedme"><form id="widget-search-form"><div class="ui-MuiBox-root ui-ui3 cib-widget-searchbar-wrapper" data-tour="searchbar"><div class="ui-MuiAutocomplete-root ui-MuiAutocomplete-fullWidth ui-MuiAutocomplete-hasClearIcon" role="combobox" aria-expanded="false"><div class="ui-MuiFormControl-root ui-MuiTextField-root ui-ui7 ui-ui8 ui-MuiFormControl-fullWidth"><div class="ui-MuiInputBase-root ui-MuiOutlinedInput-root ui-ui4 cib-widget-searchbar-input ui-MuiInputBase-fullWidth ui-MuiInputBase-formControl ui-MuiInputBase-adornedStart ui-MuiOutlinedInput-adornedStart ui-MuiInputBase-adornedEnd ui-MuiOutlinedInput-adornedEnd"><div class="ui-MuiInputAdornment-root ui-MuiInputAdornment-positionStart"><svg width="38" height="32" viewBox="0 0 38 32" fill="none" xmlns="http://www.w3.org/2000/svg"><g id="logo"><g id="Group"><g id="Group_2"><path id="Vector" d="M22.0826 19.7664C20.7646 21.886 18.4918 23.1497 16.0038 23.1497C12.0589 23.1497 8.84918 19.9412 8.84918 15.9978C8.84918 12.0543 12.0589 8.84582 16.0038 8.84582C18.4918 8.84582 20.7646 10.114 22.0826 12.2336L22.4592 12.843L29.9814 8.17813L29.6049 7.56869C26.6596 2.8321 21.576 0 16.0083 0C7.18156 0 0 7.17883 0 15.9978C0 24.8167 7.18156 32 16.0083 32C21.576 32 26.6596 29.1679 29.6094 24.4268L29.9859 23.8174L22.4637 19.157L22.0871 19.7619L22.0826 19.7664ZM27.9955 24.2745C25.2654 28.2313 20.8364 30.5705 16.0038 30.5705C7.96606 30.5705 1.43004 24.0325 1.43004 16.0022C1.43004 7.97199 7.97054 1.42949 16.0083 1.42949C20.8364 1.42949 25.2654 3.76866 28 7.72553L22.903 10.8847C21.2847 8.69794 18.7608 7.41633 16.0128 7.41633C11.2789 7.41633 7.42811 11.2656 7.42811 15.9978C7.42811 20.7299 11.2789 24.5792 16.0128 24.5792C18.7608 24.5792 21.2847 23.2931 22.903 21.1108L28.0045 24.27L27.9955 24.2745Z" fill="#24B574"></path><path id="Vector_2" d="M35.492 7.57322L35.1154 6.96826L27.5977 11.6287L27.9742 12.2381C28.678 13.3674 29.0456 14.6714 29.0456 16.0023C29.0456 17.3332 28.6735 18.6417 27.9742 19.7709L27.5977 20.3804L35.1199 25.0408L35.4965 24.4358C37.07 21.9085 37.9038 18.9912 37.9038 16.0068C37.9038 13.0223 37.07 10.1096 35.4965 7.5777L35.492 7.57322ZM34.6402 23.0556L29.5432 19.8964C30.1574 18.6955 30.4801 17.3601 30.4801 15.9978C30.4801 14.6355 30.1574 13.3046 29.5432 12.0992L34.6402 8.93997C35.8372 11.0909 36.4693 13.5152 36.4693 15.9933C36.4693 18.4714 35.8417 20.8957 34.6402 23.0512V23.0556Z" fill="#24B574"></path></g></g></g></svg></div><input aria-invalid="false" autocomplete="off" id="address-searchbar" placeholder="Search Address" type="text" class="ui-MuiInputBase-input ui-MuiOutlinedInput-input ui-MuiAutocomplete-input ui-MuiAutocomplete-inputFocused ui-MuiInputBase-inputAdornedStart ui-MuiOutlinedInput-inputAdornedStart ui-MuiInputBase-inputAdornedEnd ui-MuiOutlinedInput-inputAdornedEnd" aria-autocomplete="list" autocapitalize="none" spellcheck="false" aria-label="search address" value=""><button class="ui-MuiButtonBase-root ui-MuiButton-root ui-ui9 ui-MuiButton-contained ui-ui10 ui-ui13" tabindex="0" type="submit" customcolor="#224946"><span class="ui-MuiButton-label">Build</span><span class="ui-MuiTouchRipple-root"></span></button><fieldset aria-hidden="true" class="ui-ui16 ui-MuiOutlinedInput-notchedOutline" style="padding-left: 8px;"><legend class="ui-ui17" style="width: 0.01px;"><span></span></legend></fieldset></div></div></div></div></form></div>
1029 </section>
1030 </div>
61
62 async transaction(stmts: InStatement[]): Promise<DatabaseResultSet[]> {
63 const r = await fetch(`/api/batch`, {
64 method: "POST",
65 headers: {
81
82 async query(stmt: InStatement): Promise<DatabaseResultSet> {
83 const r = await fetch(`/api/execute`, {
84 method: "POST",
85 headers: {
23
24 capturePostHogEvent(
25 Deno.env.get("phProjectAPIKey"),
26 "github-" + webhookPayload.sender.login,
27 "GitHub Star",
5// export let twitterJSON = ({ url, bearerToken }) =>
6// fetchJSON(
7// "https://felt.com/api/v1/maps/SssjclTrScGmH4TfPHzNjD/elements",
8// { headers: { authorization: `Bearer ${"felt_pat_ZAqb6bBSE2Na1wDVtZQE17p/sK/+odCnpa1CqLMkcXA"}` } },
9// );
11// export function handler(request: Request) {
12// let elements = fetchJSON(
13// "https://felt.com/api/v1/maps/SssjclTrScGmH4TfPHzNjD/elements",
14// { headers: { authorization: `Bearer ${"felt_pat_ZAqb6bBSE2Na1wDVtZQE17p/sK/+odCnpa1CqLMkcXA"}` } },
15// );
20export default async function(req: Request): Promise<Response> {
21 return fetch(
22 "https://felt.com/api/v1/maps/SssjclTrScGmH4TfPHzNjD/elements",
23 // headers: { authorization: `Bearer ${"felt_pat_ZAqb6bBSE2Na1wDVtZQE17p/sK/+odCnpa1CqLMkcXA"}` }
24 );
5
6let currency = async (desired, base = "usd", amount = 1) => {
7 // let { rates } = await fetchJSON(`https://open.er-api.com/v6/latest/${base}`);
8 // if (rates && rates[desired.toUpperCase()]) return amount * (rates[desired.toUpperCase()]);
9 // else {
10 let { rates } = await fetchJSON("https://api.coingecko.com/api/v3/exchange_rates");
11 return amount * rates[desired.toLowerCase()]?.value / rates[base.toLowerCase()]?.value;
12};
16});
17
18app.route("/api")
19 // for /api
20 .get("", () => new Response("api"))
21 // for /api/one
22 .get("/one", () => new Response("one"))
23 // for /api/two
24 .get("/two", () => new Response("two"));
25
1/**
2 * Function that randomly capitalizes or lowercases each character in a string.
3 * Inspired by the mocking Spongebob meme: https://knowyourmeme.com/memes/mocking-spongebob
4 *