mirror of
https://github.com/RYGhub/royalnet.git
synced 2024-11-27 13:34:28 +00:00
some small improvements
This commit is contained in:
parent
f90fdc0627
commit
8ff0731aa5
3 changed files with 16 additions and 6 deletions
|
@ -66,7 +66,7 @@
|
|||
alchemy_easy = ["sqlalchemy", "psycopg2_binary"]
|
||||
alchemy_hard = ["sqlalchemy", "psycopg2"]
|
||||
bard = ["ffmpeg_python", "youtube_dl"]
|
||||
constellation = ["starlette", "uvicorn"]
|
||||
constellation = ["starlette", "uvicorn", "python-multipart"]
|
||||
sentry = ["sentry_sdk"]
|
||||
herald = ["websockets"]
|
||||
coloredlogs = ["coloredlogs"]
|
||||
|
|
|
@ -15,15 +15,25 @@ class Event:
|
|||
self.interface: CommandInterface = interface
|
||||
"""The :class:`CommandInterface` available to this :class:`Event`."""
|
||||
|
||||
@property
|
||||
def serf(self):
|
||||
"""A shortcut for :attr:`.interface.serf`."""
|
||||
return self.interface.serf
|
||||
|
||||
@property
|
||||
def alchemy(self):
|
||||
"""A shortcut for :attr:`.interface.serf.alchemy`."""
|
||||
return self.interface.serf.alchemy
|
||||
"""A shortcut for :attr:`.interface.alchemy`."""
|
||||
return self.interface.alchemy
|
||||
|
||||
@property
|
||||
def loop(self):
|
||||
"""A shortcut for :attr:`.interface.serf.loop`"""
|
||||
return self.interface.serf.loop
|
||||
"""A shortcut for :attr:`.interface.loop`."""
|
||||
return self.interface.loop
|
||||
|
||||
@property
|
||||
def config(self):
|
||||
"""A shortcut for :attr:`.interface.config`."""
|
||||
return self.interface.config
|
||||
|
||||
async def run(self, **kwargs):
|
||||
raise NotImplementedError()
|
||||
|
|
|
@ -166,7 +166,7 @@ class Serf:
|
|||
response: rh.Response = await self.herald.request(destination=destination, request=request)
|
||||
if isinstance(response, rh.ResponseFailure):
|
||||
if response.name == "no_event":
|
||||
raise CommandError(f"There is no event named {event_name} in {destination}.")
|
||||
raise ProgramError(f"There is no event named {event_name} in {destination}.")
|
||||
elif response.name == "error_in_event":
|
||||
if response.extra_info["type"] == "CommandError":
|
||||
raise CommandError(response.extra_info["message"])
|
||||
|
|
Loading…
Reference in a new issue