log middleware

This commit is contained in:
2025-09-29 09:14:39 +03:00
parent 49ffe9ae03
commit e15d56196d
27 changed files with 641 additions and 164 deletions

View File

@@ -1,7 +1,7 @@
package plugins
import (
"kurumibot/database"
"kurumibot/database/psql"
"kurumibot/laniakea"
)
@@ -13,16 +13,16 @@ func RegisterAdmin(b *laniakea.Bot) {
b.AddPlugins(p.Build())
}
func uploadPhoto(ctx *laniakea.MsgContext) {
user, err := database.GetOrCreateUser(ctx.FromID, ctx.Msg.From.FirstName)
func uploadPhoto(msgContext *laniakea.MsgContext, _ *laniakea.DatabaseContext) {
user, err := psql.GetOrCreateUser(msgContext.FromID, msgContext.Msg.From.FirstName)
if err != nil {
ctx.Error(err)
msgContext.Error(err)
return
}
if !user.Group.IsAdmin {
return
}
photoId := ctx.Msg.Photo[0].FileID
ctx.AnswerPhoto(photoId, photoId)
photoId := msgContext.Msg.Photo[0].FileID
msgContext.AnswerPhoto(photoId, photoId)
}