forked from bwmarrin/discordgo
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update handlers to receive an interface for the Session
Please be aware, this is a breaking API change. This change adds a new `discordgo` type, `Sessioner`, which is an interface that describes the full method set for the `*Session` type. In addition to the new type, this change updates the package to no longer send a concrete `*Session` value in to handlers it invokes as the first argument but a `Sessioner` instead. This is to make testing of handlers much easier, as mock implementations of the Sessioner interface can be passed right in. This also renames the internal state field from `State` to `state`, and adds a new method to `*Session`, `State()`, to expose that internal state to consumers. A test was added to ensure this method works as expected. The example projects were updated where necessary to work with the new API Fixes bwmarrin#662. Signed-off-by: Tim Heckman <t@heckman.io>
- Loading branch information
Showing
14 changed files
with
1,023 additions
and
170 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.