forked from pothtonswer/discordmuffin
Change API for ChannelMessages to accept Message ID's as strings. Fixes #120
This commit is contained in:
parent
e1a88003e6
commit
50b7bdd6ff
1 changed files with 5 additions and 5 deletions
10
restapi.go
10
restapi.go
|
@ -794,7 +794,7 @@ func (s *Session) ChannelTyping(channelID string) (err error) {
|
||||||
// limit : The number messages that can be returned.
|
// limit : The number messages that can be returned.
|
||||||
// beforeID : If provided all messages returned will be before given ID.
|
// beforeID : If provided all messages returned will be before given ID.
|
||||||
// afterID : If provided all messages returned will be after given ID.
|
// afterID : If provided all messages returned will be after given ID.
|
||||||
func (s *Session) ChannelMessages(channelID string, limit int, beforeID int, afterID int) (st []*Message, err error) {
|
func (s *Session) ChannelMessages(channelID string, limit int, beforeID, afterID string) (st []*Message, err error) {
|
||||||
|
|
||||||
uri := CHANNEL_MESSAGES(channelID)
|
uri := CHANNEL_MESSAGES(channelID)
|
||||||
|
|
||||||
|
@ -802,11 +802,11 @@ func (s *Session) ChannelMessages(channelID string, limit int, beforeID int, aft
|
||||||
if limit > 0 {
|
if limit > 0 {
|
||||||
v.Set("limit", strconv.Itoa(limit))
|
v.Set("limit", strconv.Itoa(limit))
|
||||||
}
|
}
|
||||||
if afterID > 0 {
|
if afterID != "" {
|
||||||
v.Set("after", strconv.Itoa(afterID))
|
v.Set("after", afterID)
|
||||||
}
|
}
|
||||||
if beforeID > 0 {
|
if beforeID != "" {
|
||||||
v.Set("before", strconv.Itoa(beforeID))
|
v.Set("before", beforeID)
|
||||||
}
|
}
|
||||||
if len(v) > 0 {
|
if len(v) > 0 {
|
||||||
uri = fmt.Sprintf("%s?%s", uri, v.Encode())
|
uri = fmt.Sprintf("%s?%s", uri, v.Encode())
|
||||||
|
|
Loading…
Reference in a new issue