func (c *retryCommand) retry(match matcher.Result, message msg.Message) {
	key := message.GetUniqueKey()
	var lastCommand string
	err := storage.Read(storageKey, key, &lastCommand)
	if err != nil {
		log.Warn(errors.Wrap(err, "error while loading user history"))
	}
	if lastCommand != "" {
		c.SendMessage(message, fmt.Sprintf("Executing command: %s", lastCommand))
		client.HandleMessage(message.WithText(lastCommand))
	} else {
		c.SendMessage(message, "Sorry, no history found.")
	}
}
retry the last stored message
package command
import (
	"fmt"
	"github.com/pkg/errors"
	"github.com/innogames/slack-bot/v2/bot"
	"github.com/innogames/slack-bot/v2/bot/config"
	"github.com/innogames/slack-bot/v2/bot/matcher"
	"github.com/innogames/slack-bot/v2/bot/msg"
	"github.com/innogames/slack-bot/v2/bot/storage"
	"github.com/innogames/slack-bot/v2/client"
	log "github.com/sirupsen/logrus"
	"github.com/slack-go/slack"
)
const storageKey = "user_history"
func NewRetryCommand(base bot.BaseCommand, cfg *config.Config) bot.Command {
	return &retryCommand{
		base,
		cfg,
	}
}
type retryCommand struct {
	bot.BaseCommand
	cfg *config.Config
}
func (c *retryCommand) GetMatcher() matcher.Matcher {
	return matcher.NewGroupMatcher(
		matcher.NewTextMatcher(`retry`, c.retry),
		matcher.NewTextMatcher(`repeat`, c.retry),
		matcher.NewRegexpMatcher(`<?https: 
		matcher.WildcardMatcher(c.storeLastCommand),
	)
}