some fixes; in hub now pushes dev tag
This commit is contained in:
@@ -1,4 +1,4 @@
|
||||
FROM golang:1.25.5-alpine3.23 AS builder
|
||||
FROM golang:1.25.6-alpine3.23 AS builder
|
||||
ARG BUILD_TIME
|
||||
ARG GIT_COMMIT
|
||||
WORKDIR /usr/src/kurumi
|
||||
|
||||
6
Makefile
6
Makefile
@@ -5,7 +5,5 @@ build:
|
||||
@echo "Building commit $(GIT_COMMIT)"
|
||||
@echo "Build time $(BUILD_TIME)"
|
||||
go mod tidy
|
||||
docker build --build-arg GIT_COMMIT --build-arg BUILD_TIME \
|
||||
-t git.nix13.pw/scuroneko/kurumibotgo:latest \
|
||||
-t git.nix13.pw/scuroneko/kurumibotgo:0.2.0 -f ./Dockerfile .
|
||||
docker push git.nix13.pw/scuroneko/kurumibotgo --all-tags
|
||||
docker build --build-arg GIT_COMMIT --build-arg BUILD_TIME -t git.nix13.pw/scuroneko/kurumibotgo:dev -f ./Dockerfile .
|
||||
docker push git.nix13.pw/scuroneko/kurumibotgo:dev
|
||||
@@ -1,3 +1,3 @@
|
||||
go mod tidy
|
||||
docker build --build-arg GIT_COMMIT="DEV" --build-arg BUILD_TIME="DEV" -t git.nix13.pw/scuroneko/kurumibotgo:latest -t git.nix13.pw/scuroneko/kurumibotgo:0.2.0 -f ./Dockerfile .
|
||||
docker push git.nix13.pw/scuroneko/kurumibotgo --all-tags
|
||||
docker build --build-arg GIT_COMMIT="DEV" --build-arg BUILD_TIME="DEV" -t git.nix13.pw/scuroneko/kurumibotgo:dev -f ./Dockerfile .
|
||||
docker push git.nix13.pw/scuroneko/kurumibotgo:dev
|
||||
@@ -14,6 +14,7 @@ services:
|
||||
interval: 2s
|
||||
retries: 5
|
||||
timeout: 10s
|
||||
start_period: 5s
|
||||
volumes:
|
||||
- ./scripts/postgres:/docker-entrypoint-initdb.d
|
||||
- postgres_data:/var/lib/postgresql/data
|
||||
@@ -27,6 +28,12 @@ services:
|
||||
MONGO_INITDB_ROOT_USERNAME: ${MONGO_USER}
|
||||
MONGO_INITDB_ROOT_PASSWORD: ${MONGO_PASS}
|
||||
MONGO_INITDB_DATABASE: ${MONGO_NAME}
|
||||
healthcheck:
|
||||
test: [ "CMD", "mongosh", "--quiet", "admin", "--eval", "quit(db.runCommand({ ping: 1 }).ok ? 0 : 2)" ]
|
||||
interval: 10s
|
||||
timeout: 10s
|
||||
retries: 5
|
||||
start_period: 10s
|
||||
volumes:
|
||||
- ./scripts/mongo:/docker-entrypoint-initdb.d
|
||||
- mongo_data:/data/db
|
||||
@@ -36,6 +43,12 @@ services:
|
||||
- bot
|
||||
ports:
|
||||
- "6379:6379"
|
||||
healthcheck:
|
||||
test: [ "CMD", "redis-cli", "--raw", "incr", "ping" ]
|
||||
interval: 5s
|
||||
retries: 5
|
||||
timeout: 10s
|
||||
start_period: 2s
|
||||
volumes:
|
||||
- redis_data:/data
|
||||
|
||||
|
||||
2
laniakea
2
laniakea
Submodule laniakea updated: c503b68814...05dadc3de3
4
main.go
4
main.go
@@ -24,12 +24,12 @@ func main() {
|
||||
bot = bot.ErrorTemplate("Во время выполнения команды произошла ошибка!\nСообщите об этом разработчику!\n\n%s")
|
||||
bot = bot.InitDatabaseContext(dbCtx)
|
||||
bot.AddDatabaseLogger(plugins.DatabaseLogger)
|
||||
|
||||
bot.AddMiddleware(plugins.InitLogMiddleware())
|
||||
|
||||
plugins.RegisterService(bot)
|
||||
plugins.RegisterAdmin(bot)
|
||||
plugins.RegisterEconomy(bot)
|
||||
plugins.RegisterWaifus(bot)
|
||||
plugins.RegisterAdmin(bot)
|
||||
plugins.RegisterRP(bot)
|
||||
|
||||
defer bot.Close()
|
||||
|
||||
@@ -9,7 +9,6 @@ import (
|
||||
func RegisterAdmin(b *laniakea.Bot) {
|
||||
p := laniakea.NewPlugin("Admin")
|
||||
p = p.Command(uploadPhoto, "uploadPhoto")
|
||||
|
||||
b.AddPlugins(p.Build())
|
||||
}
|
||||
|
||||
|
||||
@@ -32,8 +32,9 @@ func logMiddleware(ctx *laniakea.MsgContext, db *laniakea.DatabaseContext) {
|
||||
}
|
||||
}
|
||||
|
||||
func DatabaseLogger(db *laniakea.DatabaseContext) laniakea.LoggerWriter {
|
||||
return func(level laniakea.LogLevel, prefix, traceback string, m []any) {
|
||||
func DatabaseLogger(db *laniakea.DatabaseContext) *laniakea.LoggerWriter {
|
||||
w := &laniakea.LoggerWriter{}
|
||||
w.SetFn(func(level laniakea.LogLevel, prefix, traceback string, m []any) error {
|
||||
t := time.Now()
|
||||
entry := &mdb.ConsoleLogEntry{
|
||||
Level: level.GetName(),
|
||||
@@ -46,8 +47,7 @@ func DatabaseLogger(db *laniakea.DatabaseContext) laniakea.LoggerWriter {
|
||||
TimeStamp: t.Unix(),
|
||||
}
|
||||
err := mdb.WriteConsoleLog(db, entry)
|
||||
if err != nil {
|
||||
fmt.Println(err)
|
||||
}
|
||||
}
|
||||
return err
|
||||
})
|
||||
return w
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ func RegisterRP(bot *laniakea.Bot) {
|
||||
rp.Command(rpUserPromptSet, "rpuserpset")
|
||||
rp.Command(generate, "g", "gen", "г")
|
||||
rp.Payload(compress, "rp.compress_chat")
|
||||
rp.Payload(generalClose, "general.close")
|
||||
|
||||
bot.AddPlugins(rp.Build())
|
||||
}
|
||||
@@ -647,7 +646,3 @@ func compress(ctx *laniakea.MsgContext, db *laniakea.DatabaseContext) {
|
||||
kb = kb.AddCallbackButton("На главную", "rp.info")
|
||||
ctx.EditCallback("Сжатие завершено", kb)
|
||||
}
|
||||
|
||||
func generalClose(ctx *laniakea.MsgContext, _ *laniakea.DatabaseContext) {
|
||||
ctx.CallbackDelete()
|
||||
}
|
||||
|
||||
@@ -1 +1,13 @@
|
||||
package plugins
|
||||
|
||||
import "kurumibot/laniakea"
|
||||
|
||||
func RegisterService(bot *laniakea.Bot) {
|
||||
p := laniakea.NewPlugin("service")
|
||||
p = p.Payload(generalClose, "general.close")
|
||||
bot.AddPlugins(p.Build())
|
||||
}
|
||||
|
||||
func generalClose(ctx *laniakea.MsgContext, _ *laniakea.DatabaseContext) {
|
||||
ctx.CallbackDelete()
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user