go-sarah: github.com/oklahomer/go-sarah/examples/simple/plugins/timer Index | Files

package timer

import "github.com/oklahomer/go-sarah/examples/simple/plugins/timer"

Package timer provides example code to setup ScheduledTaskProps with re-configurable schedule and sending room.

The configuration struct, timerConfig, implements both ScheduledConfig and DestinatedConfig interface. The configuration values are read from timer.yaml and Command is re-built when configuration file is updated.

Index

Package Files

props.go

Variables

var SlackProps = sarah.NewScheduledTaskPropsBuilder().
    BotType(slack.SLACK).
    Identifier("timer").
    ConfigurableFunc(&timerConfig{}, func(_ context.Context, config sarah.TaskConfig) ([]*sarah.ScheduledTaskResult, error) {
        return []*sarah.ScheduledTaskResult{
            {
                Content:     "It's time to work!!",
                Destination: config.(*timerConfig).DefaultDestination(),
            },
        }, nil
    }).
    MustBuild()

SlackProps is a pre-built timer task properties for Slack.

Package timer imports 4 packages (graph). Updated 2020-08-25. Refresh now. Tools for package owners.