mirror of
https://github.com/cwinfo/matterbridge.git
synced 2025-06-26 08:39:24 +00:00
Replace bwmarrin/discordgo with matterbridge/discordgo (#878)
Needed for #872
This commit is contained in:
71
vendor/github.com/bwmarrin/discordgo/restapi.go
generated
vendored
71
vendor/github.com/bwmarrin/discordgo/restapi.go
generated
vendored
@ -675,7 +675,7 @@ func (s *Session) GuildLeave(guildID string) (err error) {
|
||||
return
|
||||
}
|
||||
|
||||
// GuildBans returns an array of User structures for all bans of a
|
||||
// GuildBans returns an array of GuildBan structures for all bans of a
|
||||
// given guild.
|
||||
// guildID : The ID of a Guild.
|
||||
func (s *Session) GuildBans(guildID string) (st []*GuildBan, err error) {
|
||||
@ -2067,15 +2067,80 @@ func (s *Session) WebhookDeleteWithToken(webhookID, token string) (st *Webhook,
|
||||
// WebhookExecute executes a webhook.
|
||||
// webhookID: The ID of a webhook.
|
||||
// token : The auth token for the webhook
|
||||
func (s *Session) WebhookExecute(webhookID, token string, wait bool, data *WebhookParams) (err error) {
|
||||
// wait : Wait for server to confirm the message arrival
|
||||
//
|
||||
// If `wait` is `false`, the returned *Message is always empty, because server
|
||||
// does not provide the response data.
|
||||
func (s *Session) WebhookExecute(webhookID, token string, wait bool, data *WebhookParams) (st *Message, err error) {
|
||||
uri := EndpointWebhookToken(webhookID, token)
|
||||
|
||||
if wait {
|
||||
uri += "?wait=true"
|
||||
}
|
||||
|
||||
_, err = s.RequestWithBucketID("POST", uri, data, EndpointWebhookToken("", ""))
|
||||
var response []byte
|
||||
if data.File != nil {
|
||||
body := &bytes.Buffer{}
|
||||
bodywriter := multipart.NewWriter(body)
|
||||
|
||||
var payload []byte
|
||||
payload, err = json.Marshal(data)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
var p io.Writer
|
||||
|
||||
h := make(textproto.MIMEHeader)
|
||||
h.Set("Content-Disposition", `form-data; name="payload_json"`)
|
||||
h.Set("Content-Type", "application/json")
|
||||
|
||||
p, err = bodywriter.CreatePart(h)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if _, err = p.Write(payload); err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
{
|
||||
file := data.File
|
||||
h := make(textproto.MIMEHeader)
|
||||
h.Set("Content-Disposition", fmt.Sprintf(`form-data; name="file"; filename="%s"`, quoteEscaper.Replace(file.Name)))
|
||||
contentType := file.ContentType
|
||||
if contentType == "" {
|
||||
contentType = "application/octet-stream"
|
||||
}
|
||||
h.Set("Content-Type", contentType)
|
||||
|
||||
p, err = bodywriter.CreatePart(h)
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
if _, err = io.Copy(p, file.Reader); err != nil {
|
||||
return
|
||||
}
|
||||
}
|
||||
|
||||
err = bodywriter.Close()
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
|
||||
response, err = s.request("POST", uri, bodywriter.FormDataContentType(), body.Bytes(), EndpointWebhookToken("", ""), 0)
|
||||
} else {
|
||||
response, err = s.RequestWithBucketID("POST", uri, data, EndpointWebhookToken("", ""))
|
||||
}
|
||||
if err != nil {
|
||||
return
|
||||
}
|
||||
if !wait {
|
||||
return
|
||||
}
|
||||
|
||||
err = unmarshal(response, &st)
|
||||
return
|
||||
}
|
||||
|
||||
|
2
vendor/github.com/bwmarrin/discordgo/structs.go
generated
vendored
2
vendor/github.com/bwmarrin/discordgo/structs.go
generated
vendored
@ -832,7 +832,7 @@ type WebhookParams struct {
|
||||
Username string `json:"username,omitempty"`
|
||||
AvatarURL string `json:"avatar_url,omitempty"`
|
||||
TTS bool `json:"tts,omitempty"`
|
||||
File string `json:"file,omitempty"`
|
||||
File *File `json:"-"`
|
||||
Embeds []*MessageEmbed `json:"embeds,omitempty"`
|
||||
}
|
||||
|
||||
|
2
vendor/modules.txt
vendored
2
vendor/modules.txt
vendored
@ -23,7 +23,7 @@ github.com/Rhymen/go-whatsapp/crypto/cbc
|
||||
github.com/Rhymen/go-whatsapp/crypto/curve25519
|
||||
github.com/Rhymen/go-whatsapp/crypto/hkdf
|
||||
github.com/Rhymen/go-whatsapp/binary/token
|
||||
# github.com/bwmarrin/discordgo v0.19.0
|
||||
# github.com/bwmarrin/discordgo v0.19.0 => github.com/matterbridge/discordgo v0.0.0-20190818085008-57c6e0fc2f40
|
||||
github.com/bwmarrin/discordgo
|
||||
# github.com/d5/tengo v1.24.1
|
||||
github.com/d5/tengo/script
|
||||
|
Reference in New Issue
Block a user