Documentation ¶
Index ¶
- Constants
- func CleanHTML(text string) string
- func CleanText(text string) string
- func EscapeMarkdownV2(text string) string
- func FormatDuration(duration time.Duration, depth int, lang i18n.Language) string
- func GetLang(code string, langs map[string]i18n.Language) (i18n.Language, error)
- func GetLessonIcon(lessonType int) string
- func GetSettingIcon(enabled bool) string
- func SetLocation(time2 time.Time, location *time.Location) time.Time
- func SplitRows[T any](slice []T, rowSize int) [][]T
- type ButtonData
- type CallStatusType
- type CallsStatus
Constants ¶
const DaysScanLimit = 7
DaysScanLimit - limit of days to scan for the start of the next lesson in /left command
Variables ¶
This section is empty.
Functions ¶
func CleanText ¶
CleanText removes unnecessary characters from given text:
- Too many newlines
- Spaces and newlines from the beginning and end of the string
func EscapeMarkdownV2 ¶
EscapeMarkdownV2 takes an input text and escape Telegram MarkdownV2 markup symbols.
TODO: Remove this when merged: https://github.com/go-telegram/bot/pull/44
func FormatDuration ¶
FormatDuration formats time.Duration into a readable format
Example: FormatDuration(duration, depth=2) // "2d. 9h."
func GetLessonIcon ¶
GetLessonIcon returns the icon for the lesson type.
Examples (*colored emoji):
- Lecture: 🔸
- Practice: 🔹
- Exam: 🔺
func GetSettingIcon ¶
GetSettingIcon returns the icon for the setting: ✅ or ❌
func SetLocation ¶
SetLocation sets the location of the time without changing the time itself.
Types ¶
type ButtonData ¶
func ParseButtonData ¶
func ParseButtonData(buttonData string) *ButtonData
ParseButtonData parses the telegram button callback Action string.
Params example: "open.schedule.day#date=2023-10-04&day=1"
Returns ButtonData: Action = "open.schedule.day", Params = {"date": "2023-10-04", "day": "1"}
type CallStatusType ¶
type CallStatusType int8
const ( // CallStatusBeforeStart - before the first lesson CallStatusBeforeStart CallStatusType = iota // CallStatusBefore - before the next lesson (time when break ends) CallStatusBefore // CallStatusDuring - during the lesson CallStatusDuring )
type CallsStatus ¶
type CallsStatus struct { Status CallStatusType Time time.Time }
func GetCallsStatus ¶
GetCallsStatus returns the time relative to the current lesson