walfie / gbf-raidfinder

Granblue Raid Finder (Archived: Granblue no longer has raid tweets)
https://gbf-raidfinder.aikats.us
MIT License
206 stars 106 forks source link

Question: How to identify if a twitter is sent from the game? #127

Closed raririn closed 6 years ago

raririn commented 6 years ago

Hello!

Recently quite a lot people are sending fake raid twitters to attract who use auto-farming tools. I notice that even the twitter is in correct format (e.g. xxxxxxxx :参戦ID 参加者募集! Lv120 ゴッドガード・ブローディア pic.twitter.com/xxxxxxxxxx), it does not appear on the raidfinder. I'm very curious how the identification works, but I didn't find in the code (or perhaps I didn't check carefully enough). Would you please tell how, or in which file it works? Thank you!

walfie commented 6 years ago

All the logic can be found in StatusParser.scala: https://github.com/walfie/gbf-raidfinder/blob/master/stream/src/main/scala/walfie/gbf/raidfinder/StatusParser.scala

you can tell it came from the game based on the source of the tweet, which should be:

<a href="http://granbluefantasy.jp/" rel="nofollow">グランブルー ファンタジー</a>

However we need to consider that the game can also send tweets for other things like the daily AP/BP refresh, or events like Granblue Haiku, where the user can type whatever they want (and it could potentially be made to look like a raid tweet, since it is coming from the game). This is handled in the regexes, though it's been so long that I don't remember exactly how they work. The logic is all in StatusParser.scala though.

You can find some test cases here: https://github.com/walfie/gbf-raidfinder/blob/717c0258816ca139c06c5eb36b278aeb2481d81b/stream/src/test/scala/walfie/gbf/raidfinder/StatusParserSpec.scala#L166-L190

raririn commented 6 years ago

Got it, thanks!