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