Documentation ¶
Index ¶
- Variables
- func CheckEnv() error
- func CreateCondition(shedules []database.ShedulesInUser) string
- func DayStr(day time.Time) string
- func GeneralKeyboard(options bool) tgbotapi.ReplyKeyboardMarkup
- func GenerateButtonTail(sheduleId int64, dt int, isGroup bool) string
- func GenerateGroupsArray(groups []database.Group, isAdd bool) []tgbotapi.InlineKeyboardButton
- func GenerateKeyboard(array []tgbotapi.InlineKeyboardButton) tgbotapi.InlineKeyboardMarkup
- func GenerateName(t database.Teacher) string
- func GeneratePath(sh database.ShedulesInUser, isPersonal bool, userId int64) string
- func GenerateTeachersArray(teachers []database.Teacher, isAdd bool) []tgbotapi.InlineKeyboardButton
- func GroupPairs(lessons []database.Lesson) [][]database.Lesson
- func InitUser(db *xorm.Engine, user *tgbotapi.User) (*database.TgUser, error)
- func KeywordContains(str string, keywords []string) bool
- func OptMarkup(options database.ShedulesInUser) tgbotapi.InlineKeyboardMarkup
- func PairToStr(pair []database.Lesson, db *xorm.Engine, isGroup bool) (string, error)
- func ParseQuery(data []string) ([]database.ShedulesInUser, int, error)
- func SummaryKeyboard(clickedButton string, sheduleId int64, isGroup bool, dt int) tgbotapi.InlineKeyboardMarkup
- func Swap(sh ssau_parser.WeekShedule) database.ShedulesInUser
- type Bot
- func (bot *Bot) Cancel(user *database.TgUser, query *tgbotapi.CallbackQuery) error
- func (bot *Bot) CreateHTMLShedule(isGroup bool, header string, shedule [][6][]database.Lesson, dates []time.Time, ...) string
- func (bot *Bot) CreateWeekImg(now time.Time, user *database.TgUser, shedules []database.ShedulesInUser, ...) error
- func (bot *Bot) DeleteGroup(user *database.TgUser, text string) (tgbotapi.Message, error)
- func (bot *Bot) EditOrSend(id int64, str string, imageId string, markup tgbotapi.InlineKeyboardMarkup, ...) (tgbotapi.Message, error)
- func (bot *Bot) Etc(user *database.TgUser) (tgbotapi.Message, error)
- func (bot *Bot) Find(now time.Time, user *database.TgUser, query string) (tgbotapi.Message, error)
- func (bot *Bot) GetDaySummary(now time.Time, user *database.TgUser, shedules []database.ShedulesInUser, ...) (tgbotapi.Message, error)
- func (bot *Bot) GetLessons(shedules []database.ShedulesInUser, now time.Time) ([]database.Lesson, error)
- func (bot *Bot) GetOptions(user *database.TgUser) (tgbotapi.Message, error)
- func (bot *Bot) GetPersonal(now time.Time, user *database.TgUser, editMsg ...tgbotapi.Message) (tgbotapi.Message, error)
- func (bot *Bot) GetShedule(user *database.TgUser, query *tgbotapi.CallbackQuery, now ...time.Time) error
- func (bot *Bot) GetSummary(now time.Time, user *database.TgUser, shedules []database.ShedulesInUser, ...) (tgbotapi.Message, error)
- func (bot *Bot) GetUpdates()
- func (bot *Bot) GetWeekLessons(shedules []database.ShedulesInUser, week int) ([]database.Lesson, error)
- func (bot *Bot) GetWeekSummary(now time.Time, user *database.TgUser, shedule database.ShedulesInUser, dw int, ...) error
- func (bot *Bot) HandleOptions(user *database.TgUser, query *tgbotapi.CallbackQuery) error
- func (bot *Bot) HandleSummary(user *database.TgUser, query *tgbotapi.CallbackQuery, now ...time.Time) error
- func (bot *Bot) HandleUpdate(update tgbotapi.Update, now ...time.Time) (tgbotapi.Message, error)
- func (bot *Bot) LoadShedule(shedule ssau_parser.WeekShedule, now time.Time) ([]database.Lesson, []database.Lesson, error)
- func (bot *Bot) SetFirstTime(msg *tgbotapi.Message, user *database.TgUser) (tgbotapi.Message, error)
- func (bot *Bot) Start(user *database.TgUser) error
- func (bot *Bot) StrDayShedule(lessons [][]database.Lesson, isGroup bool) (string, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var Icons = map[string]string{
"lect": "📗 Лекция ",
"pract": "📕 Практика ",
"lab": "📘 Лаба ",
"other": "📙 Прочее ",
"mil": "🫡",
"window": "🏝",
"exam": "💀 Экзамен",
"cons": "🗨 Консультация",
"kurs": "🤯 Курсовая",
}
View Source
var Month = []string{
"января",
"февраля",
"марта",
"апреля",
"мая",
"июня",
"июля",
"августа",
"сентября",
"октября",
"ноября",
"декабря",
}
View Source
var SumKey = []string{"near", "day", "week"}
Functions ¶
func CreateCondition ¶
func CreateCondition(shedules []database.ShedulesInUser) string
Создать условие поиска группы/преподавателя
func GeneralKeyboard ¶
func GeneralKeyboard(options bool) tgbotapi.ReplyKeyboardMarkup
func GenerateGroupsArray ¶
func GenerateGroupsArray(groups []database.Group, isAdd bool) []tgbotapi.InlineKeyboardButton
Создание ряда кнопок из списка групп
func GenerateKeyboard ¶
func GenerateKeyboard(array []tgbotapi.InlineKeyboardButton) tgbotapi.InlineKeyboardMarkup
Создание полноценной клавиатуры выбора
func GenerateName ¶
func GeneratePath ¶
func GeneratePath(sh database.ShedulesInUser, isPersonal bool, userId int64) string
func GenerateTeachersArray ¶
func GenerateTeachersArray(teachers []database.Teacher, isAdd bool) []tgbotapi.InlineKeyboardButton
Создание ряда кнопок из списка преподавателей
func GroupPairs ¶
Группировка занятий по парам
func KeywordContains ¶
func OptMarkup ¶
func OptMarkup(options database.ShedulesInUser) tgbotapi.InlineKeyboardMarkup
func ParseQuery ¶
func ParseQuery(data []string) ([]database.ShedulesInUser, int, error)
func SummaryKeyboard ¶
Types ¶
type Bot ¶
type Bot struct { TG *tgbotapi.BotAPI DB *xorm.Engine TestUser int64 HelpTxt string Week int WkPath string Debug *log.Logger Updates *tgbotapi.UpdatesChannel }
func (*Bot) CreateHTMLShedule ¶
func (*Bot) CreateWeekImg ¶
func (*Bot) DeleteGroup ¶
func (*Bot) EditOrSend ¶
func (bot *Bot) EditOrSend( id int64, str string, imageId string, markup tgbotapi.InlineKeyboardMarkup, editMsg ...tgbotapi.Message, ) ( tgbotapi.Message, error, )
Отправка сообщения или его редактирование, если в editMsg указано сообщение TODO: Обрабатывать старые сообщения, которые уже нельзя редактировать (message can't be deleted for everyone)
func (*Bot) GetDaySummary ¶
func (bot *Bot) GetDaySummary( now time.Time, user *database.TgUser, shedules []database.ShedulesInUser, dt int, isPersonal bool, editMsg ...tgbotapi.Message, ) ( tgbotapi.Message, error, )
ПОлучить расписание на день
func (*Bot) GetLessons ¶
func (bot *Bot) GetLessons(shedules []database.ShedulesInUser, now time.Time) ([]database.Lesson, error)
Получить список ближайших занятий (для краткой сводки или расписания на день)
func (*Bot) GetOptions ¶
func (*Bot) GetPersonal ¶
func (*Bot) GetShedule ¶
func (bot *Bot) GetShedule(user *database.TgUser, query *tgbotapi.CallbackQuery, now ...time.Time) error
Получить расписание из кнопки
func (*Bot) GetSummary ¶
func (bot *Bot) GetSummary( now time.Time, user *database.TgUser, shedules []database.ShedulesInUser, isPersonal bool, editMsg ...tgbotapi.Message, ) ( tgbotapi.Message, error, )
Получить краткую сводку
func (*Bot) GetUpdates ¶
func (bot *Bot) GetUpdates()
func (*Bot) GetWeekLessons ¶
func (*Bot) GetWeekSummary ¶
func (*Bot) HandleOptions ¶
func (*Bot) HandleSummary ¶
func (*Bot) HandleUpdate ¶
func (*Bot) LoadShedule ¶
func (bot *Bot) LoadShedule(shedule ssau_parser.WeekShedule, now time.Time) ( []database.Lesson, []database.Lesson, error, )
Загрузка расписания из ssau.ru/rasp
func (*Bot) SetFirstTime ¶
Click to show internal directories.
Click to hide internal directories.