2020-06-27 16:38:59 +00:00
|
|
|
package message
|
|
|
|
|
|
|
|
import (
|
2021-08-07 18:02:34 +00:00
|
|
|
"git.dragon-labs.de/alphyron/group_helper/models"
|
2020-06-27 16:38:59 +00:00
|
|
|
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api"
|
|
|
|
"strconv"
|
|
|
|
"strings"
|
|
|
|
)
|
|
|
|
|
2021-08-07 18:02:34 +00:00
|
|
|
func ReplaceMessage(message string, user *tgbotapi.User, group *models.Group) string {
|
2020-06-27 16:38:59 +00:00
|
|
|
message = strings.Replace(message, "{{user.firstname}}", user.FirstName, -1)
|
|
|
|
message = strings.Replace(message, "{{user.lastname}}", user.LastName, -1)
|
|
|
|
message = strings.Replace(message, "{{user.username}}", user.UserName, -1)
|
|
|
|
message = strings.Replace(message, "{{user.name}}", user.UserName, -1)
|
|
|
|
message = strings.Replace(message, "{{user.id}}", strconv.Itoa(user.ID), -1)
|
2021-08-07 18:02:34 +00:00
|
|
|
message = strings.Replace(message, "{{group.rules}}", group.Rules, -1)
|
2020-06-27 16:38:59 +00:00
|
|
|
return message
|
|
|
|
}
|