dcbot/internal/discord/discord.go
Dawid Wysokiński 4012bd0a2f
All checks were successful
continuous-integration/drone/push Build is passing
continuous-integration/drone/tag Build is passing
feat: notifications - i18n (#112)
Reviewed-on: #112
2023-06-30 05:09:52 +00:00

37 lines
549 B
Go

package discord
import (
"fmt"
"time"
)
const (
embedDescriptionCharLimit = 4096
)
func formatTimestamp(t time.Time) string {
return t.Format(time.RFC3339)
}
func buildLink(text string, url string) string {
if url == "" {
return text
}
return fmt.Sprintf("[`%s`](%s)", text, url)
}
func buildChannelMention(id string) string {
return "<#" + id + ">"
}
func boolToEmoji(val bool) string {
if val {
return ":white_check_mark:"
}
return ":x:"
}
func buildLangMessageID(languageTag string) string {
return "lang." + languageTag
}