1
Fork 0
mirror of https://github.com/RYGhub/royalnet.git synced 2024-11-23 03:24:20 +00:00

⬆ Bump version to 6.0.0a32

This commit is contained in:
Steffo 2020-12-30 17:05:42 +01:00
parent 0c0ce7b0db
commit d9930022aa
3 changed files with 12 additions and 4 deletions

View file

@ -1,6 +1,6 @@
[tool.poetry]
name = "royalnet"
version = "6.0.0a28"
version = "6.0.0a32"
description = "A multipurpose bot and web framework"
authors = ["Stefano Pigozzi <ste.pigozzi@gmail.com>"]
license = "AGPL-3.0-or-later"

View file

@ -30,6 +30,11 @@ class Command(c.Conversation):
def __init__(self, f: c.ConversationProtocol, *, name: str, pattern: re.Pattern):
super().__init__(f)
if not name.isalnum():
raise ValueError("Name should be alphanumeric")
if not name.islower():
raise ValueError("Name should be lowercase")
self.name: str = name
"""
The name of the command, as a :class:`str`.
@ -65,7 +70,7 @@ class Command(c.Conversation):
message_kwargs: t.Dict[str, str] = match.groupdict()
log.debug(f"Passing args to function: {message_kwargs!r}")
return await super().run(_sentry=_sentry, **base_kwargs, **message_kwargs)
return await super().run(_sentry=_sentry, _msg=bullet, **base_kwargs, **message_kwargs)
def help(self) -> t.Optional[str]:
"""
@ -91,9 +96,9 @@ class PartialCommand:
The function to pass to :attr:`.c.Conversation.f`.
"""
if not self.name.isalnum():
if not name.isalnum():
raise ValueError("Name should be alphanumeric")
if not self.name.islower():
if not name.islower():
raise ValueError("Name should be lowercase")
self.name: str = name
@ -118,6 +123,8 @@ class PartialCommand:
def decorator(f: c.ConversationProtocol):
partial_command = cls(f=f, *args, **kwargs)
log.debug(f"Created: {partial_command!r}")
return partial_command
return decorator
def complete(self, pattern: str) -> Command:

View file

@ -54,6 +54,7 @@ class Conversation:
def decorator(f: ConversationProtocol):
c = cls(f=f, *args, **kwargs)
log.debug(f"Created: {c!r}")
return c
return decorator
def __call__(self, *, _sentry: s.Sentry, **kwargs) -> t.Awaitable[t.Optional[ConversationProtocol]]: