26 lines
573 B
Go
26 lines
573 B
Go
package api
|
|
|
|
import (
|
|
dbclient "github.com/TicketsBot/GoPanel/database"
|
|
"github.com/TicketsBot/GoPanel/utils"
|
|
"github.com/gin-gonic/gin"
|
|
"strconv"
|
|
)
|
|
|
|
func RemoveIntegrationHandler(ctx *gin.Context) {
|
|
guildId := ctx.Keys["guildid"].(uint64)
|
|
|
|
integrationId, err := strconv.Atoi(ctx.Param("integrationid"))
|
|
if err != nil {
|
|
ctx.JSON(400, utils.ErrorStr("Invalid integration ID"))
|
|
return
|
|
}
|
|
|
|
if err := dbclient.Client.CustomIntegrationGuilds.RemoveFromGuild(integrationId, guildId); err != nil {
|
|
ctx.JSON(500, utils.ErrorJson(err))
|
|
return
|
|
}
|
|
|
|
ctx.Status(204)
|
|
}
|