up nhentai to 4 digits
This commit is contained in:
parent
99019db54f
commit
857fb2a6e4
2 changed files with 2 additions and 2 deletions
|
@ -19,7 +19,7 @@ func Matcher(update tgbotapi.Update, bot *tgbotapi.BotAPI) {
|
||||||
}
|
}
|
||||||
|
|
||||||
//nhentai
|
//nhentai
|
||||||
const nhentaiRegex string = "([ \\t\\n\\r]|^)\\d{2,}([ \\t\\n\\r]|$)"
|
const nhentaiRegex string = "([ \\t\\n\\r]|^)\\d{4,}([ \\t\\n\\r]|$)"
|
||||||
isNhentai, err := regexp.MatchString(nhentaiRegex, update.Message.Text)
|
isNhentai, err := regexp.MatchString(nhentaiRegex, update.Message.Text)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Panicf("Failed to compile regex for nhentai", err)
|
log.Panicf("Failed to compile regex for nhentai", err)
|
||||||
|
|
|
@ -12,7 +12,7 @@ import (
|
||||||
func Nhentai(regex string, update tgbotapi.Update, bot *tgbotapi.BotAPI) {
|
func Nhentai(regex string, update tgbotapi.Update, bot *tgbotapi.BotAPI) {
|
||||||
|
|
||||||
re := regexp.MustCompile(regex)
|
re := regexp.MustCompile(regex)
|
||||||
getdigit := regexp.MustCompile("\\d{2,}")
|
getdigit := regexp.MustCompile("\\d{4,}")
|
||||||
match := re.FindStringSubmatch(update.Message.Text)
|
match := re.FindStringSubmatch(update.Message.Text)
|
||||||
hentainumber := getdigit.FindStringSubmatch(match[0])
|
hentainumber := getdigit.FindStringSubmatch(match[0])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue