diff --git a/src/commands.py b/src/commands.py index f5fbbc3..d9e2648 100644 --- a/src/commands.py +++ b/src/commands.py @@ -27,7 +27,7 @@ def annoy(self, invkr_id, parameter): """ - if not parameter: + if not len(parameter) != 1: err = "Please use the command like this: .annoy TARGET MESSAGE" self.bot.sendtextmessage(targetmode=1, target=invkr_id, msg=err) return diff --git a/src/gecko.py b/src/gecko.py index 9530760..9371895 100644 --- a/src/gecko.py +++ b/src/gecko.py @@ -3,12 +3,13 @@ TBD """ __author__ = "Lukas Mahler" -__version__ = "0.0.0" -__date__ = "27.09.2021" +__version__ = "0.0.1" +__date__ = "04.02.2022" __email__ = "m@hler.eu" __status__ = "Development" # Imports +from datetime import datetime from pycoingecko import CoinGeckoAPI @@ -44,7 +45,12 @@ class GeckoAPI: matching = [x for x in self.coinlist if x["id"] == symbol_id.lower()] if len(matching) == 1: - resp_dict = self.api.get_price(ids=matching[0]["id"], vs_currencies=curr.lower()) + try: + resp_dict = self.api.get_price(ids=matching[0]["id"], vs_currencies=curr.lower()) + except Exception as e: + with open("gecko_error.log", 'a+') as log: + log.write(f"{datetime.now():%Y-%m-%d %H:%M} | {e}\n") + return "Error" price = resp_dict[matching[0]["id"]][curr.lower()] if isinstance(price, int): price = float(price) # Convert to always have floats