From e29425b264c8edfe6c18dad7e60061768f2f6e1e Mon Sep 17 00:00:00 2001 From: Ben Armstrong Date: Sat, 14 Sep 2024 13:51:58 -0300 Subject: [PATCH 1/4] Add help with examples for top* commands. --- inatcog/commands/obs.py | 46 ++++++++++++++++++++++++++++++++++++++--- 1 file changed, 43 insertions(+), 3 deletions(-) diff --git a/inatcog/commands/obs.py b/inatcog/commands/obs.py index 57e0f2f..1fd0b3c 100644 --- a/inatcog/commands/obs.py +++ b/inatcog/commands/obs.py @@ -193,19 +193,59 @@ async def top(self, ctx, *, query: Optional[TaxonReplyConverter]): @top.command(name="identifiers", aliases=["id", "ids"]) @use_client async def top_identifiers(self, ctx, *, query: Optional[TaxonReplyConverter]): - """Top observations IDed per IDer (alias `[p]topids`).""" + """Top observations IDed per IDer (alias `[p]topids`). + + • Leaderboard of up to 500 top identifiers of observations matching the *query* terms not made by themselves. + • Species counts shown in parentheses are per community taxon of the observations, *not* per taxon of the IDer's identifications. + • See `[p]query` and `[p]taxon_query` for help with *query* terms. + + e.g. + ``` + [p]topids bees + -> Top identifiers by number of bee observations they identified for others + [p]topids in prj arthropod ecology + -> Top identifiers by number of observations they identified for others in the Arthropod Ecology in Action project + [p]topids arthropods from nova scotia + -> Top identifiers by number of arthropod observations they identified for others from Nova Scotia + """ # noqa: E501 await self._tabulate_query(ctx, query, view="ids") @top.command(name="observers", aliases=["obs"]) @use_client async def top_observers(self, ctx, *, query: Optional[TaxonReplyConverter]): - """Top observations per observer (alias `[p]topobs`).""" + """Top observations per observer (alias `[p]topobs`). + + • Leaderboard of up to 500 top observers by observation count matching the *query* terms. + • See `[p]query` and `[p]taxon_query` for help with *query* terms. + + e.g. + ``` + [p]topobs bees + -> Top observers by observation count of bees + [p]topobs in prj arthropod ecology + -> Top observers by observation count of observations in the Arthropod Ecology in Action project + [p]topobs arthropods from nova scotia + -> Top observers by observation count of arthropods from Nova Scotia + """ # noqa: E501 await self._tabulate_query(ctx, query) @top.command(name="species", aliases=["spp", "sp"]) @use_client async def top_species(self, ctx, *, query: Optional[TaxonReplyConverter]): - """Top species per observer (alias `[p]topspp`).""" + """Top species per observer (alias `[p]topspp`). + + • Leaderboard of up to 500 top observers by species count matching the *query* terms. + • See `[p]query` and `[p]taxon_query` for help with *query* terms. + + e.g. + ``` + [p]topspp bees + -> Top observers by species count of bees + [p]topspp in prj arthropod ecology + -> Top observers by species count of observations in the Arthropod Ecology in Action project + [p]topspp arthropods from nova scotia + -> Top observers by species count of arthropods from Nova Scotia + """ # noqa: E501 await self._tabulate_query(ctx, query, view="spp") @commands.group(invoke_without_command=True) From b17e6aba6b765752b28d949197aca8a991381717 Mon Sep 17 00:00:00 2001 From: Ben Armstrong Date: Sat, 14 Sep 2024 14:05:14 -0300 Subject: [PATCH 2/4] top* cmd help formatting fixes. --- inatcog/commands/obs.py | 38 ++++++++++++++++++-------------------- 1 file changed, 18 insertions(+), 20 deletions(-) diff --git a/inatcog/commands/obs.py b/inatcog/commands/obs.py index 1fd0b3c..37c716b 100644 --- a/inatcog/commands/obs.py +++ b/inatcog/commands/obs.py @@ -200,13 +200,13 @@ async def top_identifiers(self, ctx, *, query: Optional[TaxonReplyConverter]): • See `[p]query` and `[p]taxon_query` for help with *query* terms. e.g. + `[p]topids bees` + → Top identifiers by number of bee observations they identified for others + `[p]topids in prj arthropod ecology` + → Top identifiers by number of observations they identified for others in the Arthropod Ecology in Action project + `[p]topids arthropods from nova scotia` + → Top identifiers by number of arthropod observations they identified for others from Nova Scotia ``` - [p]topids bees - -> Top identifiers by number of bee observations they identified for others - [p]topids in prj arthropod ecology - -> Top identifiers by number of observations they identified for others in the Arthropod Ecology in Action project - [p]topids arthropods from nova scotia - -> Top identifiers by number of arthropod observations they identified for others from Nova Scotia """ # noqa: E501 await self._tabulate_query(ctx, query, view="ids") @@ -219,13 +219,12 @@ async def top_observers(self, ctx, *, query: Optional[TaxonReplyConverter]): • See `[p]query` and `[p]taxon_query` for help with *query* terms. e.g. - ``` - [p]topobs bees - -> Top observers by observation count of bees - [p]topobs in prj arthropod ecology - -> Top observers by observation count of observations in the Arthropod Ecology in Action project - [p]topobs arthropods from nova scotia - -> Top observers by observation count of arthropods from Nova Scotia + `[p]topobs bees` + → Top observers of bees + `[p]topobs in prj arthropod ecology` + → Top observers in the Arthropod Ecology in Action project + `[p]topobs arthropods from nova scotia` + → Top observers of arthropods from Nova Scotia """ # noqa: E501 await self._tabulate_query(ctx, query) @@ -238,13 +237,12 @@ async def top_species(self, ctx, *, query: Optional[TaxonReplyConverter]): • See `[p]query` and `[p]taxon_query` for help with *query* terms. e.g. - ``` - [p]topspp bees - -> Top observers by species count of bees - [p]topspp in prj arthropod ecology - -> Top observers by species count of observations in the Arthropod Ecology in Action project - [p]topspp arthropods from nova scotia - -> Top observers by species count of arthropods from Nova Scotia + `[p]topspp bees` + → Top observers by spp of bees + `[p]topspp in prj arthropod ecology` + → Top observers by spp in Arthropod Ecology in Action project + `[p]topspp arthropods from nova scotia` + → Top observers by spp of arthropods from NS """ # noqa: E501 await self._tabulate_query(ctx, query, view="spp") From 70011bd5f4d2c5b7464d0f5fb54cde5a84f49b4c Mon Sep 17 00:00:00 2001 From: Ben Armstrong Date: Sat, 14 Sep 2024 14:08:23 -0300 Subject: [PATCH 3/4] Correctly label top aliases to make help easier to find. --- inatcog/commands/obs.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/inatcog/commands/obs.py b/inatcog/commands/obs.py index 37c716b..7886e8b 100644 --- a/inatcog/commands/obs.py +++ b/inatcog/commands/obs.py @@ -501,13 +501,13 @@ def format_pages(user_links, users_count, entity_counted, view): async def tabulate_top_identifiers( self, ctx, *, query: Optional[TaxonReplyConverter] ): - """Top observations IDed per IDer (alias `[p]topids`).""" + """Top observations IDed per IDer (alias for `[p]top ids`).""" await self._tabulate_query(ctx, query, view="ids") @commands.command(name="topids", hidden=True) @use_client async def top_identifiers_alias(self, ctx, *, query: Optional[TaxonReplyConverter]): - """Top observations IDed per IDer (alias `[p]tab topids`).""" + """Top observations IDed per IDer (alias for `[p]top ids`).""" await self._tabulate_query(ctx, query, view="ids") @tabulate.command(name="topobs") @@ -515,25 +515,25 @@ async def top_identifiers_alias(self, ctx, *, query: Optional[TaxonReplyConverte async def tabulate_top_observers( self, ctx, *, query: Optional[TaxonReplyConverter] ): - """Top observations per observer (alias `[p]topobs`).""" + """Top observations per observer (alias for `[p]top obs`).""" await self._tabulate_query(ctx, query) @commands.command(name="topobs", hidden=True) @use_client async def top_observers_alias(self, ctx, *, query: Optional[TaxonReplyConverter]): - """Top observations per observer (alias `[p]tab topobs`).""" + """Top observations per observer (alias for `[p]top obs`).""" await self._tabulate_query(ctx, query) @tabulate.command(name="topspp", alias=["topsp"]) @use_client async def tabulate_top_species(self, ctx, *, query: Optional[TaxonReplyConverter]): - """Top species per observer (alias `[p]topspp`).""" + """Top species per observer (alias for `[p]top spp`).""" await self._tabulate_query(ctx, query, view="spp") @commands.command(name="topspp", alias=["topsp"], hidden=True) @use_client async def top_species_alias(self, ctx, *, query: Optional[TaxonReplyConverter]): - """Top species per observer (alias `[p]tab topspp`).""" + """Top species per observer (alias for `[p]top spp`).""" await self._tabulate_query(ctx, query, view="spp") @commands.hybrid_command() From fd912c52a73fd97208710c4fff0f72f0fd79f2ec Mon Sep 17 00:00:00 2001 From: Ben Armstrong Date: Sat, 14 Sep 2024 15:27:43 -0300 Subject: [PATCH 4/4] Remove hidden redundant tab top aliases. --- inatcog/commands/obs.py | 22 ---------------------- 1 file changed, 22 deletions(-) diff --git a/inatcog/commands/obs.py b/inatcog/commands/obs.py index 7886e8b..6b82673 100644 --- a/inatcog/commands/obs.py +++ b/inatcog/commands/obs.py @@ -496,40 +496,18 @@ def format_pages(user_links, users_count, entity_counted, view): else: await ctx.send(embed=embeds[0]) - @tabulate.command(name="topids") - @use_client - async def tabulate_top_identifiers( - self, ctx, *, query: Optional[TaxonReplyConverter] - ): - """Top observations IDed per IDer (alias for `[p]top ids`).""" - await self._tabulate_query(ctx, query, view="ids") - @commands.command(name="topids", hidden=True) @use_client async def top_identifiers_alias(self, ctx, *, query: Optional[TaxonReplyConverter]): """Top observations IDed per IDer (alias for `[p]top ids`).""" await self._tabulate_query(ctx, query, view="ids") - @tabulate.command(name="topobs") - @use_client - async def tabulate_top_observers( - self, ctx, *, query: Optional[TaxonReplyConverter] - ): - """Top observations per observer (alias for `[p]top obs`).""" - await self._tabulate_query(ctx, query) - @commands.command(name="topobs", hidden=True) @use_client async def top_observers_alias(self, ctx, *, query: Optional[TaxonReplyConverter]): """Top observations per observer (alias for `[p]top obs`).""" await self._tabulate_query(ctx, query) - @tabulate.command(name="topspp", alias=["topsp"]) - @use_client - async def tabulate_top_species(self, ctx, *, query: Optional[TaxonReplyConverter]): - """Top species per observer (alias for `[p]top spp`).""" - await self._tabulate_query(ctx, query, view="spp") - @commands.command(name="topspp", alias=["topsp"], hidden=True) @use_client async def top_species_alias(self, ctx, *, query: Optional[TaxonReplyConverter]):