Archived
1

Chats saving to database

This commit is contained in:
2017-10-21 14:14:46 +04:00
parent 8dab6c0699
commit c99648b72a
6 changed files with 104 additions and 18 deletions

View File

@@ -25,16 +25,14 @@ func (r *Router) RouteRequest(update tgbotapi.Update) string {
return "fail"
}
chatID := update.Message.Chat.ID
fromID := int64(update.Message.From.ID)
log.Println(chatID)
log.Println(fromID)
if chatID == fromID {
log.Println("Private chat")
} else {
log.Println("Group")
chatRaw, ok := c.Getters.GetOrCreateChat(&update)
if !ok {
return "fail"
}
log.Printf("Received message from chat ")
log.Println(chatRaw.TelegramID)
// Regular expressions
var durakMsg = regexp.MustCompile("(Д|д)(У|у)(Р|р)(А|а|Е|е|О|о)")
var huMsg = regexp.MustCompile("(Х|х)(У|у)(Й|й|Я|я|Ю|ю|Е|е)")