log middleware
This commit is contained in:
@@ -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)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user