From 850901a5dcb20920f37f8e735155db7d214aa865 Mon Sep 17 00:00:00 2001 From: Bruce Marriner Date: Wed, 23 Dec 2015 23:50:19 -0600 Subject: [PATCH] Updated ChannelMessageSend to reflect new mention method used by Discord, closes #9 --- restapi.go | 22 ++++------------------ 1 file changed, 4 insertions(+), 18 deletions(-) diff --git a/restapi.go b/restapi.go index 9b47aac..8403e92 100644 --- a/restapi.go +++ b/restapi.go @@ -16,7 +16,6 @@ import ( "fmt" "io/ioutil" "net/http" - "regexp" "time" ) @@ -501,24 +500,11 @@ func (s *Session) ChannelMessageAck(channelID, messageID string) (err error) { // NOTE, mention and tts parameters may be added in 2.x branch. func (s *Session) ChannelMessageSend(channelID string, content string) (st Message, err error) { - // TOD: nonce string ? + // TODO: nonce string ? data := struct { - Content string `json:"content"` - Mentions []string `json:"mentions"` - TTS bool `json:"tts"` - }{content, nil, false} - - // If true, search for <@ID> tags and add those IDs to mention list. - if s.AutoMention { - re := regexp.MustCompile(`<@(\d+)>`) - match := re.FindAllStringSubmatch(content, -1) - - mentions := make([]string, len(match)) - for i, m := range match { - mentions[i] = m[1] - } - data.Mentions = mentions - } + Content string `json:"content"` + TTS bool `json:"tts"` + }{content, false} // Send the message to the given channel response, err := s.Request("POST", CHANNEL_MESSAGES(channelID), data)