Files
soft_usite/rest/controllers/telegram_controller.go
T
2025-04-24 02:07:47 +00:00

29 lines
622 B
Go
Executable File

package controllers
import (
"fmt"
"github.com/sujit-baniya/fiber-boilerplate/pkg/services"
)
type TelegramController struct {
Service *services.TelegramService
}
func NewTelegramController(service *services.TelegramService) *TelegramController {
return &TelegramController{Service: service}
}
func (tc *TelegramController) SendMessage(chatID interface{}, message string) error {
if chatID == "" || message == "" {
return fmt.Errorf("chat_id and message are required")
}
err := tc.Service.SendMessage(chatID, message)
if err != nil {
return fmt.Errorf("error sending message: %v", err)
}
return nil
}