From 368ac57b04107236786d6fa4bd4cebac4da7ef0c Mon Sep 17 00:00:00 2001 From: klmp200 Date: Thu, 26 Jul 2018 22:36:04 +0200 Subject: [PATCH] Bring Chaos --- alfred.go | 3 ++- commands/twitter.go | 16 +++++++++++++++- 2 files changed, 17 insertions(+), 2 deletions(-) diff --git a/alfred.go b/alfred.go index 4bc15d3..e765490 100644 --- a/alfred.go +++ b/alfred.go @@ -2,7 +2,7 @@ * @Author: Bartuccio Antoine * @Date: 2018-07-23 15:24:22 * @Last Modified by: klmp200 -* @Last Modified time: 2018-07-26 18:59:19 +* @Last Modified time: 2018-07-26 22:32:59 */ package main @@ -28,6 +28,7 @@ func main() { "/roll": commands.Dice, "/trump": commands.LastTrumpTweet, "/trends": commands.TwitterTrends, + "/chaos": commands.TwitterSJW, } if err := settings.LoadSettings("settings.json", "settings_custom.json"); err != nil { diff --git a/commands/twitter.go b/commands/twitter.go index a893eb4..00b1903 100644 --- a/commands/twitter.go +++ b/commands/twitter.go @@ -2,7 +2,7 @@ * @Author: Bartuccio Antoine * @Date: 2018-07-25 18:51:38 * @Last Modified by: klmp200 -* @Last Modified time: 2018-07-26 22:21:29 +* @Last Modified time: 2018-07-26 22:35:14 */ package commands @@ -82,3 +82,17 @@ func TwitterTrends(m *tb.Message) { } shared.Bot.Send(m.Chat, message) } + +func TwitterSJW(m *tb.Message) { + testOrInitTwitter() + tweets, _, err := client.Search.Tweets(&twitter.SearchTweetParams{ + Query: "#SJW", + }) + if err != nil { + twitterCommunicationError(m) + return + } + for _, tweet := range tweets.Statuses { + shared.Bot.Send(m.Chat, tweet.Text) + } +}