mirror of
https://github.com/pushbits/server.git
synced 2025-04-30 02:36:53 +02:00
19 lines
426 B
Go
19 lines
426 B
Go
package dispatcher
|
|
|
|
import (
|
|
"fmt"
|
|
"log"
|
|
|
|
"github.com/pushbits/server/internal/model"
|
|
)
|
|
|
|
// SendNotification sends a notification to the specified user.
|
|
func (d *Dispatcher) SendNotification(a *model.Application, n *model.Notification) error {
|
|
log.Printf("Sending notification to room %s.\n", a.MatrixID)
|
|
|
|
text := fmt.Sprintf("%s\n\n%s", n.Title, n.Message)
|
|
|
|
_, err := d.client.SendText(a.MatrixID, text)
|
|
|
|
return err
|
|
}
|