{"id":13764588,"url":"https://github.com/brh55/generator-spark-bot","last_synced_at":"2025-04-12T18:12:38.661Z","repository":{"id":57248901,"uuid":"80187859","full_name":"brh55/generator-spark-bot","owner":"brh55","description":":zap: Yeoman generator that scaffold out a Cisco spark bot with usability and simplicity in mind","archived":false,"fork":false,"pushed_at":"2017-03-21T21:19:55.000Z","size":69,"stargazers_count":6,"open_issues_count":2,"forks_count":1,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-04-12T18:12:33.766Z","etag":null,"topics":["cisco","cisco-spark","flint","nodejs","scaffold","spark","yeoman"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/brh55.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":"contributing.json","funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-01-27T07:02:19.000Z","updated_at":"2022-01-31T21:34:03.000Z","dependencies_parsed_at":"2022-08-24T16:51:13.421Z","dependency_job_id":null,"html_url":"https://github.com/brh55/generator-spark-bot","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/brh55%2Fgenerator-spark-bot","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brh55%2Fgenerator-spark-bot/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brh55%2Fgenerator-spark-bot/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/brh55%2Fgenerator-spark-bot/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/brh55","download_url":"https://codeload.github.com/brh55/generator-spark-bot/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248610341,"owners_count":21132919,"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":["cisco","cisco-spark","flint","nodejs","scaffold","spark","yeoman"],"created_at":"2024-08-03T16:00:23.386Z","updated_at":"2025-04-12T18:12:38.638Z","avatar_url":"https://github.com/brh55.png","language":"JavaScript","funding_links":[],"categories":["Code samples"],"sub_categories":["Bot samples"],"readme":"# generator-spark-bot [![Travis](https://img.shields.io/travis/brh55/generator-spark-bot.svg?style=flat-square)](https://travis-ci.org/brh55/generator-spark-bot) [![XO code style](https://img.shields.io/badge/code_style-XO-5ed9c7.svg?style=flat-square)](https://github.com/sindresorhus/xo)\n\n\u003e `generator-spark-bot` is a [yeoman](http://yeoman.io/) generator that scaffolds out a node Cisco Spark bot following an `event-driven` fashion, and is extremely easy to get started with.\n\u003e\n\u003e **trigger context =\u003e callback()**\n\nDesigned with simplicity and usability in mind:\n- Fast to get started, just drop a `.js` file within `/commands` and your bot will register a listener on start\n- Easier unit testing with access to commands' private methods\n- Includes Flint for a more robust framework\n\n## Usage\nEnsure yeoman is is installed:\n\n`npm install -g yo` or `yarn global add yo`\n\nAfter yeoman is installed:\n\n```bash\n$ mkdir project-name\n$ cd project-name\n$ yo spark-bot\n```\n\n## App Structure\n```\n.\n├── commands                  # Event handlers are within the commands\n│   └── example.js            # An example command for reference\n├── app.js                    # Bot entry point\n├── config.js                 # Configurations\n├── test.js                   # AVA Test\n├── readme.md\n├── license\n└── package.json\n```\n\n## Commands\n\nCommands will instruct the bot on when and how to respond to particular contextual triggers.\n\nTo add a command, simply add a `.js` file within the commands directory. When the bot is initializing, commands will automatically register with Flint at runtime.\n\nThese command must implement an interface that contains a `trigger` property and a `callback` method. Refer to `example.js` within the commands directory.\n\n#### trigger | [`\u003cRegEx\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions), [`\u003cstring\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Data_structures#String_type)\n\nThe contextual trigger that will cause the bot to execute the callback upon matches.\n\n#### callback | [`\u003cfunction\u003e`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions)\n\nThe function to be executed (event handler).\n\n## Command Sub-generator\n`yo spark-bot:command`\n\nFor convenience, the `:command` sub-generator will generate a new command within the `/commands` directory.\n\n## Scripts\n\n- `npm run test` - Run linter and unit test\n- `npm start` - Start the bot\n- `npm run debug` - Activate debugging to log\n\n## Unit Testing\nUnit testing is straightforward, simple, and already configured with the AVA test runner. Commands are accessible through the `fileName` as a property of the `commands` object. Thus, any command callbacks can be tested as such: `commands.fileName.callback`.\n\nIn addition, the `rewire` module is pre-configured to test private methods and is easily accessible without the need of exporting any private methods. This is done with the `__get__()` method. IE: `commands.example.__get__('buildExampleMessage')`.\n\n## Tech Dependencies\n#### Test Runner\n- [AVA](https://github.com/avajs/ava) - 🚀 Futuristic JavaScript test runner\n\n#### Linter\n- [XO](https://github.com/sindresorhus/xo) - JavaScript happiness style linter\n\n#### Framework\n- [Express](https://github.com/expressjs/express) - Fast, unopinionated, minimalist web framework for node.\n- [Flint](https://github.com/flint-bot/flint) - Cisco Spark Bot SDK for Node JS\n\n## License\nMIT © [Brandon Him](https://github.com/brh55/generator-spark-bot)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrh55%2Fgenerator-spark-bot","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbrh55%2Fgenerator-spark-bot","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbrh55%2Fgenerator-spark-bot/lists"}