From af136c3d3e7447f667ce47040ddeab3f1070317f Mon Sep 17 00:00:00 2001 From: 0x5c Date: Sat, 15 Feb 2020 04:59:25 -0500 Subject: [PATCH] Cleaned up description of commands - Formatting and wording Element of #142 New year lint removal --- exts/ae7q.py | 12 ++++++------ exts/base.py | 8 ++++---- exts/fun.py | 6 +++--- exts/grid.py | 14 +++++++------- exts/ham.py | 8 ++++---- exts/image.py | 6 +++--- exts/lookup.py | 2 +- exts/morse.py | 2 +- exts/qrz.py | 2 +- exts/weather.py | 31 ++++++++++++++++--------------- main.py | 5 ++++- 11 files changed, 50 insertions(+), 46 deletions(-) diff --git a/exts/ae7q.py b/exts/ae7q.py index 3b1b679..0fb4e08 100644 --- a/exts/ae7q.py +++ b/exts/ae7q.py @@ -31,13 +31,13 @@ class AE7QCog(commands.Cog): @commands.group(name="ae7q", aliases=["ae"], category=cmn.cat.lookup) async def _ae7q_lookup(self, ctx: commands.Context): - """Look up a callsign, FRN, or Licensee ID on [ae7q.com](http://ae7q.com/).""" + """Looks up a callsign, FRN, or Licensee ID on [ae7q.com](http://ae7q.com/).""" if ctx.invoked_subcommand is None: await ctx.send_help(ctx.command) @_ae7q_lookup.command(name="call", aliases=["c"], category=cmn.cat.lookup) async def _ae7q_call(self, ctx: commands.Context, callsign: str): - """Look up the history of a callsign on [ae7q.com](http://ae7q.com/).""" + """Looks up the history of a callsign on [ae7q.com](http://ae7q.com/).""" with ctx.typing(): callsign = callsign.upper() desc = "" @@ -103,7 +103,7 @@ class AE7QCog(commands.Cog): @_ae7q_lookup.command(name="trustee", aliases=["t"], category=cmn.cat.lookup) async def _ae7q_trustee(self, ctx: commands.Context, callsign: str): - """Look up the licenses for which a licensee is trustee on [ae7q.com](http://ae7q.com/).""" + """Looks up the licenses for which a licensee is trustee on [ae7q.com](http://ae7q.com/).""" with ctx.typing(): callsign = callsign.upper() desc = "" @@ -170,7 +170,7 @@ class AE7QCog(commands.Cog): @_ae7q_lookup.command(name="applications", aliases=["a"], category=cmn.cat.lookup) async def _ae7q_applications(self, ctx: commands.Context, callsign: str): - """Look up the application history for a callsign on [ae7q.com](http://ae7q.com/).""" + """Looks up the application history for a callsign on [ae7q.com](http://ae7q.com/).""" """ with ctx.typing(): callsign = callsign.upper() @@ -240,7 +240,7 @@ class AE7QCog(commands.Cog): @_ae7q_lookup.command(name="frn", aliases=["f"], category=cmn.cat.lookup) async def _ae7q_frn(self, ctx: commands.Context, frn: str): - """Look up the history of an FRN on [ae7q.com](http://ae7q.com/).""" + """Looks up the history of an FRN on [ae7q.com](http://ae7q.com/).""" """ NOTES: - 2 tables: callsign history and application history @@ -307,7 +307,7 @@ class AE7QCog(commands.Cog): @_ae7q_lookup.command(name="licensee", aliases=["l"], category=cmn.cat.lookup) async def _ae7q_licensee(self, ctx: commands.Context, licensee_id: str): - """Look up the history of a licensee ID on [ae7q.com](http://ae7q.com/).""" + """Looks up the history of a licensee ID on [ae7q.com](http://ae7q.com/).""" with ctx.typing(): licensee_id = licensee_id.upper() base_url = "http://ae7q.com/query/data/LicenseeIdHistory.php?ID=" diff --git a/exts/base.py b/exts/base.py index ed0ba5a..e3739d7 100644 --- a/exts/base.py +++ b/exts/base.py @@ -120,7 +120,7 @@ class BaseCog(commands.Cog): @commands.command(name="ping", aliases=["beep"]) async def _ping(self, ctx: commands.Context): - """Show the current latency to the discord endpoint.""" + """Shows the current latency to the discord endpoint.""" embed = cmn.embed_factory(ctx) content = "" if ctx.invoked_with == "beep": @@ -133,7 +133,7 @@ class BaseCog(commands.Cog): @commands.command(name="changelog", aliases=["clog"]) async def _changelog(self, ctx: commands.Context, version: str = "latest"): - """Show what has changed in a bot version.""" + """Shows what has changed in a bot version. Defaults to the latest version.""" embed = cmn.embed_factory(ctx) embed.title = "qrm Changelog" embed.description = ("For a full listing, visit [Github](https://" @@ -169,7 +169,7 @@ class BaseCog(commands.Cog): @commands.command(name="issue") async def _issue(self, ctx: commands.Context): - """Shows how to create an issue for the bot.""" + """Shows how to create a bug report or feature request about the bot.""" embed = cmn.embed_factory(ctx) embed.title = "Found a bug? Have a feature request?" embed.description = ("Submit an issue on the [issue tracker]" @@ -180,7 +180,7 @@ class BaseCog(commands.Cog): @commands.check(cmn.check_if_owner) async def _echo(self, ctx: commands.Context, channel: Union[cmn.GlobalChannelConverter, commands.UserConverter], *, msg: str): - """Send a message in a channel as qrm. Accepts channel/user IDs/mentions. + """Sends a message in a channel as qrm. Accepts channel/user IDs/mentions. Channel names are current-guild only. Does not work with the ID of the bot user.""" if isinstance(channel, discord.ClientUser): diff --git a/exts/fun.py b/exts/fun.py index e6890d6..90392c7 100644 --- a/exts/fun.py +++ b/exts/fun.py @@ -23,12 +23,12 @@ class FunCog(commands.Cog): @commands.command(name="xkcd", aliases=["x"], category=cmn.cat.fun) async def _xkcd(self, ctx: commands.Context, number: str): - """Look up an xkcd by number.""" + """Looks up an xkcd comic by number.""" await ctx.send("http://xkcd.com/" + number) @commands.command(name="tar", category=cmn.cat.fun) async def _tar(self, ctx: commands.Context): - """Returns an xkcd about tar.""" + """Returns xkcd: tar.""" await ctx.send("http://xkcd.com/1168") @commands.command(name="xd", hidden=True, category=cmn.cat.fun) @@ -38,7 +38,7 @@ class FunCog(commands.Cog): @commands.command(name="funetics", aliases=["fun"], category=cmn.cat.fun) async def _funetics_lookup(self, ctx: commands.Context, *, msg: str): - """Get fun phonetics for a word or phrase.""" + """Generates fun/wacky phonetics for a word or phrase.""" with ctx.typing(): result = "" for char in msg.lower(): diff --git a/exts/grid.py b/exts/grid.py index 6694109..d634000 100644 --- a/exts/grid.py +++ b/exts/grid.py @@ -21,8 +21,8 @@ class GridCog(commands.Cog): @commands.command(name="grid", category=cmn.cat.maps) 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.""" + ("""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 @@ -42,17 +42,17 @@ with negative being latitude South and longitude West.""" else: embed = cmn.embed_factory(ctx) embed.title = f"Error generating grid square for {lat}, {lon}." - embed.description = ("Coordinates out of range.\n" - "The valid ranges are:\n" - "- Latitude: `-90` to `+90`\n" - "- Longitude: `-180` to `+180`") + embed.description = """Coordinates out of range. + The valid ranges are: + - Latitude: `-90` to `+90` + - Longitude: `-180` to `+180`""" embed.colour = cmn.colours.bad await ctx.send(embed=embed) @commands.command(name="ungrid", aliases=["loc"], category=cmn.cat.maps) 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.""" + If two grid squares are given, the distance and azimuth between them is calculated.""" with ctx.typing(): if grid2 is None or grid2 == "": try: diff --git a/exts/ham.py b/exts/ham.py index 88e31c9..048a7ab 100644 --- a/exts/ham.py +++ b/exts/ham.py @@ -24,7 +24,7 @@ class HamCog(commands.Cog): @commands.command(name="qcode", aliases=["q"], category=cmn.cat.ref) async def _qcode_lookup(self, ctx: commands.Context, qcode: str): - """Look up a Q Code.""" + """Looks up the meaning of a Q Code.""" with ctx.typing(): qcode = qcode.upper() embed = cmn.embed_factory(ctx) @@ -39,7 +39,7 @@ 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): - """Get phonetics for a word or phrase.""" + """Returns NATO phonetics for a word or phrase.""" with ctx.typing(): result = "" for char in msg.lower(): @@ -56,7 +56,7 @@ class HamCog(commands.Cog): @commands.command(name="utc", aliases=["z"], category=cmn.cat.ref) async def _utc_lookup(self, ctx: commands.Context): - """Gets the current time in UTC.""" + """Returns the current time in UTC.""" with ctx.typing(): now = datetime.utcnow() result = "**" + now.strftime("%Y-%m-%d %H:%M") + "Z**" @@ -68,7 +68,7 @@ class HamCog(commands.Cog): @commands.command(name="prefixes", aliases=["vanity", "pfx", "vanities", "prefix"], category=cmn.cat.ref) async def _vanity_prefixes(self, ctx: commands.Context, country: str = None): - """Lists valid prefixes for countries.""" + """Lists valid callsign prefixes for different countries.""" if country is None: await ctx.send_help(ctx.command) return diff --git a/exts/image.py b/exts/image.py index 2f818ea..66edbfc 100644 --- a/exts/image.py +++ b/exts/image.py @@ -30,7 +30,7 @@ class ImageCog(commands.Cog): @commands.command(name="bandplan", aliases=["plan", "bands"], category=cmn.cat.ref) async def _bandplan(self, ctx: commands.Context, region: str = ""): - """Posts an image of Frequency Allocations.""" + """Gets the frequency allocations chart for a given country.""" async with ctx.typing(): arg = region.lower() embed = cmn.embed_factory(ctx) @@ -57,7 +57,7 @@ class ImageCog(commands.Cog): @commands.command(name="map", category=cmn.cat.maps) async def _map(self, ctx: commands.Context, map_id: str = ""): - """Posts an image of a ham-relevant map.""" + """Posts a ham-relevant map.""" async with ctx.typing(): arg = map_id.lower() embed = cmn.embed_factory(ctx) @@ -84,7 +84,7 @@ class ImageCog(commands.Cog): @commands.command(name="grayline", aliases=["greyline", "grey", "gray", "gl"], category=cmn.cat.maps) async def _grayline(self, ctx: commands.Context): - """Posts a map of the current greyline, where HF propagation is the best.""" + """Gets a map of the current greyline, where HF propagation is the best.""" async with ctx.typing(): embed = cmn.embed_factory(ctx) embed.title = "Current Greyline Conditions" diff --git a/exts/lookup.py b/exts/lookup.py index b79604b..c5eba9e 100644 --- a/exts/lookup.py +++ b/exts/lookup.py @@ -39,7 +39,7 @@ 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 info about a DXCC prefix.""" + """Gets DXCC info about a callsign prefix.""" with ctx.typing(): query = query.upper() full_query = query diff --git a/exts/morse.py b/exts/morse.py index 03dc0d3..6a37e49 100644 --- a/exts/morse.py +++ b/exts/morse.py @@ -58,7 +58,7 @@ class MorseCog(commands.Cog): @commands.command(name="cwweight", aliases=["weight", "cww"], category=cmn.cat.ref) 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) with ctx.typing(): msg = msg.upper() diff --git a/exts/qrz.py b/exts/qrz.py index 2828791..7b8fdf4 100644 --- a/exts/qrz.py +++ b/exts/qrz.py @@ -29,7 +29,7 @@ class QRZCog(commands.Cog): @commands.command(name="call", aliases=["qrz"], category=cmn.cat.lookup) async def _qrz_lookup(self, ctx: commands.Context, callsign: str, *flags): - """Look up a callsign on [QRZ.com](https://www.qrz.com/). Add `--link` to only link the QRZ page.""" + """Looks up a callsign on [QRZ.com](https://www.qrz.com/). Add `--link` to only link the QRZ page.""" flags = [f.lower() for f in flags] if keys.qrz_user == "" or keys.qrz_pass == "" or "--link" in flags: diff --git a/exts/weather.py b/exts/weather.py index 78563e1..b8876d5 100644 --- a/exts/weather.py +++ b/exts/weather.py @@ -28,7 +28,7 @@ class WeatherCog(commands.Cog): @commands.command(name="bandconditions", aliases=["cond", "condx", "conditions"], category=cmn.cat.weather) async def _band_conditions(self, ctx: commands.Context): - """Posts an image of HF Band Conditions.""" + """Gets a solar conditions report.""" async with ctx.typing(): embed = cmn.embed_factory(ctx) embed.title = "Current Solar Conditions" @@ -42,24 +42,25 @@ class WeatherCog(commands.Cog): @commands.group(name="weather", aliases=["wttr"], category=cmn.cat.weather) async def _weather_conditions(self, ctx: commands.Context): - """Posts an image of Local Weather Conditions from [wttr.in](http://wttr.in/). + """Gets local weather conditions from [wttr.in](http://wttr.in/). -*Supported location types:* - city name: `paris` - any location: `~Eiffel Tower` - Unicode name of any location in any language: `Москва` - airport code (3 letters): `muc` - domain name `@stackoverflow.com` - area codes: `12345` - GPS coordinates: `-78.46,106.79` - """ + *Supported location types:* + city name: `paris` + any location: `~Eiffel Tower` + Unicode name of any location in any language: `Москва` + airport code (3 letters): `muc` + domain name `@stackoverflow.com` + area codes: `12345` + GPS coordinates: `-78.46,106.79` + + Add a `-c` or `-f` to use Celcius or Fahrenheit: `-c YSC`""" if ctx.invoked_subcommand is None: await ctx.send_help(ctx.command) @_weather_conditions.command(name="forecast", aliases=["fc", "future"], category=cmn.cat.weather) async def _weather_conditions_forecast(self, ctx: commands.Context, *, location: str): - """Posts an image of Local Weather Conditions for the next three days from [wttr.in](http://wttr.in/). -See help for weather command for possible location types. Add a `-c` or `-f` to use Celcius or Fahrenheit.""" + """Gets local weather forecast for the next three days from [wttr.in](http://wttr.in/). + See help of the `weather` command for possible location types and options.""" async with ctx.typing(): try: units_arg = re.search(self.wttr_units_regex, location).group(1) @@ -89,8 +90,8 @@ See help for weather command for possible location types. Add a `-c` or `-f` to @_weather_conditions.command(name="now", aliases=["n"], category=cmn.cat.weather) async def _weather_conditions_now(self, ctx: commands.Context, *, location: str): - """Posts an image of current Local Weather Conditions from [wttr.in](http://wttr.in/). -See help for weather command for possible location types. Add a `-c` or `-f` to use Celcius or Fahrenheit.""" + """Gets current local weather conditions from [wttr.in](http://wttr.in/). + See help of the `weather` command for possible location types and options.""" async with ctx.typing(): try: units_arg = re.search(self.wttr_units_regex, location).group(1) diff --git a/main.py b/main.py index 745d7e6..504cecc 100644 --- a/main.py +++ b/main.py @@ -94,7 +94,7 @@ async def _extctl(ctx: commands.Context): @_extctl.command(name="list", aliases=["ls"]) async def _extctl_list(ctx: commands.Context): - """Lists Extensions.""" + """Lists loaded extensions.""" embed = cmn.embed_factory(ctx) embed.title = "Loaded Extensions" embed.description = "\n".join(["‣ " + x.split(".")[1] for x in bot.extensions.keys()]) @@ -103,12 +103,14 @@ async def _extctl_list(ctx: commands.Context): @_extctl.command(name="load", aliases=["ld"]) async def _extctl_load(ctx: commands.Context, extension: str): + """Loads an extension.""" bot.load_extension(ext_dir + "." + extension) await cmn.add_react(ctx.message, cmn.emojis.check_mark) @_extctl.command(name="reload", aliases=["rl", "r", "relaod"]) async def _extctl_reload(ctx: commands.Context, extension: str): + """Reloads an extension.""" if ctx.invoked_with == "relaod": pika = bot.get_emoji(opt.pika) if pika: @@ -119,6 +121,7 @@ async def _extctl_reload(ctx: commands.Context, extension: str): @_extctl.command(name="unload", aliases=["ul"]) async def _extctl_unload(ctx: commands.Context, extension: str): + """Unloads an extension.""" bot.unload_extension(ext_dir + "." + extension) await cmn.add_react(ctx.message, cmn.emojis.check_mark)