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

Message and slash checks for components #154

Open
wants to merge 3 commits into
base: master
Choose a base branch
from

Conversation

A5rocks
Copy link
Contributor

@A5rocks A5rocks commented Nov 13, 2021

Summary

Implements message and slash checks on components

Checklist

  • I have run nox and all the pipelines have passed.
  • I have made unittests according to the code I have added/modified/deleted.

Related issues

One of the todo cards iunno

@@ -576,7 +628,11 @@ def unbind_client(self, client: abc.Client, /) -> None:
self._client = None

async def _check_context(self, ctx: abc.Context, /) -> bool:
return await utilities.gather_checks(ctx, self._checks)
if abc.SlashContext in type(ctx).mro():
Copy link
Owner

Choose a reason for hiding this comment

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

Rather than instance check here, we could just specifically call utilitiys.gather_checks(ctx, self._slash_checks/self._message_checks) around line 645 and 656

@@ -228,6 +242,10 @@ def name(self) -> str:
def slash_commands(self) -> collections.Collection[abc.BaseSlashCommand]:
return self._slash_commands.copy().values()

@property
def slash_checks(self) -> collections.Collection[abc.CheckSig]:
return tuple(check.callback for check in self._slash_checks)
Copy link
Owner

Choose a reason for hiding this comment

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

Could we get a quick 1 line docstring here explaining it

@@ -236,13 +254,17 @@ def slash_hooks(self) -> typing.Optional[abc.SlashHooks]:
def message_commands(self) -> collections.Collection[abc.MessageCommand]:
return self._message_commands.copy()

@property
def message_checks(self) -> collections.Collection[abc.CheckSig]:
Copy link
Owner

Choose a reason for hiding this comment

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

Could we get a quick 1 line docstring here explaining it

@FasterSpeeding
Copy link
Owner

Looks like you'll also need to rebase now ;3

@FasterSpeeding
Copy link
Owner

FasterSpeeding commented Jan 2, 2022

Grand Dad

@A5rocks
Copy link
Contributor Author

A5rocks commented Jan 18, 2022

Grand Dad Part 2

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