internal/handlers/api.go:23-31 -- TelegramNotifier and DiscordNotifier define identical method sets:
SendWorkBlockApproval(blockID, title, goal, transition string) error
SendMessage(text string) error
Both telegram.Bot and discord.Notifier already satisfy either interface interchangeably.
Proposal:
- Replace both with a single
Notifier interface in api.go
- Change the
API struct to hold notifiers []Notifier instead of separate telegram and discord fields
- Update
cmd/secondorder/main.go initialization accordingly
Files affected: internal/handlers/api.go, cmd/secondorder/main.go, internal/telegram/bot.go, internal/discord/webhook.go
internal/handlers/api.go:23-31--TelegramNotifierandDiscordNotifierdefine identical method sets:SendWorkBlockApproval(blockID, title, goal, transition string) errorSendMessage(text string) errorBoth
telegram.Botanddiscord.Notifieralready satisfy either interface interchangeably.Proposal:
Notifierinterface inapi.goAPIstruct to holdnotifiers []Notifierinstead of separatetelegramanddiscordfieldscmd/secondorder/main.goinitialization accordinglyFiles affected:
internal/handlers/api.go,cmd/secondorder/main.go,internal/telegram/bot.go,internal/discord/webhook.go