some logger

This commit is contained in:
2025-09-29 16:42:38 +03:00
parent 7dc3eeae9d
commit 4e8340b88c
7 changed files with 79 additions and 64 deletions

2
.gitmodules vendored
View File

@@ -1,3 +1,3 @@
[submodule "laniakea"] [submodule "laniakea"]
path = laniakea path = laniakea
url = https://git.nix13.pw/ScuroNeko/Laniakea url = git@nix13.pw:ScuroNeko/Laniakea

View File

@@ -19,7 +19,6 @@ func getDSN() string {
if !exists { if !exists {
host = "localhost" host = "localhost"
} }
log.Println("user:", user, "database:", database)
return fmt.Sprintf("postgresql://%s:%s@%s/%s?sslmode=disable", user, password, host, database) return fmt.Sprintf("postgresql://%s:%s@%s/%s?sslmode=disable", user, password, host, database)
} }

BIN
kurumibot Executable file

Binary file not shown.

18
main.go
View File

@@ -2,7 +2,6 @@ package main
import ( import (
"kurumibot/database" "kurumibot/database"
"kurumibot/database/psql"
"kurumibot/laniakea" "kurumibot/laniakea"
"kurumibot/plugins" "kurumibot/plugins"
"log" "log"
@@ -19,10 +18,10 @@ func main() {
database.ConnectPostgres() database.ConnectPostgres()
database.ConnectMongo() database.ConnectMongo()
database.ConnectRedis() database.ConnectRedis()
err = psql.Migrate() //err = psql.Migrate()
if err != nil { //if err != nil {
log.Fatalln(err) // log.Fatalln(err)
} //}
bot := laniakea.NewBot(laniakea.LoadSettingsFromEnv()) bot := laniakea.NewBot(laniakea.LoadSettingsFromEnv())
dbCtx := &laniakea.DatabaseContext{ dbCtx := &laniakea.DatabaseContext{
@@ -40,6 +39,15 @@ func main() {
plugins.RegisterWaifus(bot) plugins.RegisterWaifus(bot)
plugins.RegisterAdmin(bot) plugins.RegisterAdmin(bot)
//ctx := context.Background()
//go func() {
// select {
// case <-ctx.Done():
// {
// log.Println("done")
// }
// }
//}()
defer bot.Close() defer bot.Close()
bot.Run() bot.Run()
} }

101
main.log
View File

@@ -1,56 +1,45 @@
[LOG] [INFO] [28.08.2025 12:27:21] Bot running. Press CTRL+C to exit. [LOG] [DEBUG] [bot.go:AddMiddleware:186] [29.09.2025 16:14:59] middleware with name "LogMiddleware" was registered
[LOG] [INFO] [28.08.2025 12:28:31] Bot running. Press CTRL+C to exit. [LOG] [DEBUG] [bot.go:AddPlugins:169] [29.09.2025 16:14:59] plugins with name "Economy" was registered
[LOG] [INFO] [28.08.2025 12:29:48] Bot running. Press CTRL+C to exit. [LOG] [DEBUG] [bot.go:AddPlugins:169] [29.09.2025 16:14:59] plugins with name "Waifus" was registered
[LOG] [INFO] [28.08.2025 12:32:17] Bot running. Press CTRL+C to exit. [LOG] [DEBUG] [bot.go:AddPlugins:169] [29.09.2025 16:14:59] plugins with name "Admin" was registered
[LOG] [ERROR] [28.08.2025 12:32:28] [400] Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 1636 [LOG] [INFO] [bot.go:Run:202] [29.09.2025 16:14:59] Bot running. Press CTRL+C to exit.
[LOG] [INFO] [28.08.2025 12:33:01] Bot running. Press CTRL+C to exit. [LOG] [DEBUG] [bot.go:AddMiddleware:186] [29.09.2025 16:15:19] middleware with name "LogMiddleware" was registered
[LOG] [INFO] [28.08.2025 12:35:39] Bot running. Press CTRL+C to exit. [LOG] [DEBUG] [bot.go:AddPlugins:169] [29.09.2025 16:15:19] plugins with name "Economy" was registered
[LOG] [INFO] [28.08.2025 12:36:38] Bot running. Press CTRL+C to exit. [LOG] [DEBUG] [bot.go:AddPlugins:169] [29.09.2025 16:15:19] plugins with name "Waifus" was registered
[LOG] [INFO] [28.08.2025 12:37:08] Bot running. Press CTRL+C to exit. [LOG] [DEBUG] [bot.go:AddPlugins:169] [29.09.2025 16:15:19] plugins with name "Admin" was registered
[LOG] [ERROR] [28.08.2025 12:37:12] [400] Bad Request: can't parse entities: Can't find end of the entity starting at byte offset 1578 [LOG] [INFO] [bot.go:Run:202] [29.09.2025 16:15:19] Bot running. Press CTRL+C to exit.
[LOG] [INFO] [28.08.2025 12:37:26] Bot running. Press CTRL+C to exit. [LOG] [DEBUG] [bot.go:AddMiddleware:186] [29.09.2025 16:15:42] middleware with name "LogMiddleware" was registered
[LOG] [DEBUG] [29.09.2025 09:05:07] middleware with name "LogMiddleware" was registered [LOG] [DEBUG] [bot.go:AddPlugins:169] [29.09.2025 16:15:42] plugins with name "Economy" was registered
[LOG] [DEBUG] [29.09.2025 09:05:07] plugins with name "Economy" was registered [LOG] [DEBUG] [bot.go:AddPlugins:169] [29.09.2025 16:15:42] plugins with name "Waifus" was registered
[LOG] [DEBUG] [29.09.2025 09:05:07] plugins with name "Waifus" was registered [LOG] [DEBUG] [bot.go:AddPlugins:169] [29.09.2025 16:15:42] plugins with name "Admin" was registered
[LOG] [DEBUG] [29.09.2025 09:05:07] plugins with name "Admin" was registered [LOG] [INFO] [bot.go:Run:202] [29.09.2025 16:15:42] Bot running. Press CTRL+C to exit.
[LOG] [INFO] [29.09.2025 09:05:07] Bot running. Press CTRL+C to exit. [LOG] [DEBUG] [bot.go:AddMiddleware:186] [29.09.2025 16:32:27] middleware with name "LogMiddleware" was registered
[LOG] [DEBUG] [29.09.2025 09:11:32] middleware with name "LogMiddleware" was registered [LOG] [DEBUG] [bot.go:AddPlugins:169] [29.09.2025 16:32:27] plugins with name "Economy" was registered
[LOG] [DEBUG] [29.09.2025 09:11:32] plugins with name "Economy" was registered [LOG] [DEBUG] [bot.go:AddPlugins:169] [29.09.2025 16:32:27] plugins with name "Waifus" was registered
[LOG] [DEBUG] [29.09.2025 09:11:32] plugins with name "Waifus" was registered [LOG] [DEBUG] [bot.go:AddPlugins:169] [29.09.2025 16:32:27] plugins with name "Admin" was registered
[LOG] [DEBUG] [29.09.2025 09:11:32] plugins with name "Admin" was registered [LOG] [INFO] [bot.go:Run:202] [29.09.2025 16:32:27] Bot running. Press CTRL+C to exit.
[LOG] [INFO] [29.09.2025 09:11:32] Bot running. Press CTRL+C to exit. [LOG] [DEBUG] [bot.go:AddMiddleware:186] [29.09.2025 16:33:22] middleware with name "LogMiddleware" was registered
[LOG] [DEBUG] [29.09.2025 09:13:53] middleware with name "LogMiddleware" was registered [LOG] [DEBUG] [bot.go:AddPlugins:169] [29.09.2025 16:33:22] plugins with name "Economy" was registered
[LOG] [DEBUG] [29.09.2025 09:13:53] plugins with name "Economy" was registered [LOG] [DEBUG] [bot.go:AddPlugins:169] [29.09.2025 16:33:22] plugins with name "Waifus" was registered
[LOG] [DEBUG] [29.09.2025 09:13:53] plugins with name "Waifus" was registered [LOG] [DEBUG] [bot.go:AddPlugins:169] [29.09.2025 16:33:22] plugins with name "Admin" was registered
[LOG] [DEBUG] [29.09.2025 09:13:53] plugins with name "Admin" was registered [LOG] [INFO] [bot.go:Run:202] [29.09.2025 16:33:22] Bot running. Press CTRL+C to exit.
[LOG] [INFO] [29.09.2025 09:13:53] Bot running. Press CTRL+C to exit. [LOG] [DEBUG] [bot.go:AddMiddleware:186] [29.09.2025 16:34:27] middleware with name "LogMiddleware" was registered
[LOG] [DEBUG] [29.09.2025 10:41:45] middleware with name "LogMiddleware" was registered [LOG] [DEBUG] [bot.go:AddPlugins:169] [29.09.2025 16:34:27] plugins with name "Economy" was registered
[LOG] [DEBUG] [29.09.2025 10:41:45] plugins with name "Economy" was registered [LOG] [DEBUG] [bot.go:AddPlugins:169] [29.09.2025 16:34:27] plugins with name "Waifus" was registered
[LOG] [DEBUG] [29.09.2025 10:41:45] plugins with name "Waifus" was registered [LOG] [DEBUG] [bot.go:AddPlugins:169] [29.09.2025 16:34:27] plugins with name "Admin" was registered
[LOG] [DEBUG] [29.09.2025 10:41:45] plugins with name "Admin" was registered [LOG] [INFO] [bot.go:Run:202] [29.09.2025 16:34:27] Bot running. Press CTRL+C to exit.
[LOG] [INFO] [29.09.2025 10:41:45] Bot running. Press CTRL+C to exit. [LOG] [DEBUG] [bot.go:AddMiddleware:186] [29.09.2025 16:36:10] middleware with name "LogMiddleware" was registered
[LOG] [DEBUG] [29.09.2025 10:42:50] middleware with name "LogMiddleware" was registered [LOG] [DEBUG] [bot.go:AddPlugins:169] [29.09.2025 16:36:10] plugins with name "Economy" was registered
[LOG] [DEBUG] [29.09.2025 10:42:50] plugins with name "Economy" was registered [LOG] [DEBUG] [bot.go:AddPlugins:169] [29.09.2025 16:36:10] plugins with name "Waifus" was registered
[LOG] [DEBUG] [29.09.2025 10:42:50] plugins with name "Waifus" was registered [LOG] [DEBUG] [bot.go:AddPlugins:169] [29.09.2025 16:36:10] plugins with name "Admin" was registered
[LOG] [DEBUG] [29.09.2025 10:42:50] plugins with name "Admin" was registered [LOG] [INFO] [bot.go:Run:202] [29.09.2025 16:36:10] Bot running. Press CTRL+C to exit.
[LOG] [INFO] [29.09.2025 10:42:50] Bot running. Press CTRL+C to exit. [LOG] [DEBUG] [bot.go:AddMiddleware:186] [29.09.2025 16:37:28] middleware with name "LogMiddleware" was registered
[LOG] [DEBUG] [bot.go:AddMiddleware:182] [29.09.2025 10:43:38] middleware with name "LogMiddleware" was registered [LOG] [DEBUG] [bot.go:AddPlugins:169] [29.09.2025 16:37:28] plugins with name "Economy" was registered
[LOG] [DEBUG] [bot.go:AddPlugins:165] [29.09.2025 10:43:38] plugins with name "Economy" was registered [LOG] [DEBUG] [bot.go:AddPlugins:169] [29.09.2025 16:37:28] plugins with name "Waifus" was registered
[LOG] [DEBUG] [bot.go:AddPlugins:165] [29.09.2025 10:43:38] plugins with name "Waifus" was registered [LOG] [DEBUG] [bot.go:AddPlugins:169] [29.09.2025 16:37:28] plugins with name "Admin" was registered
[LOG] [DEBUG] [bot.go:AddPlugins:165] [29.09.2025 10:43:38] plugins with name "Admin" was registered [LOG] [INFO] [bot.go:Run:202] [29.09.2025 16:37:28] Bot running. Press CTRL+C to exit.
[LOG] [INFO] [bot.go:Run:198] [29.09.2025 10:43:38] Bot running. Press CTRL+C to exit. [LOG] [DEBUG] [bot.go:AddMiddleware:186] [29.09.2025 16:38:43] middleware with name "LogMiddleware" was registered
[LOG] [DEBUG] [bot.go:AddMiddleware:182] [29.09.2025 10:44:00] middleware with name "LogMiddleware" was registered [LOG] [DEBUG] [bot.go:AddPlugins:169] [29.09.2025 16:38:43] plugins with name "Economy" was registered
[LOG] [DEBUG] [bot.go:AddPlugins:165] [29.09.2025 10:44:00] plugins with name "Economy" was registered [LOG] [DEBUG] [bot.go:AddPlugins:169] [29.09.2025 16:38:43] plugins with name "Waifus" was registered
[LOG] [DEBUG] [bot.go:AddPlugins:165] [29.09.2025 10:44:00] plugins with name "Waifus" was registered [LOG] [DEBUG] [bot.go:AddPlugins:169] [29.09.2025 16:38:43] plugins with name "Admin" was registered
[LOG] [DEBUG] [bot.go:AddPlugins:165] [29.09.2025 10:44:00] plugins with name "Admin" was registered [LOG] [INFO] [bot.go:Run:202] [29.09.2025 16:38:43] Bot running. Press CTRL+C to exit.
[LOG] [INFO] [bot.go:Run:198] [29.09.2025 10:44:00] Bot running. Press CTRL+C to exit.
[LOG] [DEBUG] [bot.go:AddMiddleware:182] [29.09.2025 10:51:46] middleware with name "LogMiddleware" was registered
[LOG] [DEBUG] [bot.go:AddPlugins:165] [29.09.2025 10:51:46] plugins with name "Economy" was registered
[LOG] [DEBUG] [bot.go:AddPlugins:165] [29.09.2025 10:51:46] plugins with name "Waifus" was registered
[LOG] [DEBUG] [bot.go:AddPlugins:165] [29.09.2025 10:51:46] plugins with name "Admin" was registered
[LOG] [INFO] [bot.go:Run:198] [29.09.2025 10:51:46] Bot running. Press CTRL+C to exit.
[LOG] [DEBUG] [bot.go:AddMiddleware:186] [29.09.2025 10:52:42] middleware with name "LogMiddleware" was registered
[LOG] [DEBUG] [bot.go:AddPlugins:169] [29.09.2025 10:52:42] plugins with name "Economy" was registered
[LOG] [DEBUG] [bot.go:AddPlugins:169] [29.09.2025 10:52:42] plugins with name "Waifus" was registered
[LOG] [DEBUG] [bot.go:AddPlugins:169] [29.09.2025 10:52:42] plugins with name "Admin" was registered
[LOG] [INFO] [bot.go:Run:202] [29.09.2025 10:52:42] Bot running. Press CTRL+C to exit.

View File

@@ -54,3 +54,22 @@
[REQUESTS] [DEBUG] [29.09.2025 10:52:16] POST https://api.telegram.org/bot<TOKEN>/getUpdates {"allowed_updates":[],"offset":0,"timeout":30} [REQUESTS] [DEBUG] [29.09.2025 10:52:16] POST https://api.telegram.org/bot<TOKEN>/getUpdates {"allowed_updates":[],"offset":0,"timeout":30}
[REQUESTS] [DEBUG] [29.09.2025 10:52:42] POST https://api.telegram.org/bot<TOKEN>/getUpdates {"allowed_updates":[],"offset":0,"timeout":30} [REQUESTS] [DEBUG] [29.09.2025 10:52:42] POST https://api.telegram.org/bot<TOKEN>/getUpdates {"allowed_updates":[],"offset":0,"timeout":30}
[REQUESTS] [DEBUG] [29.09.2025 10:53:13] POST https://api.telegram.org/bot<TOKEN>/getUpdates {"allowed_updates":[],"offset":0,"timeout":30} [REQUESTS] [DEBUG] [29.09.2025 10:53:13] POST https://api.telegram.org/bot<TOKEN>/getUpdates {"allowed_updates":[],"offset":0,"timeout":30}
[REQUESTS] [DEBUG] [29.09.2025 16:14:59] POST https://api.telegram.org/bot<TOKEN>/getUpdates {"allowed_updates":[],"offset":0,"timeout":30}
[REQUESTS] [DEBUG] [29.09.2025 16:15:19] POST https://api.telegram.org/bot<TOKEN>/getUpdates {"allowed_updates":[],"offset":0,"timeout":30}
[REQUESTS] [DEBUG] [29.09.2025 16:15:42] POST https://api.telegram.org/bot<TOKEN>/getUpdates {"allowed_updates":[],"offset":0,"timeout":30}
[REQUESTS] [DEBUG] [29.09.2025 16:32:27] POST https://api.telegram.org/bot<TOKEN>/getUpdates {"allowed_updates":[],"offset":0,"timeout":30}
[REQUESTS] [DEBUG] [29.09.2025 16:32:58] POST https://api.telegram.org/bot<TOKEN>/getUpdates {"allowed_updates":[],"offset":0,"timeout":30}
[REQUESTS] [DEBUG] [29.09.2025 16:33:22] POST https://api.telegram.org/bot<TOKEN>/getUpdates {"allowed_updates":[],"offset":0,"timeout":30}
[REQUESTS] [DEBUG] [29.09.2025 16:33:52] POST https://api.telegram.org/bot<TOKEN>/getUpdates {"allowed_updates":[],"offset":0,"timeout":30}
[REQUESTS] [DEBUG] [29.09.2025 16:34:22] POST https://api.telegram.org/bot<TOKEN>/getUpdates {"allowed_updates":[],"offset":0,"timeout":30}
[REQUESTS] [DEBUG] [29.09.2025 16:34:27] POST https://api.telegram.org/bot<TOKEN>/getUpdates {"allowed_updates":[],"offset":0,"timeout":30}
[REQUESTS] [DEBUG] [29.09.2025 16:34:58] POST https://api.telegram.org/bot<TOKEN>/getUpdates {"allowed_updates":[],"offset":0,"timeout":30}
[REQUESTS] [DEBUG] [29.09.2025 16:35:28] POST https://api.telegram.org/bot<TOKEN>/getUpdates {"allowed_updates":[],"offset":0,"timeout":30}
[REQUESTS] [DEBUG] [29.09.2025 16:35:58] POST https://api.telegram.org/bot<TOKEN>/getUpdates {"allowed_updates":[],"offset":0,"timeout":30}
[REQUESTS] [DEBUG] [29.09.2025 16:36:10] POST https://api.telegram.org/bot<TOKEN>/getUpdates {"allowed_updates":[],"offset":0,"timeout":30}
[REQUESTS] [DEBUG] [29.09.2025 16:36:41] POST https://api.telegram.org/bot<TOKEN>/getUpdates {"allowed_updates":[],"offset":0,"timeout":30}
[REQUESTS] [DEBUG] [29.09.2025 16:37:11] POST https://api.telegram.org/bot<TOKEN>/getUpdates {"allowed_updates":[],"offset":0,"timeout":30}
[REQUESTS] [DEBUG] [29.09.2025 16:37:28] POST https://api.telegram.org/bot<TOKEN>/getUpdates {"allowed_updates":[],"offset":0,"timeout":30}
[REQUESTS] [DEBUG] [29.09.2025 16:37:59] POST https://api.telegram.org/bot<TOKEN>/getUpdates {"allowed_updates":[],"offset":0,"timeout":30}
[REQUESTS] [DEBUG] [29.09.2025 16:38:43] POST https://api.telegram.org/bot<TOKEN>/getUpdates {"allowed_updates":[],"offset":0,"timeout":30}
[REQUESTS] [DEBUG] [29.09.2025 16:39:14] POST https://api.telegram.org/bot<TOKEN>/getUpdates {"allowed_updates":[],"offset":0,"timeout":30}