Be able to lookup sticker via thier pack prefix + alias

This commit is contained in:
2024-09-15 18:39:09 +08:00
parent af1b45bd92
commit 525a103a76
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/:alias", lookupSticker)
api.Get("/stickers/manifest", listStickerManifest)
api.Get("/stickers/packs", listStickerPacks)
api.Post("/stickers/packs", createStickerPack)

View File

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