17 lines
575 B
Go
17 lines
575 B
Go
|
package message
|
||
|
|
||
|
import (
|
||
|
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api"
|
||
|
"strconv"
|
||
|
"strings"
|
||
|
)
|
||
|
|
||
|
func ReplaceMessage(message string, user *tgbotapi.User) string {
|
||
|
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)
|
||
|
return message
|
||
|
}
|