mirror of
https://github.com/miaowware/qrm2.git
synced 2024-09-28 06:46:34 -04:00
Merge pull request #205 from miaowware/fix-typing
Added/fixed/removed typing managers
This commit is contained in:
commit
f6ed8430b9
@ -7,6 +7,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
|
|||||||
## [Unreleased]
|
## [Unreleased]
|
||||||
### Fixed
|
### Fixed
|
||||||
- Fixed issue where HamStudy questions with images would cause an error.
|
- 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
|
## [2.2.1] - 2020-02-20
|
||||||
|
@ -39,7 +39,6 @@ class FunCog(commands.Cog):
|
|||||||
@commands.command(name="funetics", aliases=["fun"], category=cmn.cat.fun)
|
@commands.command(name="funetics", aliases=["fun"], category=cmn.cat.fun)
|
||||||
async def _funetics_lookup(self, ctx: commands.Context, *, msg: str):
|
async def _funetics_lookup(self, ctx: commands.Context, *, msg: str):
|
||||||
"""Generates fun/wacky phonetics for a word or phrase."""
|
"""Generates fun/wacky phonetics for a word or phrase."""
|
||||||
with ctx.typing():
|
|
||||||
result = ""
|
result = ""
|
||||||
for char in msg.lower():
|
for char in msg.lower():
|
||||||
if char.isalpha():
|
if char.isalpha():
|
||||||
|
@ -23,7 +23,6 @@ class GridCog(commands.Cog):
|
|||||||
async def _grid_sq_lookup(self, ctx: commands.Context, lat: str, lon: str):
|
async def _grid_sq_lookup(self, ctx: commands.Context, lat: str, lon: str):
|
||||||
("""Calculates the grid square for latitude and longitude coordinates, """
|
("""Calculates the grid square for latitude and longitude coordinates, """
|
||||||
"""with negative being latitude South and longitude West.""")
|
"""with negative being latitude South and longitude West.""")
|
||||||
with ctx.typing():
|
|
||||||
grid = "**"
|
grid = "**"
|
||||||
latf = float(lat) + 90
|
latf = float(lat) + 90
|
||||||
lonf = float(lon) + 180
|
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):
|
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.
|
"""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."""
|
If two grid squares are given, the distance and azimuth between them is calculated."""
|
||||||
with ctx.typing():
|
|
||||||
if grid2 is None or grid2 == "":
|
if grid2 is None or grid2 == "":
|
||||||
try:
|
try:
|
||||||
grid = grid.upper()
|
grid = grid.upper()
|
||||||
|
@ -25,7 +25,6 @@ class HamCog(commands.Cog):
|
|||||||
@commands.command(name="qcode", aliases=["q"], category=cmn.cat.ref)
|
@commands.command(name="qcode", aliases=["q"], category=cmn.cat.ref)
|
||||||
async def _qcode_lookup(self, ctx: commands.Context, qcode: str):
|
async def _qcode_lookup(self, ctx: commands.Context, qcode: str):
|
||||||
"""Looks up the meaning of a Q Code."""
|
"""Looks up the meaning of a Q Code."""
|
||||||
with ctx.typing():
|
|
||||||
qcode = qcode.upper()
|
qcode = qcode.upper()
|
||||||
embed = cmn.embed_factory(ctx)
|
embed = cmn.embed_factory(ctx)
|
||||||
if qcode in qcodes.qcodes:
|
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)
|
@commands.command(name="phonetics", aliases=["ph", "phoneticize", "phoneticise", "phone"], category=cmn.cat.ref)
|
||||||
async def _phonetics_lookup(self, ctx: commands.Context, *, msg: str):
|
async def _phonetics_lookup(self, ctx: commands.Context, *, msg: str):
|
||||||
"""Returns NATO phonetics for a word or phrase."""
|
"""Returns NATO phonetics for a word or phrase."""
|
||||||
with ctx.typing():
|
|
||||||
result = ""
|
result = ""
|
||||||
for char in msg.lower():
|
for char in msg.lower():
|
||||||
if char.isalpha():
|
if char.isalpha():
|
||||||
@ -57,7 +55,6 @@ class HamCog(commands.Cog):
|
|||||||
@commands.command(name="utc", aliases=["z"], category=cmn.cat.ref)
|
@commands.command(name="utc", aliases=["z"], category=cmn.cat.ref)
|
||||||
async def _utc_lookup(self, ctx: commands.Context):
|
async def _utc_lookup(self, ctx: commands.Context):
|
||||||
"""Returns the current time in UTC."""
|
"""Returns the current time in UTC."""
|
||||||
with ctx.typing():
|
|
||||||
now = datetime.utcnow()
|
now = datetime.utcnow()
|
||||||
result = "**" + now.strftime("%Y-%m-%d %H:%M") + "Z**"
|
result = "**" + now.strftime("%Y-%m-%d %H:%M") + "Z**"
|
||||||
embed = cmn.embed_factory(ctx)
|
embed = cmn.embed_factory(ctx)
|
||||||
|
@ -40,7 +40,6 @@ class LookupCog(commands.Cog):
|
|||||||
@commands.command(name="dxcc", aliases=["dx"], category=cmn.cat.lookup)
|
@commands.command(name="dxcc", aliases=["dx"], category=cmn.cat.lookup)
|
||||||
async def _dxcc_lookup(self, ctx: commands.Context, query: str):
|
async def _dxcc_lookup(self, ctx: commands.Context, query: str):
|
||||||
"""Gets DXCC info about a callsign prefix."""
|
"""Gets DXCC info about a callsign prefix."""
|
||||||
with ctx.typing():
|
|
||||||
query = query.upper()
|
query = query.upper()
|
||||||
full_query = query
|
full_query = query
|
||||||
embed = cmn.embed_factory(ctx)
|
embed = cmn.embed_factory(ctx)
|
||||||
|
@ -21,7 +21,6 @@ class MorseCog(commands.Cog):
|
|||||||
@commands.command(name="morse", aliases=["cw"], category=cmn.cat.ref)
|
@commands.command(name="morse", aliases=["cw"], category=cmn.cat.ref)
|
||||||
async def _morse(self, ctx: commands.Context, *, msg: str):
|
async def _morse(self, ctx: commands.Context, *, msg: str):
|
||||||
"""Converts ASCII to international morse code."""
|
"""Converts ASCII to international morse code."""
|
||||||
with ctx.typing():
|
|
||||||
result = ""
|
result = ""
|
||||||
for char in msg.upper():
|
for char in msg.upper():
|
||||||
try:
|
try:
|
||||||
@ -38,7 +37,6 @@ class MorseCog(commands.Cog):
|
|||||||
@commands.command(name="unmorse", aliases=["demorse", "uncw", "decw"], category=cmn.cat.ref)
|
@commands.command(name="unmorse", aliases=["demorse", "uncw", "decw"], category=cmn.cat.ref)
|
||||||
async def _unmorse(self, ctx: commands.Context, *, msg: str):
|
async def _unmorse(self, ctx: commands.Context, *, msg: str):
|
||||||
"""Converts international morse code to ASCII."""
|
"""Converts international morse code to ASCII."""
|
||||||
with ctx.typing():
|
|
||||||
result = ""
|
result = ""
|
||||||
msg0 = msg
|
msg0 = msg
|
||||||
msg = msg.split("/")
|
msg = msg.split("/")
|
||||||
@ -60,7 +58,6 @@ class MorseCog(commands.Cog):
|
|||||||
async def _weight(self, ctx: commands.Context, *, msg: str):
|
async def _weight(self, ctx: commands.Context, *, msg: str):
|
||||||
"""Calculates the CW weight of a callsign or message."""
|
"""Calculates the CW weight of a callsign or message."""
|
||||||
embed = cmn.embed_factory(ctx)
|
embed = cmn.embed_factory(ctx)
|
||||||
with ctx.typing():
|
|
||||||
msg = msg.upper()
|
msg = msg.upper()
|
||||||
weight = 0
|
weight = 0
|
||||||
for char in msg:
|
for char in msg:
|
||||||
|
@ -36,6 +36,7 @@ class QRZCog(commands.Cog):
|
|||||||
await ctx.send(f"http://qrz.com/db/{callsign}")
|
await ctx.send(f"http://qrz.com/db/{callsign}")
|
||||||
return
|
return
|
||||||
|
|
||||||
|
async with ctx.typing():
|
||||||
try:
|
try:
|
||||||
await qrz_test_session(self.key, self.session)
|
await qrz_test_session(self.key, self.session)
|
||||||
except ConnectionError:
|
except ConnectionError:
|
||||||
|
Loading…
Reference in New Issue
Block a user