Public vals
4
begoon
ghdb
HTTP
This val implements a simple key/value database with GitHub, in a CRUD way. The key is a file path within a repository. The value is the file content. The val needs a GitHub token to access the GitHub API, the account name
and the repository name. Also, the val needs GHDB_API_KEY variable. This value defines the exptected
value of the GHDB_API_KEY header to allow access to the endpoints. Endpoints: GET /data/path/to/file.ext - read file GET /raw/path/to/file.ext - read file from GitHub CDN (10 times faster) DELETE /data/path/to/file.ext - delete file POST /data/path/to/file.ext - create file PUT /data/path/to/file.ext - update/commit file
0
begoon
thisval
Script
This val default exports a function returning ValInfo. The val information comes from the Deno stack trace induced by throw new Error() . type ValInfo = {
stack: string[]; // mostly for debugging
endpoint: string; // val endpoint URL, empty if it is not an HTTP val
user: string; // val.town user name
name: string; // val name
}; Here is an example program: import thisval from "https://esm.town/v/begoon/thisval";
const val = thisval();
export default async function(req: Request): Promise<Response> {
return Response.json(val);
} when invoked, it returns: {
"stack": [
"Error",
" at info (https://esm.town/v/begoon/thisval?v=12:10:11)",
" at https://esm.town/v/begoon/thisvaltest?v=2:3:13"
],
"endpoint": "begoon-thisvaltest.web.val.run",
"user": "begoon",
"name": "thisvaltest"
}
2
begoon
telegrambot
HTTP
This val is a demo skeleton of a telegram chat bot. It requires the BOT_TOKEN environment varialbe, which the telegram bot token. Another required variable is ME. The variable is an HTTP header to call a few extra endpoints (see the code). One of those endpoints is /webhook/set , which installs the webhook to activate the bot. The code is mostly educational. The bot echos back incoming messages. There is one command, /ai , which sends the incoming messages to Open AI and forwards the reply back to the chat.
1