Skip to content

Commit 843b217

Browse files
koutimabbott
authored andcommitted
twitter: Add support for phrase.
Twitter supports phrase search by quoting terms such as "Zulip API". If we use the feature, the current twitter-bot can't detect used search phrase. We can detect used search phrase with this change.
1 parent 957b5e7 commit 843b217

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

zulip/integrations/twitter/twitter-bot

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -243,6 +243,10 @@ for status in statuses[::-1][:opts.limit_tweets]:
243243
if opts.search_terms:
244244
search_term_used = None
245245
for term in opts.search_terms.split(","):
246+
# Remove quotes from phrase:
247+
# "Zulip API" -> Zulip API
248+
if term.startswith('"') and term.endswith('"'):
249+
term = term[1:-1]
246250
if any(term.lower() in text for text in text_to_check):
247251
search_term_used = term
248252
break

0 commit comments

Comments
 (0)