3export let dict = async (word: string) => {
4 const req = await fetch(
5 `https://api.dictionaryapi.dev/api/v2/entries/en/${word}`
6 );
7 const res = await req.json();
1export function myApi(name) {
2 return "hi " + name;
3}
3// Predict the nationality of a name
4export let nameNationality = fetchJSON(
5 "https://api.nationalize.io/?name=axel",
6);
13 return `https://${userHandle}-${valName}.web.val.run`;
14 case "run":
15 return `https://api.val.town/v1/run/${userHandle}.${valName}`;
16 case "express":
17 return `https://${userHandle}-${valName}.express.val.run`;
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}