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