mirror of
https://github.com/miaowware/qrm2.git
synced 2024-11-23 00:08:38 -05:00
fixed bare excepts
This commit is contained in:
parent
021a1312cb
commit
0123497f54
@ -28,9 +28,9 @@ class MorseCog(commands.Cog):
|
|||||||
with ctx.typing():
|
with ctx.typing():
|
||||||
result = ''
|
result = ''
|
||||||
for char in msg.upper():
|
for char in msg.upper():
|
||||||
try:
|
if char in self.ascii2morse:
|
||||||
result += self.ascii2morse[char]
|
result += self.ascii2morse[char]
|
||||||
except:
|
else:
|
||||||
result += '<?>'
|
result += '<?>'
|
||||||
result += ' '
|
result += ' '
|
||||||
embed = discord.Embed(title=f'Morse Code for {msg}',
|
embed = discord.Embed(title=f'Morse Code for {msg}',
|
||||||
@ -51,9 +51,9 @@ class MorseCog(commands.Cog):
|
|||||||
msg = [m.split() for m in msg]
|
msg = [m.split() for m in msg]
|
||||||
for word in msg:
|
for word in msg:
|
||||||
for char in word:
|
for char in word:
|
||||||
try:
|
if char in self.morse2ascii:
|
||||||
result += self.morse2ascii[char]
|
result += self.morse2ascii[char]
|
||||||
except:
|
else:
|
||||||
result += '<?>'
|
result += '<?>'
|
||||||
result += ' '
|
result += ' '
|
||||||
embed = discord.Embed(title=f'ASCII for {msg0}',
|
embed = discord.Embed(title=f'ASCII for {msg0}',
|
||||||
@ -71,10 +71,10 @@ class MorseCog(commands.Cog):
|
|||||||
msg = msg.upper()
|
msg = msg.upper()
|
||||||
weight = 0
|
weight = 0
|
||||||
for char in msg:
|
for char in msg:
|
||||||
try:
|
if char in self.ascii2morse:
|
||||||
cwChar = self.ascii2morse[char].replace('-', '==')
|
cwChar = self.ascii2morse[char].replace('-', '==')
|
||||||
weight += len(cwChar) * 2 + 2
|
weight += len(cwChar) * 2 + 2
|
||||||
except:
|
else:
|
||||||
res = f'Unknown character {char} in callsign'
|
res = f'Unknown character {char} in callsign'
|
||||||
await ctx.send(res)
|
await ctx.send(res)
|
||||||
return
|
return
|
||||||
|
Loading…
Reference in New Issue
Block a user