package worker import ( "context" "github.com/grassrootseconomics/farmstar-survey-backend/pkg/telegram" "github.com/riverqueue/river" ) type TgMessage string type ( TelegramArgs struct { Msg string `json:"msg"` } TelegramWorker struct { river.WorkerDefaults[TelegramArgs] TgClient *telegram.TelegramClient ChatID string } ) func (TelegramArgs) Kind() string { return "telegram" } func (w *TelegramWorker) Work(ctx context.Context, job *river.Job[TelegramArgs]) error { _, err := w.TgClient.SendMessage(ctx, telegram.MessageInput{ ChatID: w.ChatID, Text: job.Args.Msg, }) if err != nil { return err } return nil }