From 0123497f54ce3dc7224e52d770cbb6cacece6375 Mon Sep 17 00:00:00 2001 From: Abigail Gold Date: Wed, 9 Oct 2019 01:39:37 -0400 Subject: [PATCH] fixed bare excepts --- cogs/morsecog.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/cogs/morsecog.py b/cogs/morsecog.py index f32e37a..7ccacf6 100644 --- a/cogs/morsecog.py +++ b/cogs/morsecog.py @@ -28,9 +28,9 @@ class MorseCog(commands.Cog): with ctx.typing(): result = '' for char in msg.upper(): - try: + if char in self.ascii2morse: result += self.ascii2morse[char] - except: + else: result += '' result += ' ' embed = discord.Embed(title=f'Morse Code for {msg}', @@ -51,9 +51,9 @@ class MorseCog(commands.Cog): msg = [m.split() for m in msg] for word in msg: for char in word: - try: + if char in self.morse2ascii: result += self.morse2ascii[char] - except: + else: result += '' result += ' ' embed = discord.Embed(title=f'ASCII for {msg0}', @@ -71,10 +71,10 @@ class MorseCog(commands.Cog): msg = msg.upper() weight = 0 for char in msg: - try: + if char in self.ascii2morse: cwChar = self.ascii2morse[char].replace('-', '==') weight += len(cwChar) * 2 + 2 - except: + else: res = f'Unknown character {char} in callsign' await ctx.send(res) return