diff --git a/cmd/bot/commands.go b/cmd/bot/commands.go index 52a403f..ea563ec 100644 --- a/cmd/bot/commands.go +++ b/cmd/bot/commands.go @@ -502,6 +502,20 @@ var helpText = map[string]string{ "xkcd": "Returns a link to the latest xkcd comic. Example usage: ()xkcd", } +func (app *Application) loadCommandHelp() { + for k, v := range helpText { + err := app.Rdb.HSet(ctx, "command-help", k, v).Err() + if err != nil { + app.Logger.Panic(err) + } + } + commandHelpText := app.Rdb.HGetAll(ctx, "command-help").Val() + app.Logger.Infow("Successfully loaded command help text into redis", + "commandHelpText", commandHelpText, + ) + +} + // Help checks if a help text for a given command exists and replies with it. func (app *Application) commandHelp(target, name, username string) { // Check if the `helpText` map has an entry for `name`. If it does return it's value entry diff --git a/cmd/bot/main.go b/cmd/bot/main.go index 15e881c..7a078a4 100644 --- a/cmd/bot/main.go +++ b/cmd/bot/main.go @@ -210,6 +210,8 @@ func main() { // Start time common.StartTime() + app.loadCommandHelp() + // Join the channels in the database. app.InitialJoin() diff --git a/cmd/bot/timer.go b/cmd/bot/timer.go index 409569d..98a34b9 100644 --- a/cmd/bot/timer.go +++ b/cmd/bot/timer.go @@ -262,7 +262,6 @@ func (app *Application) InitialTimers() { if _, err := app.Rdb.Pipelined(ctx, func(rdb redis.Pipeliner) error { rdb.HSet(ctx, cronName, "timer-id", v.ID) rdb.HSet(ctx, cronName, "timer-name", v.Name) - rdb.HSet(ctx, cronName, "timer-cronname", cronName) rdb.HSet(ctx, cronName, "timer-text", v.Text) rdb.HSet(ctx, cronName, "timer-channel", v.Channel) rdb.HSet(ctx, cronName, "timer-repeat", v.Repeat)