fix webhooks

This commit is contained in:
Dot-Rar 2020-03-06 19:37:58 +00:00
parent 203bdd938b
commit 5b05e27bae
2 changed files with 4 additions and 4 deletions

View File

@ -178,7 +178,7 @@ func WebChatWs(ctx *gin.Context) {
success := false success := false
if webhook != nil { if webhook != nil {
success = executeWebhook(content, ticket.Uuid, *webhook, store) success = executeWebhook( ticket.Uuid, *webhook, content, store)
} }
if !success { if !success {
@ -207,7 +207,7 @@ func executeWebhook(uuid, webhook, content string, store sessions.Session) bool
encoded, err := json.Marshal(&body); if err != nil { encoded, err := json.Marshal(&body); if err != nil {
return false return false
} }
req, err := http.NewRequest("POST", fmt.Sprintf("https://discordapp.com/api/v6/webhooks/%s", webhook), bytes.NewBuffer(encoded)); if err != nil { req, err := http.NewRequest("POST", fmt.Sprintf("https://canary.discordapp.com/api/webhooks/%s", webhook), bytes.NewBuffer(encoded)); if err != nil {
return false return false
} }

View File

@ -3,8 +3,8 @@ package table
import "github.com/TicketsBot/GoPanel/database" import "github.com/TicketsBot/GoPanel/database"
type TicketWebhook struct { type TicketWebhook struct {
Uuid string `gorm:"column:UUID;type:varchar(36);unique;primary_key"` Uuid string `gorm:"column:UUID;type:varchar(36);unique;primary_key"`
WebhookUrl string `gorm:"column:CDNURL;type:varchar(200)"` WebhookUrl string `gorm:"column:CDNURL;type:varchar(200)"`
} }
func (TicketWebhook) TableName() string { func (TicketWebhook) TableName() string {