remove nhentai feature
This commit is contained in:
parent
29a33fd407
commit
92607f5275
2 changed files with 0 additions and 58 deletions
|
@ -14,17 +14,6 @@ func Matcher(update tgbotapi.Update, bot *tgbotapi.BotAPI) {
|
|||
if time.Since(config.BotConfig.Shutup[update.Message.Chat.ID]) <= time.Minute*60 {
|
||||
return
|
||||
}
|
||||
/*
|
||||
//nhentai
|
||||
const nhentaiRegex string = "([ \\t\\n\\r]|^)\\d{4,}([ \\t\\n\\r]|$)"
|
||||
isNhentai, err := regexp.MatchString(nhentaiRegex, update.Message.Text)
|
||||
if err != nil {
|
||||
log.Panicf("Failed to compile regex for nhentai", err)
|
||||
}
|
||||
if isNhentai && (commonlogic.ContainsInt64(config.BotConfig.Nhentai.EnabledChats, update.Message.Chat.ID) || update.Message.From.ID == update.Message.Chat.ID) {
|
||||
go nhentai.Nhentai(nhentaiRegex, update, bot)
|
||||
}
|
||||
*/
|
||||
//balonlyl
|
||||
var isBalonlyl bool = false
|
||||
for _, word := range config.BotConfig.Balonlyl.TriggerWords {
|
||||
|
|
|
@ -1,47 +0,0 @@
|
|||
package nhentai
|
||||
|
||||
import (
|
||||
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
|
||||
"log"
|
||||
"regexp"
|
||||
"strconv"
|
||||
"watn3y/bloaterbotv3/botIO"
|
||||
"watn3y/bloaterbotv3/config"
|
||||
)
|
||||
|
||||
func Nhentai(regex string, update tgbotapi.Update, bot *tgbotapi.BotAPI) {
|
||||
|
||||
re := regexp.MustCompile(regex)
|
||||
getdigit := regexp.MustCompile("\\d{4,}")
|
||||
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
|
||||
}
|
||||
|
||||
hentai := parseAPIResponse(hentaiResponse)
|
||||
|
||||
var tags string
|
||||
for _, tag := range hentai.Tags {
|
||||
tags = tags + `<a href="` + config.BotConfig.Nhentai.Domain + tag.URL + `">` + tag.Name + `</a>` + `, `
|
||||
}
|
||||
|
||||
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",
|
||||
DisableWebPagePreview: false,
|
||||
Text: hentaitext,
|
||||
}
|
||||
|
||||
botIO.SendMessage(message, bot)
|
||||
}
|
Loading…
Reference in a new issue