Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Make session.ChannelMessages() accept MessageID as a string #120

Closed
moxian opened this issue Feb 19, 2016 · 0 comments
Closed

Make session.ChannelMessages() accept MessageID as a string #120

moxian opened this issue Feb 19, 2016 · 0 comments
Labels
feature Feature implementation
Milestone

Comments

@moxian
Copy link

moxian commented Feb 19, 2016

Currently session.ChannelMessages() accepts before and after message IDs as strings. Everywhere else message IDs are strings, so to pass them to ChannelMessages() one has to call strconv.Atoi() or something similar, which is rather cumbersome.
Consider making ChannelMessages accept Message ID as a string instead.

One caveat is that this change will make it difficult to obtain the very last message (channel.LastMessageId), because ChannelMessages does not include first and last messages in the response. A workaround to that would be making utility functions to return an Message ID that immediately follows/precedes given one.

func NextMessageID(mID string) string {
  idInt, _ = strconv.Atoi(mID)
  return fmt.Sprintf("%d", idInt + 1)
}

or something along the lines.

@bwmarrin bwmarrin added the feature Feature implementation label Feb 20, 2016
@bwmarrin bwmarrin added this to the v0.11.0 milestone Feb 20, 2016
bwmarrin added a commit that referenced this issue Feb 20, 2016
BREAKING -- Change API for ChannelMessages to accept Message ID's as strings. Fixes #120
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature Feature implementation
Projects
None yet
Development

No branches or pull requests

2 participants