Documentation ¶
Overview ¶
Package count provides example code to setup sarah.CommandProps.
One counter instance is shared between two CommandPropsBuilder.Func, which means resulting Slack/Gitter Commands access to same counter instance. This illustrates that, when multiple Bots are registered to Runner, same memory space can be shared.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var GitterProps = sarah.NewCommandPropsBuilder(). BotType(gitter.GITTER). Identifier("counter"). InputExample(".count"). MatchPattern(regexp.MustCompile(`^\.count`)). Func(func(_ context.Context, _ sarah.Input) (*sarah.CommandResponse, error) { return gitter.NewStringResponse(fmt.Sprint(globalCounter.increment())), nil }). MustBuild()
GitterProps is a pre-built count command properties for Slack.
View Source
var SlackProps = sarah.NewCommandPropsBuilder(). BotType(slack.SLACK). Identifier("counter"). InputExample(".count"). MatchPattern(regexp.MustCompile(`^\.count`)). Func(func(_ context.Context, _ sarah.Input) (*sarah.CommandResponse, error) { return slack.NewStringResponse(fmt.Sprint(globalCounter.increment())), nil }). MustBuild()
SlackProps is a pre-built count command properties for Slack.
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.