Documentation ¶
Overview ¶
Package deprecatedrunner contains v1 bot functionality, deprecated in next update.
Package pomodoro defines our pomodoro logics.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Iris ¶
type Iris struct {
// contains filtered or unexported fields
}
Iris defines the structure for the bots' functionality.
type NotifyInfo ¶
NotifyInfo defines notification message for users.
type Pomodoro ¶
type Pomodoro struct {
// contains filtered or unexported fields
}
Pomodoro defines a single state of a pomodoro sessions. Usage of channel to handle cancel signal.
func NewPomodoro ¶
func NewPomodoro(workDuration time.Duration, onWorkEnd TaskCallback, notify NotifyInfo) *Pomodoro
NewPomodoro create a new pomodoro and start it using time.NewTimer. onWorkEnd will be called after the goroutine.
type TaskCallback ¶
type TaskCallback func(info NotifyInfo, finished bool)
TaskCallback receives NotifyInfo and a boolean to define whether the task is completed or not.
type UserPomodoroMap ¶
type UserPomodoroMap struct {
// contains filtered or unexported fields
}
UserPomodoroMap is a map-like structure to init a single pomodoro in a channel. It has goroutine safe ops.
func NewUserPomodoroMap ¶
func NewUserPomodoroMap() UserPomodoroMap
NewUserPomodoroMap creates a ChannelPomMap and prepares it to be used.
func (*UserPomodoroMap) Count ¶
func (u *UserPomodoroMap) Count() int
Count counts the number of current Pomodoro being tracked.
func (*UserPomodoroMap) CreateIfEmpty ¶
func (u *UserPomodoroMap) CreateIfEmpty(duration time.Duration, onWorkEnd TaskCallback, notify NotifyInfo) bool
CreateIfEmpty will create a new Pomodoro for given user according to their discordID if user has none. The pomodoro will then be removed from the mapping once completed or canceled.
func (*UserPomodoroMap) RemoveIfExists ¶
func (u *UserPomodoroMap) RemoveIfExists(discordID string) bool
RemoveIfExists will remove a Pomodoro from given channel i one already exists.