10 Commits

Author SHA1 Message Date
0x5c b17a8a1749 Merge pull request #207 from miaowware/bumpversion
Bump version + changelog (2.2.2)
2020-02-25 21:44:35 -05:00
0x5c 8dfa7001ef Bump version + changelog (2.2.2)
- CL: fixed missing 2.2.1 link
2020-02-25 21:41:36 -05:00
0x5c f6ed8430b9 Merge pull request #205 from miaowware/fix-typing
Added/fixed/removed typing managers
2020-02-25 20:57:07 -05:00
0x5c d650cbd6c1 Removed lint 2020-02-25 20:44:53 -05:00
0x5c 4d9f9d1b19 Added/fixed/removed typing managers
Fixes #167
2020-02-25 20:36:21 -05:00
0x5c 1c649aacc2 Merge pull request #204 from miaowware/fix-studyimg
Fix HamStudy image error
2020-02-25 19:51:03 -05:00
0x5c 2049ca9fca Fix HamStudy image error
- Fixed the image link
- Removed unused import (pytz)
- Added test pool file to dev-notes

Fixes #203
2020-02-25 19:45:32 -05:00
Abigail 38416d9050 whoopsie 2020-02-20 20:02:45 -05:00
Abigail G 8dcdc22fe4 Merge pull request #202 from miaowware/hamstudy-extra-fix
fix offset-naive and offset-aware datetime conflict
2020-02-20 20:02:07 -05:00
Abigail c57056e586 fix offset-naive and offset-aware datetime conflict
Fixes #201
2020-02-20 01:32:17 -05:00
10 changed files with 281 additions and 229 deletions
+14 -1
View File
@@ -7,6 +7,17 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## [Unreleased] ## [Unreleased]
## [2.2.2] - 2020-02-25
### 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
### Fixed
- Fixed issue where some HamStudy pools will become unselectable.
## [2.2.0] - 2020-02-15 ## [2.2.0] - 2020-02-15
### Added ### Added
- Added Trustee field to qrz command for club callsigns. - Added Trustee field to qrz command for club callsigns.
@@ -76,7 +87,9 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
## 1.0.0 - 2019-07-31 [YANKED] ## 1.0.0 - 2019-07-31 [YANKED]
[Unreleased]: https://github.com/miaowware/qrm2/compare/v2.2.0...HEAD [Unreleased]: https://github.com/miaowware/qrm2/compare/v2.2.2...HEAD
[2.2.2]: https://github.com/miaowware/qrm2/releases/tag/v2.2.2
[2.2.1]: https://github.com/miaowware/qrm2/releases/tag/v2.2.1
[2.2.0]: https://github.com/miaowware/qrm2/releases/tag/v2.2.0 [2.2.0]: https://github.com/miaowware/qrm2/releases/tag/v2.2.0
[2.1.0]: https://github.com/miaowware/qrm2/releases/tag/v2.1.0 [2.1.0]: https://github.com/miaowware/qrm2/releases/tag/v2.1.0
[2.0.0]: https://github.com/miaowware/qrm2/releases/tag/v2.0.0 [2.0.0]: https://github.com/miaowware/qrm2/releases/tag/v2.0.0
+48
View File
@@ -0,0 +1,48 @@
{
"_id": "56956f51f65e5c590272e372",
"appears": "2016-04-01T06:00:00.000Z",
"class": "Amateur Extra",
"subtext": "Expires Jul 1, 2020",
"valid_from": "2016-07-01T06:00:00.000Z",
"expires": "2020-07-01T06:00:00.000Z",
"official_name": "Element 4",
"id": "E4_2016",
"slug": "extra2016",
"passing": 37,
"year": 2016,
"pool": [{
"_id": "5cd63f15910d9b003d545bd7",
"qcount": 4,
"id": "E5",
"name": "ELECTRICAL PRINCIPLES",
"sections": [{
"_id": "5cd63f15910d9b003d545beb",
"id": "E5C",
"questions": [{
"_id": "5cd63f15910d9b003d545bef",
"keywords": ["4"],
"answer": "B",
"answers": {
"A": "Point 2",
"B": "Point 4",
"C": "Point 5",
"D": "Point 6"
},
"fccpart": "",
"id": "E5C14",
"image": "E5-2.png",
"text": "Which point on Figure E5-2 best represents the impedance of a series circuit consisting of a 400 ohm resistor and a 38 picofarad capacitor at 14 MHz?"
}],
"summary": "Coordinate systems and phasors in electronics: Rectangular Coordinates; Polar Coordinates; Phasors"
}]
}],
"updated": "2019-05-11T03:18:46.121Z",
"category": "default",
"testIdEnd": 19999,
"testIdStart": 10000,
"__v": 12,
"mat_icon": "flash_on",
"tagline": "Serious General operators only! This is the most advanced US license class!",
"keywords": ["ham radio extra test prep", "amateur extra class radio study", "amateur extra class ham exam", "ham radio amateur extra test 2016", "2016 amateur extra class", "ham radio license exam", "extra class flash card"],
"replaces": "E4_2012"
}
-1
View File
@@ -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():
-2
View File
@@ -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()
-3
View File
@@ -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)
-1
View File
@@ -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)
-3
View File
@@ -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:
+1
View File
@@ -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:
+3 -3
View File
@@ -88,8 +88,8 @@ class StudyCog(commands.Cog):
else: else:
# look at valid_from and expires dates to find the correct one # look at valid_from and expires dates to find the correct one
for p in pool_matches: for p in pool_matches:
valid_from = datetime.fromisoformat(pools[p]["valid_from"][:-1] + "+00:00") valid_from = datetime.fromisoformat(pools[p]["valid_from"][:-1])
expires = datetime.fromisoformat(pools[p]["expires"][:-1] + "+00:00") expires = datetime.fromisoformat(pools[p]["expires"][:-1])
if valid_from < datetime.utcnow() < expires: if valid_from < datetime.utcnow() < expires:
pool = p pool = p
@@ -133,7 +133,7 @@ class StudyCog(commands.Cog):
" the answer will be revealed."), " the answer will be revealed."),
inline=False) inline=False)
if "image" in question: if "image" in question:
image_url = f"https://hamstudy.org/_1330011/images/{pool.split('_',1)[1]}/{question['image']}" image_url = f"https://hamstudy.org/images/{pool_meta['year']}/{question['image']}"
embed.set_image(url=image_url) embed.set_image(url=image_url)
q_msg = await ctx.send(embed=embed) q_msg = await ctx.send(embed=embed)
+1 -1
View File
@@ -12,5 +12,5 @@ authors = ("@ClassAbbyAmplifier#2229", "@0x5c#0639")
description = """A bot with various useful ham radio-related functions, written in Python.""" description = """A bot with various useful ham radio-related functions, written in Python."""
license = "Released under the GNU General Public License v2" license = "Released under the GNU General Public License v2"
contributing = "Check out the source on GitHub, contributions welcome: https://github.com/miaowware/qrm2" contributing = "Check out the source on GitHub, contributions welcome: https://github.com/miaowware/qrm2"
release = "2.2.0" release = "2.2.2"
bot_server = "https://discord.gg/Ntbg3J4" bot_server = "https://discord.gg/Ntbg3J4"