From d93a40e5317e16852fed071d1622ec447071f461 Mon Sep 17 00:00:00 2001 From: Fdvkey Date: Wed, 15 Jul 2026 18:08:43 +0700 Subject: [PATCH] feat: use pure-go exif injector in sticker command --- cmds/media/sticker.go | 29 +++++++++++++++++++++++------ 1 file changed, 23 insertions(+), 6 deletions(-) diff --git a/cmds/media/sticker.go b/cmds/media/sticker.go index d6a8e3f..61fd7b1 100644 --- a/cmds/media/sticker.go +++ b/cmds/media/sticker.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "os" + "strings" hc "neo/context" "neo/core" @@ -20,12 +21,28 @@ var Sticker = &core.Command{ Run: func(ctx *hc.Ctx) { // go ctx.React("👌") - exifPath, cleanupExif := helper.ResolveExif(ctx.Arguments()) - defer func() { - if cleanupExif { - os.Remove(exifPath) + var packName, publisher string + args := ctx.Arguments() + + packName = os.Getenv("STICKER_NAME") + if packName == "" { + packName = "Bot" + } + publisher = os.Getenv("STICKER_PUBLISHER") + if publisher == "" { + publisher = "Bot" + } + + if len(args) > 0 { + argsStr := strings.Join(args, " ") + parts := strings.Split(argsStr, "|") + packName = strings.TrimSpace(parts[0]) + if len(parts) > 1 { + publisher = strings.TrimSpace(parts[1]) + } else { + publisher = "" } - }() + } msg := ctx.Message() quoted := hc.GetQuotedMessage(msg) @@ -66,7 +83,7 @@ var Sticker = &core.Command{ return } - finalSticker, err := helper.InjectExif(rawWebp, exifPath) + finalSticker, err := helper.InjectExif(rawWebp, packName, publisher) if err != nil { ctx.Reply(fmt.Sprintf("error injecting EXIF: %v", err)) return