1
Fork 0
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:
Steffo 2019-11-30 14:50:37 +01:00
parent f90fdc0627
commit 8ff0731aa5
3 changed files with 16 additions and 6 deletions

View file

@ -66,7 +66,7 @@
alchemy_easy = ["sqlalchemy", "psycopg2_binary"] alchemy_easy = ["sqlalchemy", "psycopg2_binary"]
alchemy_hard = ["sqlalchemy", "psycopg2"] alchemy_hard = ["sqlalchemy", "psycopg2"]
bard = ["ffmpeg_python", "youtube_dl"] bard = ["ffmpeg_python", "youtube_dl"]
constellation = ["starlette", "uvicorn"] constellation = ["starlette", "uvicorn", "python-multipart"]
sentry = ["sentry_sdk"] sentry = ["sentry_sdk"]
herald = ["websockets"] herald = ["websockets"]
coloredlogs = ["coloredlogs"] coloredlogs = ["coloredlogs"]

View file

@ -15,15 +15,25 @@ class Event:
self.interface: CommandInterface = interface self.interface: CommandInterface = interface
"""The :class:`CommandInterface` available to this :class:`Event`.""" """The :class:`CommandInterface` available to this :class:`Event`."""
@property
def serf(self):
"""A shortcut for :attr:`.interface.serf`."""
return self.interface.serf
@property @property
def alchemy(self): def alchemy(self):
"""A shortcut for :attr:`.interface.serf.alchemy`.""" """A shortcut for :attr:`.interface.alchemy`."""
return self.interface.serf.alchemy return self.interface.alchemy
@property @property
def loop(self): def loop(self):
"""A shortcut for :attr:`.interface.serf.loop`""" """A shortcut for :attr:`.interface.loop`."""
return self.interface.serf.loop return self.interface.loop
@property
def config(self):
"""A shortcut for :attr:`.interface.config`."""
return self.interface.config
async def run(self, **kwargs): async def run(self, **kwargs):
raise NotImplementedError() raise NotImplementedError()

View file

@ -166,7 +166,7 @@ class Serf:
response: rh.Response = await self.herald.request(destination=destination, request=request) response: rh.Response = await self.herald.request(destination=destination, request=request)
if isinstance(response, rh.ResponseFailure): if isinstance(response, rh.ResponseFailure):
if response.name == "no_event": 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": elif response.name == "error_in_event":
if response.extra_info["type"] == "CommandError": if response.extra_info["type"] == "CommandError":
raise CommandError(response.extra_info["message"]) raise CommandError(response.extra_info["message"])