// Dispatches arriving updates to appropriate handler
//
// bot is BotAPI, update is arrived telegram update
Dispatches arriving updates to appropriate handler

bot is BotAPI, update is arrived telegram update
// Dispatches arriving updates to appropriate handler // // bot is BotAPI update is arrived telegram update
func dispatchUpdate(bot *tgbotapi.BotAPI, update tgbotapi.Update) {
	if update.Message.IsCommand() {
		if update.Message.Command() == "start" {
			handleStart(bot, update)
			return
		}
		if update.Message.Command() == "help" {
			handleHelp(bot, update)
			return
		}
		log.Printf("Unsupported command received: " + update.Message.Command())
		return
	}
	if strings.HasPrefix(update.Message.Text, "(ID: ") && strings.Contains(update.Message.Text, ") - ") {
		startIdx := len("(ID: ")
		endIdx := strings.LastIndex(update.Message.Text, ") - ")
		runes := []rune(update.Message.Text)
		id := string(runes[startIdx:endIdx])
		handleSpecificId(id, bot, update)
		return
	}
	handleSearch(update.Message.Text, bot, update)
}
func dispatchUpdate ( bot * tgbotapi . BotAPI , update tgbotapi . Update ) { if update . Message . IsCommand ( ) { if update . Message . Command ( ) == " " { handleStart ( bot , update ) return } if update . Message . Command ( ) == " " { handleHelp ( bot , update ) return } log . Printf ( " " + update . Message . Command ( ) ) return } if strings . HasPrefix ( update . Message . Text , " " ) && strings . Contains ( update . Message . Text , " " ) { startIdx := len ( " " ) endIdx := strings . LastIndex ( update . Message . Text , " " ) runes := [ ] rune ( update . Message . Text ) id := string ( runes [ startIdx : endIdx ] ) handleSpecificId ( id , bot , update ) return } handleSearch ( update . Message . Text , bot , update ) }
Dispatches arriving updates to appropriate handler
Dispatches arriving updates to appropriate handler