dashboard-v2/app/http/endpoints/api/blacklist/blacklistremoveuser.go
2022-07-26 15:15:05 +01:00

26 lines
513 B
Go

package api
import (
"github.com/TicketsBot/GoPanel/database"
"github.com/TicketsBot/GoPanel/utils"
"github.com/gin-gonic/gin"
"strconv"
)
func RemoveUserBlacklistHandler(ctx *gin.Context) {
guildId := ctx.Keys["guildid"].(uint64)
userId, err := strconv.ParseUint(ctx.Param("user"), 10, 64)
if err != nil {
ctx.JSON(400, utils.ErrorJson(err))
return
}
if err := database.Client.Blacklist.Remove(guildId, userId); err != nil {
ctx.JSON(500, utils.ErrorJson(err))
return
}
ctx.Status(204)
}