diff --git a/bot.go b/bot.go
index e755f79..6a2e931 100644
--- a/bot.go
+++ b/bot.go
@@ -1,14 +1,12 @@
package main
import (
- "time"
+ "log"
"watn3y/bloaterbotv3/botIO"
"watn3y/bloaterbotv3/commands"
"watn3y/bloaterbotv3/text"
)
-var shutuptime time.Time
-
func bot() {
updates, bot := botIO.Authenticate()
@@ -17,13 +15,12 @@ func bot() {
continue
}
+ log.Printf("[bot] Recieved Message: [%s] %s", update.Message.From.UserName, update.Message.Text)
+
if update.Message.IsCommand() {
commands.Commands(update, bot)
} else {
- if time.Since(shutuptime).Minutes() >= 60 {
- text.Matcher(update, bot)
- }
-
+ text.Matcher(update, bot)
}
}
diff --git a/botIO/authenticate.go b/botIO/authenticate.go
index 2365468..55d4969 100644
--- a/botIO/authenticate.go
+++ b/botIO/authenticate.go
@@ -18,7 +18,7 @@ func Authenticate() (tgbotapi.UpdatesChannel, *tgbotapi.BotAPI) {
u := tgbotapi.NewUpdate(0)
u.Timeout = 60
- log.Printf("Authorized on account %s", b.Self.UserName)
+ log.Printf("[bot]Authorized on account %s", b.Self.UserName)
return b.GetUpdatesChan(u), b
}
diff --git a/botIO/sending.go b/botIO/sending.go
index ca31499..453fa55 100644
--- a/botIO/sending.go
+++ b/botIO/sending.go
@@ -10,4 +10,5 @@ func SendMessage(message tgbotapi.MessageConfig, bot *tgbotapi.BotAPI) {
if err != nil {
log.Printf("Failed to send message: %v\n", err)
}
+ log.Printf("[bot] Sent Message: %s", message.Text)
}
diff --git a/commands/commands.go b/commands/commands.go
index 1a45343..48a53ea 100644
--- a/commands/commands.go
+++ b/commands/commands.go
@@ -2,6 +2,8 @@ package commands
import (
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
+ "log"
+ "strconv"
"strings"
"time"
"watn3y/bloaterbotv3/botIO"
@@ -12,6 +14,9 @@ func Commands(update tgbotapi.Update, bot *tgbotapi.BotAPI) {
if strings.ToLower(update.Message.Command()) == "shutup" || strings.ToLower(update.Message.Command()) == "shut" {
config.BotConfig.Shutup[update.Message.Chat.ID] = time.Now().UTC()
msg := tgbotapi.NewMessage(update.Message.Chat.ID, "Shutting up")
+
+ log.Println("Shutting up for Chat: " + strconv.FormatInt(update.Message.Chat.ID, 10))
+
botIO.SendMessage(msg, bot)
}
}
diff --git a/commonlogic/commonlogic.go b/commonlogic/commonlogic.go
index 58d7b2c..c9b188a 100644
--- a/commonlogic/commonlogic.go
+++ b/commonlogic/commonlogic.go
@@ -1,5 +1,11 @@
package commonlogic
+import (
+ "reflect"
+ "runtime"
+ "strings"
+)
+
func ContainsInt64(a []int64, b int64) bool {
for _, v := range a {
if v == b {
@@ -9,3 +15,9 @@ func ContainsInt64(a []int64, b int64) bool {
return false
}
+
+func GetPackageName(temp interface{}) string {
+ strs := strings.Split((runtime.FuncForPC(reflect.ValueOf(temp).Pointer()).Name()), ".")
+ strs = strings.Split(strs[len(strs)-2], "/")
+ return strs[len(strs)-1]
+}
diff --git a/config/config.go b/config/config.go
index e316b65..ec6a808 100644
--- a/config/config.go
+++ b/config/config.go
@@ -1,7 +1,6 @@
package config
import (
- "fmt"
"github.com/BurntSushi/toml"
"log"
"os"
@@ -38,10 +37,7 @@ func LoadConfig() {
log.Fatal(err)
}
- if BotConfig.DebugMode {
- fmt.Print("Loaded config from configfile: ")
- fmt.Printf("%+v\n", BotConfig)
- }
-
BotConfig.Shutup = make(map[int64]time.Time)
+
+ log.Printf("[config] Config loaded as: %+v\n", BotConfig)
}
diff --git a/text/balonlyl/balonlyl.go b/text/balonlyl/balonlyl.go
index 6f2bc90..4192cde 100644
--- a/text/balonlyl/balonlyl.go
+++ b/text/balonlyl/balonlyl.go
@@ -2,6 +2,8 @@ package balonlyl
import (
tgbotapi "github.com/go-telegram-bot-api/telegram-bot-api/v5"
+ "log"
+ "strconv"
"watn3y/bloaterbotv3/botIO"
"watn3y/bloaterbotv3/config"
)
@@ -15,6 +17,7 @@ func Balonlyl(update tgbotapi.Update, bot *tgbotapi.BotAPI) {
balonlylAT + " look at these idiots",
}*/
+ log.Println("[balonlyl] French detected 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",
diff --git a/text/nhentai/nhentai.go b/text/nhentai/nhentai.go
index 55f81d4..08294e6 100644
--- a/text/nhentai/nhentai.go
+++ b/text/nhentai/nhentai.go
@@ -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 + `` + tag.Name + `` + `, `
}
- println(tags)
+
hentaitext := `` + `` + hentai.Title + ` ` + `` + "\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",