{"id":17674254,"url":"https://github.com/joshgachnang/val","last_synced_at":"2025-05-12T21:12:21.767Z","repository":{"id":42354418,"uuid":"71064931","full_name":"joshgachnang/val","owner":"joshgachnang","description":"An API for running my life. Hosts the backend for a magic mirror, a chat bot, a recipe app currently. More to come soon :)","archived":false,"fork":false,"pushed_at":"2023-01-23T22:28:01.000Z","size":3695,"stargazers_count":5,"open_issues_count":19,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-05-12T21:12:12.350Z","etag":null,"topics":["chatbot","chatbot-framework","recipe","slackbot"],"latest_commit_sha":null,"homepage":null,"language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"gpl-3.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/joshgachnang.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2016-10-16T17:12:05.000Z","updated_at":"2024-10-28T03:59:35.000Z","dependencies_parsed_at":"2023-01-24T19:32:13.964Z","dependency_job_id":null,"html_url":"https://github.com/joshgachnang/val","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshgachnang%2Fval","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshgachnang%2Fval/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshgachnang%2Fval/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/joshgachnang%2Fval/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/joshgachnang","download_url":"https://codeload.github.com/joshgachnang/val/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253823462,"owners_count":21969848,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["chatbot","chatbot-framework","recipe","slackbot"],"created_at":"2024-10-24T07:06:22.974Z","updated_at":"2025-05-12T21:12:21.741Z","avatar_url":"https://github.com/joshgachnang.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"## Val\n\n[](https://circleci.com/gh/pcsforeducation/val.svg?style=shield\u0026circle-token=:circle-token)\n[![styled with\nprettier](https://img.shields.io/badge/styled_with-prettier-ff69b4.svg)](https://github.com/prettier/prettier)\n\nAn chatbot for running my life. Based on Hubot, but with multiple simultaneous\nadapters. Currently Alexa, Twilio, and Slack are supported.\n\nHosts the backend for a magic mirror and a recipe app currently. More to come soon :)\n\n# Dev\n\n    npm install -g watchify browserify\n\n    npm start\n\n# Docs\n\n## Plugin\n\nA simple boilerplate plugin is available at `plugins/pluginStarter.ts`.\n\n### `hear()/respond()` patterns\n\nWhen registering a callback for your plugin, you can specifiy the trigger as any time the bot sees the phrase (`hear()`) or only when the phrase is directed to the bot (`respond()`).\nBoth take one of three types of triggers: a regex, an exact string match, or a string with slots.\n\n#### regex:\n\n    robot.hear(/hello/, {}, (res: Response) =\u003e {\n      res.send(res.envelope, \"Hello there!\");\n    });\n\n#### exact string:\n\n    robot.hear(\"Hello\", {}, (res: Response) =\u003e {\n      res.send(res.envelope, \"Hello there!\");\n    });\n\n#### Choice slots\n\nYou can present a list of possible strings to match by separating them with a \"|\" inside the slot syntax. If you add a \"|\" as the last character, the match will be optional.\n\n    // This will match \"hello there\", \"hi there\", \"hello\", and \"hi\"\n    robot.hear(\"{hello|hi} {there|}\", {}, (res: Response) =\u003e {\n      res.send(res.envelope, \"Hello there!\");\n    });\n\n#### Typed slots\n\nYou can also match a few provided slot types:\n\n    // This will match \"what is the price of dogecoin\" or \"what is the price of BTC\"\n    robot.hear(\"what is the price of {:WORD}\", {}, (res: Response) =\u003e {\n      res.send(res.envelope, \"Wow. Much sent! Such spend!\");\n    });\n\n    // This will match \"send 948 dogecoins\"\n    robot.hear(\"send {:NUMBER} dogecoins\", {}, (res: Response) =\u003e {\n      res.send(res.envelope, \"Wow. Much sent! Such spend!\");\n    });\n\n    // This will match \"simon says Do A Barrel Roll\"\n    // Be careful, because this will likely match to the end of the string\n    robot.hear(\"simon says {:MULTIWORD}\", {}, (res: Response) =\u003e {\n      res.send(res.envelope, \"Wow. Much sent! Such spend!\");\n    });\n\n## Async/Await Express\n\n`Robot` contains a function to wrap `Robot.router` Express functions to make\nthem handle async/await correctly called `expressWrap()`. Simply wrap the\ncallback function you give to the router in this wrapper and you can use\nasync/await as you'd expect.\n\n    async function hello() {\n      return 'hello world~';\n    }\n\n    robot.router.get('/hello', robot.expressWrap(async (req) =\u003e {\n      return await hello();\n    }));\n\n## Cron\n\n`Robot` exposes a method `cron()` which allows you to have a function\nexecuted on a schedule. This is easier to use than something like\n`setTimeout`, because you can specify at which time (wall time, rather\nthan in X milliseconds) you want your function executed at. For example:\n\n    // The function takes a name, a cron schedule, and callback.\n    robot.cron('6am logging', '0 6 * * *', () =\u003e {console.log(\"It is 6am!\")});\n\nIn this example, the console.log will happen at 6am every day. See [cron syntax](http://www.nncron.ru/help/EN/working/cron-format.htm) for more information on specifying a schedule.\n\nThe timezone will be whatever is specified via CRON_TIMEZONE in your config file or environment variables.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshgachnang%2Fval","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjoshgachnang%2Fval","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjoshgachnang%2Fval/lists"}