27 lines
813 B
Go
27 lines
813 B
Go
// Copyright (c) 2026 Storm Dragon
|
|
// Authors: Storm Dragon, Angus Kola
|
|
// SPDX-License-Identifier: GPL-3.0-or-later
|
|
|
|
package app
|
|
|
|
import (
|
|
"time"
|
|
|
|
"git.stormux.org/storm/cthulhu/internal/config"
|
|
"git.stormux.org/storm/cthulhu/internal/datetime"
|
|
"git.stormux.org/storm/cthulhu/internal/input"
|
|
)
|
|
|
|
// The command worker supplies local wall time and one immutable settings snapshot.
|
|
func presentDateTime(speech speechEnqueuer, settings config.Settings, command input.Command, now time.Time) {
|
|
text, cause := "", "current-time"
|
|
if command == input.PresentDate {
|
|
cause = "current-date"
|
|
text, _ = datetime.FormatDate(settings.DateFormat, now)
|
|
} else {
|
|
text, _ = datetime.FormatTime(settings.TimeFormat, now)
|
|
}
|
|
speech.Interrupt()
|
|
speech.Enqueue(speechRequest{Text: text, Role: "system", Cause: cause})
|
|
}
|