Skip to content

Check: is_room_encrypted #108

Description

@PenguinBoi12

Users have to implement manually a check to verify if a user performing a command is in a encrypted room. Since it's a common pattern, we should implement a check for that in checks.py.

Proposed API

def is_room_encrypted() -> Callable:
    async def _is_room_encrypted(ctx: Context) -> bool:
        ...

    def wrapper(cmd: Command) -> Command:
        cmd.check(_is_room_encrypted)

Example

from matrix.checks import is_admin

@_is_room_encrypted()
@bot.command()
async def kick(ctx, user: str) -> None:

Before opening a PR

  • Write unit tests
  • Run mypy
  • Run pytest tests/
  • Run black .

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions