48 preferredUsername: `bot`,
49 summary: `Photos from ${DOMAIN}.com`,
50 inbox: `https://${DOMAIN}/api/inbox`,
51 followers: `https://${DOMAIN}/u/bot/followers`,
52 icon: {
1import { discordAPI } from "https://esm.town/v/stevekrouse/discordAPI";
2
3// https://discord.com/developers/docs/resources/channel#get-channel-messages
4export let discordGetMessages = ({token, tokenType, channelId}) => discordAPI({
5 token,
6 tokenType,
4 // );
5 // const { BskyAgent, AtpSessionEvent, AtpSessionData } = await import(
6 // "npm:atproto/api"
7 // );
8 // const _ = await import("npm:lodash-es"); // The Lodash library exported as ES modules.
9 const { BskyAgent } = await import("npm:@atproto/api");
10 // return _.shuffle(_.zip([1, 2, 3, 4], [5, 6, 7, 8]));
11 const agent = new BskyAgent({
1import { fetch } from "https://esm.town/v/std/fetch";
2
3export let gpt3 = async (prompt: string, openAiApiKey: string): Promise<string> => {
4 if (!prompt || !openAiApiKey) {
5 let cat = await fetch("https://catfact.ninja/fact");
6 let { fact } = await cat.json();
7 return Promise.reject(
8 `Prompt text or api key was not provided. \n \n here's a cat fact: \n ${fact}`,
9 );
10 }
11 const content = await fetch("https://api.openai.com/v1/chat/completions", {
12 method: "POST",
13 body: JSON.stringify({
17 }),
18 headers: {
19 "Authorization": `Bearer ${openAiApiKey}`,
20 "Content-Type": "application/json",
21 },
8 maxTokens: 25,
9 streaming: true,
10 openAIApiKey: process.env.OPENAI_API_KEY,
11 });
12 const response = await chat.call("Tell me a joke.", undefined, [
1export function myApi(name) {
2 return "hi " + name;
3}
3// GitHub starred repos
4export let githubStarred = fetchJSON(
5 "https://api.github.com/users/klapacz/starred"
6);
1import { fetchJSON } from "https://esm.town/v/stevekrouse/fetchJSON?v=41";
2
3// Explore the Star Wars universe, from StarWarsAPI
4export let starWars = fetchJSON(
5 "https://swapi.dev/api/people/1/"
6);
1export function myApi(name) {
2 return "hi " + name;
3}
30}) => {
31 const { z } = await import("npm:zod");
32 const RESY_API_URL = "https://api.resy.com";
33 const RESY_DEFAULT_HEADERS = {
34 accept: "application/json, text/plain, */*",
35 "accept-encoding": "gzip, deflate, br",
36 "accept-language": "en-US,en;q=0.9",
37 authorization: 'ResyAPI api_key="VbWk7s3L4KiK5fzlO7JD3Q5EYolJI7n5"',
38 "x-origin": "https://resy.com",
39 origin: "https://resy.com/",
143 params.email
144 )}&password=${encodeURIComponent(params.password)}`;
145 const response = await fetch(`${RESY_API_URL}/3/auth/password`, {
146 method: "POST",
147 body: body,
164 seats: number;
165 }) => {
166 const url = `${RESY_API_URL}/3/details`;
167 const response = await fetch(url.toString(), {
168 method: "POST",
183 seats: number;
184 }) => {
185 const url = `${RESY_API_URL}/4/find`;
186 const searchParams = new URLSearchParams();
187 searchParams.set("lat", "0");
206 city: string;
207 }) => {
208 const url = `${RESY_API_URL}/3/venue`;
209 const searchParams = new URLSearchParams();
210 searchParams.set("url_slug", params.slug);
222 authToken: string;
223 }) => {
224 const response = await fetch(`${RESY_API_URL}/3/book`, {
225 method: "POST",
226 headers: {