latest
This commit is contained in:
parent
ac4e26e77d
commit
39b7f29ecc
@ -163,7 +163,7 @@ func WebChatWs(ctx *gin.Context) {
|
||||
contentType := discord.ApplicationJson
|
||||
|
||||
if exists {
|
||||
content := fmt.Sprintf("**%s**: %s", store.Get("name").(string), data)
|
||||
content := data
|
||||
if len(content) > 2000 {
|
||||
content = content[0:1999]
|
||||
}
|
||||
@ -197,6 +197,11 @@ func WebChatWs(ctx *gin.Context) {
|
||||
}
|
||||
|
||||
if !success {
|
||||
content = fmt.Sprintf("**%s**: %s", store.Get("name").(string), data)
|
||||
if len(content) > 2000 {
|
||||
content = content[0:1999]
|
||||
}
|
||||
|
||||
endpoint := channel.CreateMessage(int(ticket.Channel))
|
||||
err, _ = endpoint.Request(store, &contentType, channel.CreateMessageBody{
|
||||
Content: content,
|
||||
|
@ -78,7 +78,8 @@
|
||||
|
||||
{{if .premium}}
|
||||
<script>
|
||||
ws = new WebSocket("wss://panel.ticketsbot.net/webchat");
|
||||
//ws = new WebSocket("wss://panel.ticketsbot.net/webchat");
|
||||
ws = new WebSocket("ws://localhost:3000/webchat");
|
||||
|
||||
ws.onopen = (evt) => {
|
||||
ws.send(JSON.stringify({
|
||||
|
@ -39,7 +39,6 @@ type Endpoint struct {
|
||||
|
||||
func (e *Endpoint) Request(store sessions.Session, contentType *ContentType, body interface{}, response interface{}) (error, *http.Response) {
|
||||
url := BASE_URL + e.Endpoint
|
||||
|
||||
// Create req
|
||||
var req *http.Request
|
||||
var err error
|
||||
|
@ -1,6 +1,7 @@
|
||||
package webhooks
|
||||
|
||||
import (
|
||||
"fmt"
|
||||
"github.com/TicketsBot/GoPanel/utils/discord"
|
||||
"github.com/TicketsBot/GoPanel/utils/discord/objects"
|
||||
)
|
||||
@ -12,10 +13,10 @@ type ExecuteWebhookBody struct {
|
||||
AllowedMentions objects.AllowedMention `json:"allowed_mentions"`
|
||||
}
|
||||
|
||||
func ExecuteWebhook(url string) discord.Endpoint {
|
||||
func ExecuteWebhook(webhook string) discord.Endpoint {
|
||||
return discord.Endpoint{
|
||||
RequestType: discord.POST,
|
||||
AuthorizationType: discord.NONE,
|
||||
Endpoint: url,
|
||||
Endpoint: fmt.Sprintf("/webhooks/%s?wait=true", webhook),
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user