So my bot account have to reply to only original tweets that mentioned my bot’s screen_name.
So here’s the rule I applied:
printer = IDPrinter(keys.bearer_token)
printer.add_rules(tweepy.StreamRule('@botName -(from:botName OR is:reply)'))
Doesn’t above rule means stream tweet that mentioning @botName but it has to be a original tweet and not a tweet from a bot itself?
But if I test the above code such as ‘@myBot Hey’, it doesn’t stream the tweet.
What am I doing wring here?
Can I get any help? Thanks
I think the parentheses with a negation doesn’t work, negation has to be applied to an operator instead, so this should work:
@botName -from:botName -is:reply
1 Like
Thanks for the help, but unfortunately it does not work.
Doesn’t work as in doesn’t match tweets or something else?
I would have thought original tweets starting with a mention would not be treated as a reply but maybe I’m wrong.
You may have to have a broader rule and then filter things out yourself:
to:botName -from:botName
And then check to see that the tweet is an original tweet, by comparing the conversation_id and tweet ID, if they’re different it’s not an original tweet, if they’re the same it’s a new tweet that was created.