logging improvements

This commit is contained in:
Watn3y 2023-03-05 05:45:36 +01:00
parent c63dbc666d
commit 6a31972ad0
8 changed files with 35 additions and 15 deletions

View file

@ -2,6 +2,7 @@ package nhentai
import (
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
"log"
"regexp"
"strconv"
"watn3y/bloaterbotv3/botIO"
@ -15,9 +16,12 @@ func Nhentai(regex string, update tgbotapi.Update, bot *tgbotapi.BotAPI) {
match := re.FindStringSubmatch(update.Message.Text)
hentainumber := getdigit.FindStringSubmatch(match[0])
log.Println("[nhentai] Looking for Hentai " + hentainumber[0] + " from Chat: " + strconv.FormatInt(update.Message.Chat.ID, 10))
hentaiExists, hentaiResponse := doAPIRequest(hentainumber[0])
if !hentaiExists {
log.Println("[nhentai] Dit not find Hentai " + hentainumber[0] + " from Chat: " + strconv.FormatInt(update.Message.Chat.ID, 10))
return
}
@ -27,9 +31,11 @@ func Nhentai(regex string, update tgbotapi.Update, bot *tgbotapi.BotAPI) {
for _, tag := range hentai.Tags {
tags = tags + `<a href="` + config.BotConfig.Nhentai.Domain + tag.URL + `">` + tag.Name + `</a>` + `, `
}
println(tags)
hentaitext := `<b>` + `<a href="` + config.BotConfig.Nhentai.Domain + `/g/` + strconv.Itoa(hentai.ID) + `">` + hentai.Title + `</a> ` + `</b>` + "\n\n" + tags
log.Println("[nhentai] Found Hentai " + hentai.Title + " in Chat: " + strconv.FormatInt(update.Message.Chat.ID, 10))
message := tgbotapi.MessageConfig{
BaseChat: tgbotapi.BaseChat{ChatID: update.Message.Chat.ID, ReplyToMessageID: update.Message.MessageID},
ParseMode: "html",