Discord API examples & templates
Use these vals as a playground to view and fork Discord API examples and templates on Val Town. Run any example below or find templates that can be used as a pre-built solution.
steveruizok
tldraw_computer_example
HTTP
tldraw computer custom endpoint example This val is an example custom endpoint for tldraw computer 's data component. Usage To use this val with tldraw.computer, follow these steps: Fork this Val. Click the Copy endpoint button on your new Val. Open a project on tldraw.computer Create a Data component in your tldraw computer project In the Source dropdown, select Custom and the POST method Paste the endpoint into Data component's the HTTP Endpoint input. Run the component. To see the output, connect the Data component to a Text component. How it works In tldraw computer, you can configure a Data component to use a custom HTTP endpoint as its data source. You can also configure the request method, either GET or POST. If a Data component's request method is POST, then when the component next updates, it will send a POST request to the endpoint. The request's body will contain an array of the Data objects that the component had received as inputs. If the request method if GET, then the component will only make the requestβits body will be empty. In both cases, the component will expect back a response that includes an array of Data objects these objects will be passed along as the data component's outputs. The endpoint (your forked version of this Val) can do whatever it likes between the request and response, but the response must include data in the correct format. If the format is wrong, the computer app will create a text data object instead that includes the response as plain text. Support If you're running into any difficulties, check out the #tldraw-computer channel on the tldraw discord.
3
valdottown
templateHackerNewsAlert
Cron
Hacker News Keyword Alerts [TEMPLATE] Get notifications when specific keywords appear in Hacker News posts. This template will help you: Search Hacker News for specific keywords. Send notifications to your preferred platform (Discord, Slack, email, etc.), the default in this template is Discord. Example This val tracks mentions of "Val Town" on Hacker News and sends updates to a Discord webhook.
Set Up 1. Fork this Val To start using this template, fork this val by clicking the fork button at the top-right corner of the page.
2. View Source Code The CODE box shows you the the full source code of this val, you may need to scroll down to see it.
3. Customize Keyword In the CODE box below, update the terms or phrases you want to track:
query: '"val town" || "val.town"' 5. Set Up Your Notification Method This template uses a Discord webhook for notifications. You can update this to your preferred platform: Create a Discord webhook following this guide .
Save your webhook URL in your Val Town environment variables: Key: mentionsDiscord Value: Your Discord webhook URL.
Notifications will be sent using this function: await discordWebhook({
url: Deno.env.get("mentionsDiscord"),
content,
}); To switch to another platform (e.g., Slack, email, or custom webhooks), replace the discordWebhook call with the appropriate integration ((e.g., @std/email , Slack , or anywhere else ) π Congrats! You now have a val running that ensures you never miss another Hacker News mention. π
0