Skip to content

Commit

Permalink
Support TTS. Closes #67
Browse files Browse the repository at this point in the history
  • Loading branch information
iopred committed Feb 14, 2016
1 parent bf3f2c5 commit 64af0e5
Showing 1 changed file with 20 additions and 4 deletions.
24 changes: 20 additions & 4 deletions restapi.go
Original file line number Diff line number Diff line change
Expand Up @@ -759,17 +759,17 @@ func (s *Session) ChannelMessageAck(channelID, messageID string) (err error) {
return
}

// ChannelMessageSend sends a message to the given channel.
// channelMessageSend sends a message to the given channel.
// channelID : The ID of a Channel.
// content : The message to send.
// NOTE, mention and tts parameters may be added in 2.x branch.
func (s *Session) ChannelMessageSend(channelID string, content string) (st *Message, err error) {
// tts : Whether to send the message with TTS.
func (s *Session) channelMessageSend(channelID, content string, tts bool) (st *Message, err error) {

// TODO: nonce string ?
data := struct {
Content string `json:"content"`
TTS bool `json:"tts"`
}{content, false}
}{content, tts}

// Send the message to the given channel
response, err := s.Request("POST", CHANNEL_MESSAGES(channelID), data)
Expand All @@ -781,6 +781,22 @@ func (s *Session) ChannelMessageSend(channelID string, content string) (st *Mess
return
}

// ChannelMessageSend sends a message to the given channel.
// channelID : The ID of a Channel.
// content : The message to send.
func (s *Session) ChannelMessageSend(channelID string, content string) (st *Message, err error) {

return s.channelMessageSend(channelID, content, false)
}

// ChannelMessageSendTTS sends a message to the given channel with Text to Speech.
// channelID : The ID of a Channel.
// content : The message to send.
func (s *Session) ChannelMessageSendTTS(channelID string, content string) (st *Message, err error) {

return s.channelMessageSend(channelID, content, true)
}

// ChannelMessageEdit edits an existing message, replacing it entirely with
// the given content.
// channeld : The ID of a Channel
Expand Down

0 comments on commit 64af0e5

Please sign in to comment.