Val Town Code SearchReturn to Val Town

API Access

You can access search results via JSON API by adding format=json to your query:

https://codesearch.val.run/$1?q=function&page=2461&format=json

For typeahead suggestions, use the /typeahead endpoint:

https://codesearch.val.run/typeahead?q=function

Returns an array of strings in format "username" or "username/projectName"

Found 28553 results for "function"(2802ms)

emailmain.tsx1 match

@aroyan•Updated 9 months ago
12 * The email address(es) to send the email to. Only available to Val Town Pro subscribers.
13 * Can be a single string, IAddress object, or an array of strings/IAddress objects.
14 * @default the email of the logged user calling this function.
15 */
16 to?: (IAddress | string)[] | IAddress | string;

ruralCrimsonGuppymain.tsx3 matches

@jamisonl•Updated 9 months ago
22const rest = new REST({ version: "9" }).setToken(process.env.DISCORD_BOT_TOKEN);
23
24async function findUserVoiceChannel(guildId, userId) {
25 try {
26 const channels = await rest.get(Routes.guildChannels(guildId));
39}
40
41async function sayMessage(guildId, channelId, message) {
42 const url = googleTTS.getAudioUrl(message, {
43 lang: "en",
68}
69
70function createDiscordJSAdapter(channelId, guildId) {
71 return {
72 sendPayload: (payload) => {

ruralCrimsonGuppyREADME.md1 match

@jamisonl•Updated 9 months ago
1Bot for Cama discord server. To initialize new slash commands, you have to run a separate bit of code. This is for modifying their functionality

valTopicGenmain.tsx3 matches

@roramigator•Updated 9 months ago
89];
90
91async function getCurrentTopic() {
92 const storedTopic = await blob.getJSON("currentTopic");
93 if (storedTopic && new Date(storedTopic.expiresAt) > new Date()) {
105}
106
107function TopicDisplay({ topic, expiresAt }) {
108 const expirationDate = new Date(expiresAt);
109 const timeRemaining = expirationDate - new Date();
130}
131
132export default async function server(req: Request): Promise<Response> {
133 const currentTopic = await getCurrentTopic();
134 const { renderToString } = await import("https://esm.sh/react-dom/server");

luciaValtownSqlitemain.tsx8 matches

@yawnxyz•Updated 9 months ago
236}
237
238function transformIntoDatabaseSession(raw: SessionSchema): DatabaseSession {
239 const { id, user_id: userId, expires_at: expiresAtUnix, ...attributes } = raw;
240 return {
246}
247
248function transformIntoDatabaseUser(raw: UserSchema): DatabaseUser {
249 const { id, ...attributes } = raw;
250 return {
254}
255
256function escapeName(val: string): string {
257 return "`" + val + "`";
258}
259
260// Helper functions
261export async function createTables(userTable: string, sessionTable: string) {
262 return sqlite.batch([
263 `CREATE TABLE IF NOT EXISTS ${userTable} (
277}
278
279export async function createUser({ userTable, sessionTable, username, password, github_id, google_id }: {
280 userTable: string;
281 sessionTable: string;
299}
300
301export async function getUser(
302 { userTable, username, github_id, google_id }: {
303 userTable: string;
330}
331
332export async function verifyPassword(hashed_password: string, password: string): Promise<boolean> {
333 return new Scrypt().verify(hashed_password, password);
334}

stormyCyanLeoponmain.tsx1 match

@stevekrouse•Updated 9 months ago
6 webhook_url: string = process.env.discord_webhook,
7) => {
8 function chunkString(str) {
9 const chunks = [];
10 let startIndex = 0;

stormyCyanLeoponREADME.md3 matches

@stevekrouse•Updated 9 months ago
1# Send Chunked Discord Message
2This function is used to send a message to a Discord webhook. If the message exceeds the maximum character limit (2000 characters), it will be divided into chunks and sent as multiple messages.
3
4### Parameters
5message (string): The message to be sent to the Discord webhook.
6### Return Value
7This function does not return any value.
8
9## Example Usage:
13await @ktodaz.sendDiscordMessage(message);
14```
15In the above example, the sendDiscordMessage function is used to send the message to the Discord webhook. If the message exceeds 2000 characters, it will be split into smaller chunks and sent as separate messages.
16
17## Required Secrets:

sendDiscordMessageREADME.md3 matches

@stevekrouse•Updated 9 months ago
1# Send Chunked Discord Message
2This function is used to send a message to a Discord webhook. If the message exceeds the maximum character limit (2000 characters), it will be divided into chunks and sent as multiple messages.
3
4### Parameters
5message (string): The message to be sent to the Discord webhook.
6### Return Value
7This function does not return any value.
8
9## Example Usage:
13await @ktodaz.sendDiscordMessage(message);
14```
15In the above example, the sendDiscordMessage function is used to send the message to the Discord webhook. If the message exceeds 2000 characters, it will be split into smaller chunks and sent as separate messages.
16
17## Required Secrets:

sendDiscordMessagemain.tsx1 match

@stevekrouse•Updated 9 months ago
6 webhook_url: string = process.env.discord_webhook,
7) => {
8 function chunkString(str) {
9 const chunks = [];
10 let startIndex = 0;

aloneBronzeCattlemain.tsx3 matches

@jamisonl•Updated 9 months ago
22const rest = new REST({ version: "9" }).setToken(process.env.DISCORD_BOT_TOKEN);
23
24async function findUserVoiceChannel(guildId, userId) {
25 try {
26 const channels = await rest.get(Routes.guildChannels(guildId));
39}
40
41async function sayMessage(guildId, channelId, message) {
42 const url = googleTTS.getAudioUrl(message, {
43 lang: "en",
68}
69
70function createDiscordJSAdapter(channelId, guildId) {
71 return {
72 sendPayload: (payload) => {

getFileEmail4 file matches

@shouser•Updated 1 month ago
A helper function to build a file's email
tuna

tuna8 file matches

@jxnblk•Updated 1 month ago
Simple functional CSS library for Val Town
lost1991
import { OpenAI } from "https://esm.town/v/std/openai"; export default async function(req: Request): Promise<Response> { if (req.method === "OPTIONS") { return new Response(null, { headers: { "Access-Control-Allow-Origin": "*",
webup
LangChain (https://langchain.com) Ambassador, KubeSphere (https://kubesphere.io) Ambassador, CNCF OpenFunction (https://openfunction.dev) TOC Member.