Skip to content

Commit

Permalink
feat(apps/twitch-bot): add timer command for command timer info (#513)
Browse files Browse the repository at this point in the history
  • Loading branch information
barbequeorbarbecue committed Sep 15, 2024
1 parent 57afdb3 commit 7ce984f
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 0 deletions.
1 change: 1 addition & 0 deletions apps/twitch-bot/internal/command/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ func (c *commands) GetCommands() CommandMap {
"atimer": c.AddTimerCommand,
"dtimer": c.DeleteTimerCommand,
"timers": c.TimersCommand,
"timer": c.TimerCommand,

"help": c.HelpCommand,
}
Expand Down
23 changes: 23 additions & 0 deletions apps/twitch-bot/internal/command/timer.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package command

import (
"context"
"errors"

"github.com/gempir/go-twitch-irc/v3"
"github.com/senchabot-opensource/monorepo/apps/twitch-bot/internal/command/helpers"
"github.com/senchabot-opensource/monorepo/config"
"github.com/senchabot-opensource/monorepo/model"
)

func (c *commands) TimerCommand(context context.Context, message twitch.PrivateMessage, _ string, _ []string) (*model.CommandResponse, error) {
var cmdResp model.CommandResponse
channelId := message.RoomID

if !helpers.CanExecuteCommand(context, c.service, message.Tags["badges"], channelId) {
return nil, errors.New(message.User.DisplayName + config.CannotExecuteCommand)
}

cmdResp.Message = "Add timer: !atimer [command_name] [interval (integer, minute)] • Delete timer: !dtimer [command_name] • Click for more information: https://docs.senchabot.app/twitch-bot/command-timer-system"
return &cmdResp, nil
}

0 comments on commit 7ce984f

Please sign in to comment.