Merge pull request #205 from miaowware/fix-typing

Added/fixed/removed typing managers
This commit is contained in:
0x5c 2020-02-25 20:57:07 -05:00 committed by GitHub
commit f6ed8430b9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
7 changed files with 216 additions and 224 deletions

View File

@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased]
### Fixed
- Fixed issue where HamStudy questions with images would cause an error.
- Added/fixed/removed typing indicators in numerous commands.
## [2.2.1] - 2020-02-20

View File

@ -39,7 +39,6 @@ class FunCog(commands.Cog):
@commands.command(name="funetics", aliases=["fun"], category=cmn.cat.fun)
async def _funetics_lookup(self, ctx: commands.Context, *, msg: str):
"""Generates fun/wacky phonetics for a word or phrase."""
with ctx.typing():
result = ""
for char in msg.lower():
if char.isalpha():

View File

@ -23,7 +23,6 @@ class GridCog(commands.Cog):
async def _grid_sq_lookup(self, ctx: commands.Context, lat: str, lon: str):
("""Calculates the grid square for latitude and longitude coordinates, """
"""with negative being latitude South and longitude West.""")
with ctx.typing():
grid = "**"
latf = float(lat) + 90
lonf = float(lon) + 180
@ -53,7 +52,6 @@ class GridCog(commands.Cog):
async def _location_lookup(self, ctx: commands.Context, grid: str, grid2: str = None):
"""Calculates the latitude and longitude for the center of a grid square.
If two grid squares are given, the distance and azimuth between them is calculated."""
with ctx.typing():
if grid2 is None or grid2 == "":
try:
grid = grid.upper()

View File

@ -25,7 +25,6 @@ class HamCog(commands.Cog):
@commands.command(name="qcode", aliases=["q"], category=cmn.cat.ref)
async def _qcode_lookup(self, ctx: commands.Context, qcode: str):
"""Looks up the meaning of a Q Code."""
with ctx.typing():
qcode = qcode.upper()
embed = cmn.embed_factory(ctx)
if qcode in qcodes.qcodes:
@ -40,7 +39,6 @@ class HamCog(commands.Cog):
@commands.command(name="phonetics", aliases=["ph", "phoneticize", "phoneticise", "phone"], category=cmn.cat.ref)
async def _phonetics_lookup(self, ctx: commands.Context, *, msg: str):
"""Returns NATO phonetics for a word or phrase."""
with ctx.typing():
result = ""
for char in msg.lower():
if char.isalpha():
@ -57,7 +55,6 @@ class HamCog(commands.Cog):
@commands.command(name="utc", aliases=["z"], category=cmn.cat.ref)
async def _utc_lookup(self, ctx: commands.Context):
"""Returns the current time in UTC."""
with ctx.typing():
now = datetime.utcnow()
result = "**" + now.strftime("%Y-%m-%d %H:%M") + "Z**"
embed = cmn.embed_factory(ctx)

View File

@ -40,7 +40,6 @@ class LookupCog(commands.Cog):
@commands.command(name="dxcc", aliases=["dx"], category=cmn.cat.lookup)
async def _dxcc_lookup(self, ctx: commands.Context, query: str):
"""Gets DXCC info about a callsign prefix."""
with ctx.typing():
query = query.upper()
full_query = query
embed = cmn.embed_factory(ctx)

View File

@ -21,7 +21,6 @@ class MorseCog(commands.Cog):
@commands.command(name="morse", aliases=["cw"], category=cmn.cat.ref)
async def _morse(self, ctx: commands.Context, *, msg: str):
"""Converts ASCII to international morse code."""
with ctx.typing():
result = ""
for char in msg.upper():
try:
@ -38,7 +37,6 @@ class MorseCog(commands.Cog):
@commands.command(name="unmorse", aliases=["demorse", "uncw", "decw"], category=cmn.cat.ref)
async def _unmorse(self, ctx: commands.Context, *, msg: str):
"""Converts international morse code to ASCII."""
with ctx.typing():
result = ""
msg0 = msg
msg = msg.split("/")
@ -60,7 +58,6 @@ class MorseCog(commands.Cog):
async def _weight(self, ctx: commands.Context, *, msg: str):
"""Calculates the CW weight of a callsign or message."""
embed = cmn.embed_factory(ctx)
with ctx.typing():
msg = msg.upper()
weight = 0
for char in msg:

View File

@ -36,6 +36,7 @@ class QRZCog(commands.Cog):
await ctx.send(f"http://qrz.com/db/{callsign}")
return
async with ctx.typing():
try:
await qrz_test_session(self.key, self.session)
except ConnectionError: