added exception handling to a division by zero error

This commit is contained in:
phixxy 2024-02-06 01:42:07 -08:00
parent be8364b69c
commit 2b127c225d

View file

@ -43,7 +43,12 @@ class InkyScreen(commands.Cog):
width = self.display.WIDTH width = self.display.WIDTH
height = self.display.HEIGHT height = self.display.HEIGHT
lines = len(text) lines = len(text)
height_diff = height/lines try:
height_diff = height/lines
except:
self.bot.logger.exception("InkyScreen: Failed to calculate height_diff.")
self.bot.logger.info(f"InkyScreen: Text: {text}")
return
x = 0 x = 0
y = 0 y = 0
for line in text: for line in text: