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 basic constraints #745

Merged
merged 2 commits into from
Nov 21, 2018
Merged

Conversation

jacobtomlinson
Copy link
Member

@jacobtomlinson jacobtomlinson commented Nov 20, 2018

Description

This PR adds some constraint decorators for use when writing skills. These allow you to restrict when skills are run even if they are matched. The initial constraints I've added are constrain_rooms, constrain_users and constrain_connectors which allow you to restrict a skill to a set of rooms, users or connectors respectively.

This is the precursor to adding context for #156.

Status

READY

Type of change

  • New feature (non-breaking change which adds functionality)

How Has This Been Tested?

Added new tests and run locally.

Checklist:

  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation (if applicable)
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@codecov
Copy link

codecov bot commented Nov 21, 2018

Codecov Report

Merging #745 into master will not change coverage.
The diff coverage is 100%.

Impacted file tree graph

@@          Coverage Diff          @@
##           master   #745   +/-   ##
=====================================
  Coverage     100%   100%           
=====================================
  Files          27     28    +1     
  Lines        1804   1843   +39     
=====================================
+ Hits         1804   1843   +39
Impacted Files Coverage Δ
opsdroid/parsers/witai.py 100% <100%> (ø) ⬆️
opsdroid/matchers.py 100% <100%> (ø) ⬆️
opsdroid/parsers/regex.py 100% <100%> (ø) ⬆️
opsdroid/parsers/luisai.py 100% <100%> (ø) ⬆️
opsdroid/constraints.py 100% <100%> (ø)
opsdroid/parsers/recastai.py 100% <100%> (ø) ⬆️
opsdroid/helper.py 100% <100%> (ø) ⬆️
opsdroid/parsers/dialogflow.py 100% <100%> (ø) ⬆️
opsdroid/parsers/rasanlu.py 100% <100%> (ø) ⬆️
opsdroid/core.py 100% <100%> (ø) ⬆️
... and 1 more

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 6a0e216...0161775. Read the comment docs.

@FabioRosado
Copy link
Member

This looks great, I was thinking how to specify a certain user to interact with opsdroid as we have mentioned this from time to time on gitter/matrix. I've just updated this branch and will merge the PR as soon as travis is happy

@FabioRosado FabioRosado merged commit 2a9059e into opsdroid:master Nov 21, 2018
@jacobtomlinson jacobtomlinson deleted the constraints branch November 21, 2018 11:15
FabioRosado pushed a commit to FabioRosado/opsdroid that referenced this pull request Dec 18, 2018
FabioRosado pushed a commit to FabioRosado/opsdroid that referenced this pull request Dec 18, 2018
FabioRosado pushed a commit to FabioRosado/opsdroid that referenced this pull request Dec 18, 2018
FabioRosado pushed a commit to FabioRosado/opsdroid that referenced this pull request Dec 18, 2018
FabioRosado pushed a commit to FabioRosado/opsdroid that referenced this pull request Dec 18, 2018
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.

None yet

2 participants