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

Add support to qualified command like /pass@lelerax_bot #11

Merged
merged 2 commits into from
Aug 14, 2020

Conversation

ryukinix
Copy link
Member

I finally registered the bot commands via API, so we have autocomplete
on Telegram by using the bot. In groups using /pass or /kills would be
translated to /pass@lelerax_bot and /kills@lelerax_bot, but in v0.7.0
troll-shield version this is not supported.

This PR takes care to support this properly, giving attention to edge
cases like using /pass@anotherBotName (this will not work). /pass
/kill simplified syntax will always works, but can trigger multiple
bots if they implements the same command.

CHANGELOG:

  • Add checkCommand which checks properly if is a valid command
  • Add commandEvent which can be use to filter commands (performance)
  • Add unit tests for both functions
  • Rename /lelerax to /ping, which makes more sense.
  • Add renan_r as admin.

I finally registered the bot commands via API, so we have autocomplete
on Telegram by using the bot. In groups using /pass or /kills would be
translated to /pass@lelerax_bot and /kills@lelerax_bot, but in v0.7.0
troll-shield version this is not supported.

This PR takes care to support this properly, giving attention to edge
cases like using /pass@anotherBotName (this will not work). /pass
/kill simplified syntax will always works, but can trigger multiple
bots if they implements the same command.

CHANGELOG:
- Add checkCommand which checks properly if is a valid command
- Add commandEvent which can be use to filter commands (performance)
- Add unit tests for both functions
- Rename /lelerax to /ping, which makes more sense.
- Add renan_r as admin.
@ryukinix ryukinix self-assigned this Aug 13, 2020
@ryukinix
Copy link
Member Author

Codecov Report

Merging #11 into master will increase coverage by 0.29%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #11      +/-   ##
==========================================
+ Coverage   94.15%   94.44%   +0.29%     
==========================================
  Files           1        1              
  Lines         171      180       +9     
==========================================
+ Hits          161      170       +9     
  Misses         10       10              
Flag Coverage Δ
#unittests 94.44% <100.00%> (+0.29%) ⬆️

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

Impacted Files Coverage Δ
troll_shield.go 94.44% <100.00%> (+0.29%) ⬆️

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 8888d72...161783a. Read the comment docs.

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.

Seems good

@ryukinix ryukinix merged commit 24cedd5 into master Aug 14, 2020
@ryukinix ryukinix deleted the feature/qualified-commands branch August 14, 2020 15:55
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