Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: troll shield anti ban system #2

Merged
merged 5 commits into from
Jul 28, 2020

Conversation

ryukinix
Copy link
Member

@ryukinix ryukinix commented Jul 27, 2020

Changelog

Add secondary bot setup to only make findTrollHouses request

This is important because if the target trollHouse banned this bot, it
will fail to find troll with this error:

{
    "description": "Forbidden: bot was kicked from the supergroup chat",
    "error_code": 403,
    "ok": false
}

However, if we use a hidden bot (unknown from trolls) to only make
this request, it works pretty fine. After all, they never will know
which bot to ban to stop the troll-shield.

This feature is optional and it's enabled automatically when the env var TELEGRAM_BOT_HIDDEN_TOKEN is available.

Add leaveChat events when troll-shield is on trollGroups

Now the bot will leaves the chat when happens this events:

  • The bot was added to a trollGroup
  • A previous trollGroup interacted with the bot

This is important because if the targer trollHouse banned this bot, it
will fail to find troll with this error:

    {
        "description": "Forbidden: bot was kicked from the supergroup chat",
        "error_code": 403,
        "ok": false
    }

However, if we use a hidden bot (unknown from trolls) to only make
this request, it works pretty fine. After all, they never will know
which bot to ban to stop the troll-shield.
@ryukinix ryukinix requested a review from parjanya July 27, 2020 00:41
@ryukinix
Copy link
Member Author

ryukinix commented Jul 27, 2020

Codecov Report

Merging #2 into master will increase coverage by 18.98%.
The diff coverage is 66.66%.

Impacted file tree graph

@@             Coverage Diff             @@
##           master       #2       +/-   ##
===========================================
+ Coverage   60.00%   78.98%   +18.98%     
===========================================
  Files           1        1               
  Lines         110      138       +28     
===========================================
+ Hits           66      109       +43     
+ Misses         44       29       -15     
Flag Coverage Δ
#unittests 78.98% <66.66%> (+18.98%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
troll_shield.go 78.98% <66.66%> (+18.98%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 8b116f5...7acb3b9. Read the comment docs.

@ryukinix
Copy link
Member Author

Although this works as expected, this MR do not have yet proper unit tests. For that reason, I'll not merge a ready and I'll launch only a release-candidate version.

@ryukinix ryukinix force-pushed the feature/troll-shield-anti-ban-system branch from 5c9972b to a1d451e Compare July 27, 2020 00:46
@ryukinix ryukinix self-assigned this Jul 27, 2020
}

func leaveChat(bot TrollShieldBot, update *telegram.Update, trollGroup string) {
reply(bot, update, "Nesse grupo há trolls. Dou-me a liberdade de ir embora. Adeus.")
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like this message. Nice

Copy link
Collaborator

@mateusfccp mateusfccp left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@ryukinix ryukinix merged commit 71f2523 into master Jul 28, 2020
@ryukinix ryukinix deleted the feature/troll-shield-anti-ban-system branch July 28, 2020 11:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants