count

package
v1.6.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Apr 28, 2019 License: MIT Imports: 7 Imported by: 0

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL