Able to search sticker with alias

This commit is contained in:
2024-09-16 20:44:40 +08:00
parent 778d09d74a
commit bf5c718780
3 changed files with 24 additions and 0 deletions

View File

@ -23,6 +23,7 @@ func MapAPIs(app *fiber.App, baseURL string) {
api.Post("/attachments/multipart", createAttachmentMultipartPlaceholder)
api.Post("/attachments/multipart/:file/:chunk", uploadAttachmentMultipart)
api.Get("/stickers/lookup", lookupStickerBatch)
api.Get("/stickers/lookup/:alias", lookupSticker)
api.Get("/stickers/manifest", listStickerManifest)
api.Get("/stickers/packs", listStickerPacks)

View File

@ -12,6 +12,15 @@ import (
"github.com/gofiber/fiber/v2"
)
func lookupStickerBatch(c *fiber.Ctx) error {
probe := c.Query("probe")
if stickers, err := services.GetStickerLikeAlias(probe); err != nil {
return fiber.NewError(fiber.StatusNotFound, err.Error())
} else {
return c.JSON(stickers)
}
}
func lookupSticker(c *fiber.Ctx) error {
alias := c.Params("alias")
if sticker, err := services.GetStickerWithAlias(alias); err != nil {