diff --git a/royalpack/commands/matchmaking.py b/royalpack/commands/matchmaking.py index 8ebadc90..db1eab86 100644 --- a/royalpack/commands/matchmaking.py +++ b/royalpack/commands/matchmaking.py @@ -59,11 +59,12 @@ class MatchmakingCommand(Command): except OverflowError: dt = None if dt is None: - await data.reply("⚠️ La data che hai specificato non è valida.") - return + raise InvalidInputError("⚠️ La data che hai specificato non è valida.") if dt <= datetime.datetime.now(): - await data.reply("⚠️ La data che hai specificato è nel passato.") - return + raise InvalidInputError("⚠️ La data che hai specificato è nel passato.") + if dt - datetime.datetime.now() >= datetime.timedelta(days=366): + raise InvalidInputError("⚠️ Hai specificato una data tra più di un anno!\n" + "Se volevi scrivere un'orario, ricordati che le ore sono separati ") mmevent: MMEvent = self.alchemy.get(MMEvent)(creator=author, datetime=dt, title=title, diff --git a/royalpack/commands/steampowered.py b/royalpack/commands/steampowered.py index 6de0612a..3c3ea324 100644 --- a/royalpack/commands/steampowered.py +++ b/royalpack/commands/steampowered.py @@ -32,12 +32,11 @@ class SteampoweredCommand(Command): f"Created on: [b]{account.account_creation_date}[/b]\n" return string - @staticmethod - async def _call(method, *args, **kwargs): + async def _call(self, method, *args, **kwargs): try: await asyncify(method, *args, **kwargs) - except Exception: - raise ExternalError("Steam API request returned an error.") + except Exception as e: + raise ExternalError("\n".join(e.args).replace(self.config["Steam"]["web_api_key"], "HIDDEN")) async def _update(self, account: Steam): # noinspection PyProtectedMember @@ -54,6 +53,8 @@ class SteampoweredCommand(Command): if len(args) > 0: url = args.joined() steamid64 = await self._call(steam.steamid.steam64_from_url, url) + if steamid64 is None: + raise InvalidInputError("Quel link non è associato ad alcun account Steam.") response = await self._call(self._api.ISteamUser.GetPlayerSummaries_v2, steamids=steamid64) r = response["response"]["players"][0] steam_account = self.alchemy.get(Steam)(