diff --git a/CHANGELOG.md b/CHANGELOG.md index cc7eb069..e6334d0d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,24 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] +## [1.2.0] - 2020-12-19 +### Changed: +- `ctx.options` are a bit more consistent with sub-commands. Check the [last heading in the documetation](https://slash-create.js.org/#/docs/main/v1.2.0/general/context-options) for an example. +### Added: +- Support for registering/unregistering commands + - New `SlashCreator` event: `commandUnregister` + - New `SlashCreator` event: `commandReregister` + - `SlashCreator.reregisterCommand(command, oldCommand)` + - `SlashCreator.unregisterCommand(command)` + - `SlashCommand.reload()` + - `SlashCommand.unload()` +- Unknown Commands +- [Support for Google Cloud Functions](https://slash-create.js.org/#/docs/main/v1.2.0/examples/gcf). (`GCFServer`) +### Fixed: +- Some documentation +- Command finalization +- Command throttling +- Command options validation ## [1.1.6] - 2020-12-18 ### Fixed: - Sending options as the first argument in `Context#send` & `Context#sendFollowUp` @@ -89,7 +107,7 @@ This release features mostly completed documentation and changes to the packages ## [0.1.0] - 2020-12-15 - Initial release. -[Unreleased]: https://github.com/Snazzah/slash-create/compare/v1.1.6...HEAD +[Unreleased]: https://github.com/Snazzah/slash-create/compare/v1.2.0...HEAD [0.1.0]: https://github.com/Snazzah/slash-create/releases/tag/v0.1.0 [0.2.0]: https://github.com/Snazzah/slash-create/compare/v0.1.0...v0.2.0 [1.0.0]: https://github.com/Snazzah/slash-create/compare/v0.2.0...v1.0.0 @@ -100,3 +118,4 @@ This release features mostly completed documentation and changes to the packages [1.1.4]: https://github.com/Snazzah/slash-create/compare/v1.1.3...v1.1.4 [1.1.5]: https://github.com/Snazzah/slash-create/compare/v1.1.4...v1.1.5 [1.1.6]: https://github.com/Snazzah/slash-create/compare/v1.1.5...v1.1.6 +[1.2.0]: https://github.com/Snazzah/slash-create/compare/v1.1.6...v1.2.0 diff --git a/README.md b/README.md index b1aca4e6..bb3b1772 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,8 @@ yarn add slash-create In order to use a specific webserver, you will need to install the dependency associated with that server. The following server types require these dependencies: - `ExpressServer`: `express` - `FastifyServer`: `fastify` -- `GatewayServer`: none, see [example](#using-a-discord-bot-with-create) +- `GatewayServer`: none, see [example](https://slash-create.js.org/#/docs/main/latest/examples/discord-bot) +- `GCFServer`: none technically, meant for use with [`@google-cloud/functions-framework`](https://npm.im/@google-cloud/functions-framework), see [example](https://slash-create.js.org/#/docs/main/latest/examples/gcf) ## Example diff --git a/docs/examples/gcf.md b/docs/examples/gcf.md new file mode 100644 index 00000000..52c24797 --- /dev/null +++ b/docs/examples/gcf.md @@ -0,0 +1,11 @@ +Before using the server, check out [how to use the functions module](https://www.npmjs.com/package/@google-cloud/functions-framework). + +```js +const { GCFServer } = require('slash-create'); + +creator + // The first argument is required, but rhe second argument is the "target" or the name of the export. + // By default, the target is "interactions". + .withServer(new GCFServer(module.exports)) + .registerCommandsIn(path.join(__dirname, 'commands')); +``` diff --git a/docs/index.yml b/docs/index.yml index bdfc3fb8..c6240d6a 100644 --- a/docs/index.yml +++ b/docs/index.yml @@ -16,3 +16,5 @@ path: discord-bot.md - name: Example Command path: command.js + - name: Google Cloud Functions + path: gcf.md diff --git a/package.json b/package.json index a7a6e10f..79b7fb8f 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "slash-create", - "version": "1.1.6", + "version": "1.2.0", "description": "Creator and handler for Discord's slash commands", "main": "./lib/index.js", "types": "./lib/index.d.ts",