GetTimelines: Allow '#' as hashtag prefix
authorMikael Berthe <mikael@lilotux.net>
Sun, 16 Apr 2017 02:12:38 +0200
changeset 127 96a7f2432d27
parent 126 330c4b83f7d3
child 128 a5a00fad7a32
GetTimelines: Allow '#' as hashtag prefix
timelines.go
--- a/timelines.go	Sat Apr 15 21:08:34 2017 +0200
+++ b/timelines.go	Sun Apr 16 02:12:38 2017 +0200
@@ -8,7 +8,7 @@
 )
 
 // GetTimelines returns a timeline (a list of statuses
-// timeline can be "home", "public", or a hashtag (use ":hashtag")
+// timeline can be "home", "public", or a hashtag (use ":hashtag" or "#hashtag")
 // For the public timelines, you can set 'local' to true to get only the
 // local instance.
 func (g *Client) GetTimelines(timeline string, local bool) ([]Status, error) {
@@ -17,7 +17,7 @@
 	switch {
 	case timeline == "home", timeline == "public":
 		endPoint = "timelines/" + timeline
-	case strings.HasPrefix(timeline, ":"):
+	case strings.HasPrefix(timeline, ":"), strings.HasPrefix(timeline, "#"):
 		hashtag := timeline[1:]
 		if hashtag == "" {
 			return nil, fmt.Errorf("timelines API: empty hashtag")