Trending Vals
156
tmcw
chatgptchess
HTTP
ChatGPT Chess Inspired by all this hubbub about chess weirdness , this val lets you play chess against ChatGPT 4 . Expect some "too many requests" hiccups along the way. ChatGPT gets pretty bad at making valid moves after the first 10 or so
exchanges. This lets it retry up to 5 times to make a valid move, but if it can't, it can't.
0
157
159
162
pomdtr
sql
Script
SQL Template Tag Port of blakeembrey/sql-template-tag for usage in val.town. Usage import { sqlite } from "https://esm.town/v/std/sqlite"
import { sql, zip } from "https://esm.town/v/pomdtr/sql"
const query = sql`SELECT * FROM books WHERE author = ${author}`;
console.log(query.sql) // => "SELECT * FROM books WHERE author = ?"
console.log(query.args) // => [author]
const res = await sqlite.execute(query)
console.table(zip(res)) For advanced usage (ex: nesting queries), refer to the project readme .
6
163
164
166
sarahxc
slackScout
Cron
Slack scout sends a slack notification every time your keywords are mentioned on Twitter, Hacker News, or Reddit. Get notified whenever you, your company, or topics of interest are mentioned online. Built with Browserbase . Inspired by f5bot.com . Full code tutorial . Getting Started To run Slack Scout, you’ll need a Browserbase API key Slack Webhook URL: setup here Twitter Developer API key Browserbase Browserbase is a developer platform to run, manage, and monitor headless browsers at scale. We’ll use Browserbase to navigate to, and scrape our different news sources. We’ll also use Browserbase’s Proxies to ensure we simulate authentic user interactions across multiple browser sessions . Get started with Browserbase for free here . Twitter We’ve decided to use the Twitter API to include Twitter post results. It costs $100 / month to have a Basic Twitter Developer account. If you decide to use Browserbase, we can lend our token. Comment below for access. Once you have the SLACK_WEBHOOK_URL , BROWSERBASE_API_KEY , and TWITTER_BEARER_TOKEN , input all of these as Val Town Environment Variables . Project created by Sarah Chieng and Alex Phan 💌
14
170
postpostscript
html
Script
html: create sanitized HTML using tagged templates Examples import { html } from "https://esm.town/v/postpostscript/html"
const unsafeInput = "<script>alert(1)</script>"
console.log(html`Value: ${unsafeInput}`)
// Value: <script>alert(1)</script> These can be combined -- HTML marked as safe (instance is RawHTML ) will be directly inserted: const scripts = html`<script>alert(1)</script>`
console.log(html`<head>
${scripts}
</head>`.toString())
// <head>
// <script>alert(1)</script>
// </head> To easily create HTTP Response outputs like @stevekrouse/html, use the htmlResponse utility: import { html, htmlResponse } from "https://esm.town/v/postpostscript/html";
export default function(req: Request) {
return htmlResponse`
Request URL: ${decodeURIComponent(req.url)}
`;
} Tests: @postpostscript/htmlTest
1
171
stevekrouse
pollRSSFeeds
Cron
Poll RSS feeds This val periodically polls specified RSS feeds and send the author an email with new items. It checks each feed defined in rssFeeds for new content since the last run and sends an email with the details of the new items. Usage Fork @stevekrouse/rssFeeds and update it with your desired RSS feeds; Fork this val and replace the https://esm.town/v/stevekrouse/rssFeeds import with your newly forked val; Enjoy RSS updates on your email!
5
174
178
jonasmerlin
bluesky_bot_template
Cron
This is a very simple template for the kind of Bluesky bot I build. It's very much all over the place. e.g. it sets up the "Agent" to post (because that part is documented well), but doesn't use it to search for posts. You can do that if you want (if you do, look here ), but I like to simply rawdogg the API, so that is what I'm doing here.
The custom Post type is incomplete and only contains the stuff I found relevant.
Error handling is payed only lip service to (at best) as well. ...But it works for me! How to use If you want to use this, you will have to set 2 environment variables for your val:
BLUESKY_USERNAME
BLUESKY_PASSWORD
From what I can tell from my testing: BLUESKY_USERNAME can be both the bot account's handle as well as the email you use to log into it with. BLUESKY_PASSWORD can be both the account's main password as well as an app password. The rest is commented in the code. If you have any questions, feel free to message me on Bluesky: Jonas-Merlin Schumacher (@jonasmerlin.bsky.social) — Bluesky
1
179
180
hootz
telegramDalleBot
Script
Telegram DALLE Bot A personal telegram bot you can message to create images with OpenAI's DALLE ✨ Set up yours fork this val speak to telegram’s https://t.me/botfather to create a bot and obtain a bot token set the bot token as a val town secret called telegramDalleBotToken add a random string as a val town secret called telegramDalleBotWebhookSecret set up your webhook with telegram like this: // paste and run this in your workspace on here
@vtdocs.telegramSetWebhook(@me.secrets.telegramDalleBotToken, {
url: /* your fork's express endpoint (click the three dots on a val) */,
allowed_updates: ["message"],
secret_token: @me.secrets.telegramDalleBotWebhookSecret,
}); message your bot some prompts! (if you get stuck, you can refer to the telegram echo bot guide from docs.val.town)
6