dronefly-discord 0.2.2__tar.gz → 0.2.4.dev1__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {dronefly_discord-0.2.2 → dronefly_discord-0.2.4.dev1}/PKG-INFO +3 -2
- dronefly_discord-0.2.4.dev1/dronefly/discord/constants.py +1 -0
- {dronefly_discord-0.2.2 → dronefly_discord-0.2.4.dev1}/dronefly/discord/menus.py +162 -67
- {dronefly_discord-0.2.2 → dronefly_discord-0.2.4.dev1}/pyproject.toml +7 -7
- {dronefly_discord-0.2.2 → dronefly_discord-0.2.4.dev1}/README.md +0 -0
- {dronefly_discord-0.2.2 → dronefly_discord-0.2.4.dev1}/dronefly/discord/__init__.py +0 -0
- {dronefly_discord-0.2.2 → dronefly_discord-0.2.4.dev1}/dronefly/discord/commands.py +0 -0
- {dronefly_discord-0.2.2 → dronefly_discord-0.2.4.dev1}/dronefly/discord/embeds.py +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.4
|
|
2
2
|
Name: dronefly-discord
|
|
3
|
-
Version: 0.2.
|
|
3
|
+
Version: 0.2.4.dev1
|
|
4
4
|
Summary: Dronefly Discord library
|
|
5
5
|
Author: Ben Armstrong
|
|
6
6
|
Author-email: Ben Armstrong <synrg@debian.org>
|
|
@@ -9,7 +9,8 @@ Classifier: Programming Language :: Python :: 3
|
|
|
9
9
|
Classifier: Programming Language :: Python :: 3.11
|
|
10
10
|
Requires-Dist: inflect>=5.3.0,<6
|
|
11
11
|
Requires-Dist: discord-py>=2.3.1
|
|
12
|
-
Requires-Dist:
|
|
12
|
+
Requires-Dist: pyinaturalist>=1.0.0.dev2
|
|
13
|
+
Requires-Dist: dronefly-core==0.5.4.dev1
|
|
13
14
|
Requires-Python: >=3.11, <3.12
|
|
14
15
|
Description-Content-Type: text/markdown
|
|
15
16
|
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
PROTECT_WHITESPACE = "\N{ZERO WIDTH SPACE}"
|
|
@@ -1,11 +1,17 @@
|
|
|
1
|
+
from copy import copy
|
|
1
2
|
import logging
|
|
2
3
|
from math import floor
|
|
3
|
-
|
|
4
|
+
import re
|
|
5
|
+
from typing import Any, Awaitable, Callable, Optional, Union
|
|
4
6
|
|
|
5
7
|
import discord
|
|
6
8
|
from discord.ext import commands
|
|
7
9
|
from dronefly.core.clients.inat import iNatClient
|
|
8
|
-
from dronefly.core.formatters import
|
|
10
|
+
from dronefly.core.formatters import (
|
|
11
|
+
ObservationFormatter,
|
|
12
|
+
ObservationSearchFormatter,
|
|
13
|
+
TaxonListFormatter,
|
|
14
|
+
)
|
|
9
15
|
from dronefly.core.menus import (
|
|
10
16
|
CountMenu as CoreCountMenu,
|
|
11
17
|
CountSource as CoreCountSource,
|
|
@@ -21,6 +27,7 @@ from requests import HTTPError
|
|
|
21
27
|
|
|
22
28
|
from .embeds import make_count_embed, make_embed, make_image_embed, make_taxa_embed
|
|
23
29
|
from .commands import InteractionContext
|
|
30
|
+
from .constants import PROTECT_WHITESPACE
|
|
24
31
|
|
|
25
32
|
logger = logging.getLogger(__name__)
|
|
26
33
|
|
|
@@ -34,14 +41,26 @@ class ObservationSearchSource(CoreObservationSearchSource):
|
|
|
34
41
|
):
|
|
35
42
|
formatter = self._observation_search_formatter
|
|
36
43
|
query_response = self.query_response
|
|
44
|
+
embeds = []
|
|
37
45
|
embed = make_embed(
|
|
38
46
|
title=f"{self.formatter.short_description} {query_response.obs_query_description()}"
|
|
39
47
|
)
|
|
40
48
|
if self._url:
|
|
41
49
|
embed.url = self._url
|
|
42
|
-
embed.description = formatter.format_page(
|
|
43
|
-
|
|
44
|
-
|
|
50
|
+
embed.description = PROTECT_WHITESPACE + formatter.format_page(
|
|
51
|
+
page, page_number, selected
|
|
52
|
+
)
|
|
53
|
+
footer = f"Page {page_number + 1}/{self.get_max_pages()}"
|
|
54
|
+
if self.count < self.total:
|
|
55
|
+
footer = f"{footer} (first {self.count} of {self.total} matches)"
|
|
56
|
+
embed.set_footer(text=footer)
|
|
57
|
+
for i, obs in enumerate(page):
|
|
58
|
+
# add image embeds for all images:
|
|
59
|
+
if i > 0:
|
|
60
|
+
embed = discord.Embed(url=self._url)
|
|
61
|
+
embed.set_image(url=obs.default_photo.original_url)
|
|
62
|
+
embeds.append(embed)
|
|
63
|
+
return embeds
|
|
45
64
|
|
|
46
65
|
|
|
47
66
|
class TaxonListSource(CoreTaxonListSource):
|
|
@@ -68,7 +87,7 @@ class StopButton(discord.ui.Button):
|
|
|
68
87
|
):
|
|
69
88
|
super().__init__(style=style, row=row)
|
|
70
89
|
self.style = style
|
|
71
|
-
self.emoji = "\N{
|
|
90
|
+
self.emoji = "\N{CROSS MARK}"
|
|
72
91
|
|
|
73
92
|
async def callback(self, interaction: discord.Interaction):
|
|
74
93
|
self.view.stop()
|
|
@@ -226,7 +245,7 @@ class LeafButton(discord.ui.Button):
|
|
|
226
245
|
await view.update_source(interaction, per_rank=_per_rank)
|
|
227
246
|
|
|
228
247
|
|
|
229
|
-
class
|
|
248
|
+
class DirectButton(discord.ui.Button):
|
|
230
249
|
def __init__(
|
|
231
250
|
self,
|
|
232
251
|
style: discord.ButtonStyle,
|
|
@@ -234,13 +253,15 @@ class RootButton(discord.ui.Button):
|
|
|
234
253
|
):
|
|
235
254
|
super().__init__(style=style, row=row)
|
|
236
255
|
self.style = style
|
|
237
|
-
self.emoji = "\N{
|
|
256
|
+
self.emoji = "\N{REGIONAL INDICATOR SYMBOL LETTER D}"
|
|
238
257
|
|
|
239
258
|
async def callback(self, interaction: discord.Interaction):
|
|
240
|
-
|
|
259
|
+
view = self.view
|
|
260
|
+
formatter = view.source._taxon_list_formatter
|
|
261
|
+
await view.update_source(interaction, with_direct=not formatter.with_direct)
|
|
241
262
|
|
|
242
263
|
|
|
243
|
-
class
|
|
264
|
+
class CommonButton(discord.ui.Button):
|
|
244
265
|
def __init__(
|
|
245
266
|
self,
|
|
246
267
|
style: discord.ButtonStyle,
|
|
@@ -248,15 +269,15 @@ class DirectButton(discord.ui.Button):
|
|
|
248
269
|
):
|
|
249
270
|
super().__init__(style=style, row=row)
|
|
250
271
|
self.style = style
|
|
251
|
-
self.emoji = "\N{REGIONAL INDICATOR SYMBOL LETTER
|
|
272
|
+
self.emoji = "\N{REGIONAL INDICATOR SYMBOL LETTER C}"
|
|
252
273
|
|
|
253
274
|
async def callback(self, interaction: discord.Interaction):
|
|
254
275
|
view = self.view
|
|
255
276
|
formatter = view.source._taxon_list_formatter
|
|
256
|
-
await view.update_source(interaction,
|
|
277
|
+
await view.update_source(interaction, with_common=not formatter.with_common)
|
|
257
278
|
|
|
258
279
|
|
|
259
|
-
class
|
|
280
|
+
class ShowObservationButton(discord.ui.Button):
|
|
260
281
|
def __init__(
|
|
261
282
|
self,
|
|
262
283
|
style: discord.ButtonStyle,
|
|
@@ -264,23 +285,50 @@ class CommonButton(discord.ui.Button):
|
|
|
264
285
|
):
|
|
265
286
|
super().__init__(style=style, row=row)
|
|
266
287
|
self.style = style
|
|
267
|
-
self.emoji = "\N{
|
|
288
|
+
self.emoji = "\N{WHITE HEAVY CHECK MARK}"
|
|
268
289
|
|
|
269
290
|
async def callback(self, interaction: discord.Interaction):
|
|
270
291
|
view = self.view
|
|
271
|
-
|
|
272
|
-
|
|
292
|
+
observation = view.select_observation.observation()
|
|
293
|
+
if observation:
|
|
294
|
+
await interaction.response.defer()
|
|
295
|
+
ctx = copy(self.view.ctx)
|
|
296
|
+
ctx.interaction = interaction
|
|
297
|
+
await view.obs_command(ctx, query=str(observation.uri))
|
|
298
|
+
|
|
299
|
+
|
|
300
|
+
class ShowTaxonButton(discord.ui.Button):
|
|
301
|
+
def __init__(
|
|
302
|
+
self,
|
|
303
|
+
style: discord.ButtonStyle,
|
|
304
|
+
row: Optional[int],
|
|
305
|
+
):
|
|
306
|
+
super().__init__(style=style, row=row)
|
|
307
|
+
self.style = style
|
|
308
|
+
self.emoji = "\N{WHITE HEAVY CHECK MARK}"
|
|
309
|
+
|
|
310
|
+
async def callback(self, interaction: discord.Interaction):
|
|
311
|
+
view = self.view
|
|
312
|
+
taxon_command = view.ctx.bot.get_command("taxon")
|
|
313
|
+
taxon = view.select_taxon.taxon()
|
|
314
|
+
if taxon:
|
|
315
|
+
await interaction.response.defer()
|
|
316
|
+
ctx = copy(self.view.ctx)
|
|
317
|
+
ctx.interaction = interaction
|
|
318
|
+
await taxon_command(ctx, query=str(taxon.id))
|
|
273
319
|
|
|
274
320
|
|
|
275
321
|
class SelectObservationOption(discord.SelectOption):
|
|
276
322
|
def __init__(
|
|
277
323
|
self,
|
|
278
324
|
value: int,
|
|
279
|
-
|
|
325
|
+
label: str,
|
|
326
|
+
description: str,
|
|
280
327
|
default: int,
|
|
281
328
|
):
|
|
329
|
+
|
|
282
330
|
super().__init__(
|
|
283
|
-
label=
|
|
331
|
+
label=label, description=description, value=str(value), default=default
|
|
284
332
|
)
|
|
285
333
|
|
|
286
334
|
|
|
@@ -292,30 +340,47 @@ class SelectObservation(discord.ui.Select):
|
|
|
292
340
|
page: list[Observation] = [],
|
|
293
341
|
selected: Optional[int] = 0,
|
|
294
342
|
):
|
|
295
|
-
view.
|
|
343
|
+
view.selected = selected
|
|
296
344
|
self.observations = page
|
|
297
|
-
options = self._make_options(
|
|
345
|
+
options = self._make_options(view, page)
|
|
298
346
|
super().__init__(
|
|
299
347
|
min_values=1, max_values=1, placeholder=placeholder, options=options
|
|
300
348
|
)
|
|
301
349
|
|
|
302
350
|
async def callback(self, interaction: discord.Interaction):
|
|
303
|
-
self.view.
|
|
351
|
+
self.view.selected = int(self.values[0])
|
|
304
352
|
await self.view.update_source(interaction)
|
|
305
353
|
|
|
306
354
|
def observation(self):
|
|
307
|
-
return self.observations[
|
|
355
|
+
return self.observations[self.view.selected]
|
|
308
356
|
|
|
309
357
|
def update_options(self, page=list[Observation], selected: Optional[int] = 0):
|
|
310
|
-
self.view.
|
|
311
|
-
self.
|
|
312
|
-
self.options = self._make_options(
|
|
358
|
+
self.view.selected = selected
|
|
359
|
+
self.observations = page
|
|
360
|
+
self.options = self._make_options(self.view, page)
|
|
313
361
|
|
|
314
|
-
def _make_options(self,
|
|
362
|
+
def _make_options(self, view, observations):
|
|
315
363
|
options = []
|
|
316
|
-
for value, observation in enumerate(
|
|
364
|
+
for value, observation in enumerate(observations):
|
|
365
|
+
with_user = not view.source.query_response.user
|
|
366
|
+
obs_formatter = ObservationFormatter(
|
|
367
|
+
observation,
|
|
368
|
+
compact=True,
|
|
369
|
+
with_link=False,
|
|
370
|
+
with_description=False,
|
|
371
|
+
with_user=with_user,
|
|
372
|
+
)
|
|
373
|
+
label, description = obs_formatter.format_title_summary(
|
|
374
|
+
with_link=False, with_italics=False
|
|
375
|
+
)
|
|
376
|
+
# TODO: format select option directly rather than tearing it apart and
|
|
377
|
+
# reassemble with regex substitutions:
|
|
378
|
+
description = re.sub(r"\`\s+", " ", description, re.MULTILINE)
|
|
379
|
+
description = re.sub(r"^\s+\`", "", description, re.MULTILINE)
|
|
317
380
|
options.append(
|
|
318
|
-
SelectObservationOption(
|
|
381
|
+
SelectObservationOption(
|
|
382
|
+
value, label, description, default=(value == view.selected)
|
|
383
|
+
)
|
|
319
384
|
)
|
|
320
385
|
return options
|
|
321
386
|
|
|
@@ -663,6 +728,7 @@ class ObservationSearchMenu(DiscordBaseMenu, CoreObservationSearchMenu):
|
|
|
663
728
|
self,
|
|
664
729
|
source: ObservationSearchSource,
|
|
665
730
|
cog: commands.Cog,
|
|
731
|
+
obs_command: Callable[[commands.Context, Any], Awaitable[Any]] = None,
|
|
666
732
|
message: discord.Message = None,
|
|
667
733
|
**kwargs: Any,
|
|
668
734
|
) -> None:
|
|
@@ -678,25 +744,23 @@ class ObservationSearchMenu(DiscordBaseMenu, CoreObservationSearchMenu):
|
|
|
678
744
|
self.back_button = BackButton(discord.ButtonStyle.grey, 0)
|
|
679
745
|
self.first_item = FirstItemButton(discord.ButtonStyle.grey, 0)
|
|
680
746
|
self.last_item = LastItemButton(discord.ButtonStyle.grey, 0)
|
|
681
|
-
self.stop_button = StopButton(discord.ButtonStyle.
|
|
682
|
-
self.
|
|
683
|
-
self.
|
|
684
|
-
self.
|
|
685
|
-
self.add_item(self.forward_button)
|
|
686
|
-
self.add_item(self.last_item) # note: should be disabled until all pages read
|
|
747
|
+
self.stop_button = StopButton(discord.ButtonStyle.grey, 0)
|
|
748
|
+
self.show_obs_button = ShowObservationButton(discord.ButtonStyle.grey, 0)
|
|
749
|
+
self.obs_command = obs_command
|
|
750
|
+
self.select_observation = SelectObservation(view=self, page=[], selected=0)
|
|
687
751
|
|
|
688
752
|
async def start(self, ctx: commands.Context):
|
|
689
|
-
|
|
753
|
+
self.selected = 0
|
|
690
754
|
self.ctx = ctx
|
|
691
755
|
self.bot = self.cog.bot
|
|
692
756
|
self.author = ctx.author
|
|
693
757
|
# await self.source._prepare_once()
|
|
694
|
-
|
|
758
|
+
return await self.send_initial_message(ctx)
|
|
695
759
|
|
|
696
760
|
async def _get_kwargs_from_page(self, page):
|
|
697
761
|
selected = None
|
|
698
762
|
if isinstance(self.source, ObservationSearchSource):
|
|
699
|
-
selected = self.
|
|
763
|
+
selected = self.selected
|
|
700
764
|
value = await discord.utils.maybe_coroutine(
|
|
701
765
|
self.source.format_page, page, self.current_page, selected
|
|
702
766
|
)
|
|
@@ -704,9 +768,23 @@ class ObservationSearchMenu(DiscordBaseMenu, CoreObservationSearchMenu):
|
|
|
704
768
|
return value
|
|
705
769
|
elif isinstance(value, str):
|
|
706
770
|
return {"content": value, "embed": None}
|
|
771
|
+
elif isinstance(value, list):
|
|
772
|
+
return {"embeds": value, "content": None}
|
|
707
773
|
elif isinstance(value, discord.Embed):
|
|
708
774
|
return {"embed": value, "content": None}
|
|
709
775
|
|
|
776
|
+
async def get_page(self, page_number):
|
|
777
|
+
_page_number = page_number
|
|
778
|
+
try:
|
|
779
|
+
page = await self.source.get_page(page_number)
|
|
780
|
+
except StopAsyncIteration:
|
|
781
|
+
# Back up and read the last page instead of the
|
|
782
|
+
# requested page:
|
|
783
|
+
_page_number = self.source.get_max_pages() - 1
|
|
784
|
+
page = await self.source.get_page(_page_number)
|
|
785
|
+
self.current_page = _page_number
|
|
786
|
+
return page
|
|
787
|
+
|
|
710
788
|
async def send_initial_message(self, ctx: commands.Context):
|
|
711
789
|
"""|coro|
|
|
712
790
|
The default implementation of :meth:`Menu.send_initial_message`
|
|
@@ -714,19 +792,32 @@ class ObservationSearchMenu(DiscordBaseMenu, CoreObservationSearchMenu):
|
|
|
714
792
|
This implementation shows the first page of the source.
|
|
715
793
|
"""
|
|
716
794
|
self.ctx = ctx
|
|
717
|
-
page = await self.
|
|
795
|
+
page = await self.get_page(self.current_page)
|
|
718
796
|
kwargs = await self._get_kwargs_from_page(page)
|
|
797
|
+
if kwargs.get("embeds"):
|
|
798
|
+
pages = self.source.get_max_pages()
|
|
799
|
+
if pages > 1:
|
|
800
|
+
self.add_item(self.back_button)
|
|
801
|
+
self.add_item(self.forward_button)
|
|
802
|
+
if pages > 3:
|
|
803
|
+
self.add_item(self.last_item)
|
|
804
|
+
if self.obs_command:
|
|
805
|
+
self.add_item(self.show_obs_button)
|
|
806
|
+
self.add_item(self.stop_button)
|
|
807
|
+
self.select_observation = SelectObservation(
|
|
808
|
+
view=self, page=page, selected=0
|
|
809
|
+
)
|
|
810
|
+
self.add_item(self.select_observation)
|
|
719
811
|
self.message = await ctx.send(**kwargs, view=self)
|
|
720
812
|
return self.message
|
|
721
813
|
|
|
722
814
|
async def show_page(
|
|
723
815
|
self, page_number: int, interaction: discord.Interaction, selected: int = 0
|
|
724
816
|
):
|
|
725
|
-
page = await self.
|
|
726
|
-
self.
|
|
727
|
-
self.ctx.selected = selected
|
|
728
|
-
kwargs = await self._get_kwargs_from_page(page)
|
|
817
|
+
page = await self.get_page(page_number)
|
|
818
|
+
self.selected = selected
|
|
729
819
|
self.select_observation.update_options(page, selected)
|
|
820
|
+
kwargs = await self._get_kwargs_from_page(page)
|
|
730
821
|
if interaction.response.is_done():
|
|
731
822
|
await interaction.edit_original_response(**kwargs, view=self)
|
|
732
823
|
else:
|
|
@@ -771,6 +862,10 @@ class ObservationSearchMenu(DiscordBaseMenu, CoreObservationSearchMenu):
|
|
|
771
862
|
await self.show_page(self.current_page, interaction, self.selected)
|
|
772
863
|
|
|
773
864
|
|
|
865
|
+
def is_life_list(source):
|
|
866
|
+
return bool(getattr(source.entries[0], "descendant_obs_count", None))
|
|
867
|
+
|
|
868
|
+
|
|
774
869
|
class TaxonListMenu(DiscordBaseMenu, CoreTaxonListMenu):
|
|
775
870
|
def __init__(
|
|
776
871
|
self,
|
|
@@ -789,22 +884,20 @@ class TaxonListMenu(DiscordBaseMenu, CoreTaxonListMenu):
|
|
|
789
884
|
self.current_page = kwargs.get("page_start", 0)
|
|
790
885
|
self.forward_button = ForwardButton(discord.ButtonStyle.grey, 0)
|
|
791
886
|
self.back_button = BackButton(discord.ButtonStyle.grey, 0)
|
|
792
|
-
|
|
887
|
+
if is_life_list(self.source):
|
|
888
|
+
stop_row = 1
|
|
889
|
+
self.first_item = FirstItemButton(discord.ButtonStyle.grey, 0)
|
|
890
|
+
else:
|
|
891
|
+
stop_row = 0
|
|
793
892
|
self.last_item = LastItemButton(discord.ButtonStyle.grey, 0)
|
|
794
|
-
self.
|
|
795
|
-
|
|
796
|
-
self.
|
|
797
|
-
self.
|
|
798
|
-
self.
|
|
799
|
-
self.
|
|
893
|
+
self.show_button = ShowTaxonButton(discord.ButtonStyle.grey, 0)
|
|
894
|
+
self.leaf_button = LeafButton(discord.ButtonStyle.grey, 1)
|
|
895
|
+
self.per_rank_button = PerRankButton(discord.ButtonStyle.grey, 1)
|
|
896
|
+
self.direct_button = DirectButton(discord.ButtonStyle.grey, 1)
|
|
897
|
+
self.common_button = CommonButton(discord.ButtonStyle.grey, 1)
|
|
898
|
+
self.stop_button = StopButton(discord.ButtonStyle.grey, stop_row)
|
|
800
899
|
self.select_taxon = None
|
|
801
|
-
self.root_button = None
|
|
802
900
|
self.root_taxon_id_stack = []
|
|
803
|
-
self.add_item(self.stop_button)
|
|
804
|
-
self.add_item(self.first_item)
|
|
805
|
-
self.add_item(self.back_button)
|
|
806
|
-
self.add_item(self.forward_button)
|
|
807
|
-
self.add_item(self.last_item)
|
|
808
901
|
|
|
809
902
|
async def start(self, ctx: commands.Context):
|
|
810
903
|
ctx.selected = 0
|
|
@@ -812,7 +905,7 @@ class TaxonListMenu(DiscordBaseMenu, CoreTaxonListMenu):
|
|
|
812
905
|
self.bot = self.cog.bot
|
|
813
906
|
self.author = ctx.author
|
|
814
907
|
# await self.source._prepare_once()
|
|
815
|
-
|
|
908
|
+
return await self.send_initial_message(ctx)
|
|
816
909
|
|
|
817
910
|
async def _get_kwargs_from_page(self, page):
|
|
818
911
|
selected = None
|
|
@@ -837,19 +930,21 @@ class TaxonListMenu(DiscordBaseMenu, CoreTaxonListMenu):
|
|
|
837
930
|
self.ctx = ctx
|
|
838
931
|
page = await self.source.get_page(self.current_page)
|
|
839
932
|
kwargs = await self._get_kwargs_from_page(page)
|
|
840
|
-
|
|
933
|
+
is_life = is_life_list(self.source)
|
|
934
|
+
if is_life:
|
|
935
|
+
self.add_item(self.first_item)
|
|
936
|
+
self.add_item(self.back_button)
|
|
937
|
+
self.add_item(self.forward_button)
|
|
938
|
+
self.add_item(self.last_item)
|
|
939
|
+
self.add_item(self.show_button)
|
|
940
|
+
if is_life:
|
|
841
941
|
# Source modifier buttons for life list:
|
|
842
|
-
self.leaf_button = LeafButton(discord.ButtonStyle.grey, 1)
|
|
843
|
-
self.per_rank_button = PerRankButton(discord.ButtonStyle.grey, 1)
|
|
844
|
-
self.root_button = RootButton(discord.ButtonStyle.grey, 1)
|
|
845
|
-
self.direct_button = DirectButton(discord.ButtonStyle.grey, 1)
|
|
846
942
|
self.add_item(self.leaf_button)
|
|
847
943
|
self.add_item(self.per_rank_button)
|
|
848
|
-
self.add_item(self.root_button)
|
|
849
944
|
self.add_item(self.direct_button)
|
|
850
945
|
if self.source.query_response.user:
|
|
851
|
-
self.common_button = CommonButton(discord.ButtonStyle.grey, 1)
|
|
852
946
|
self.add_item(self.common_button)
|
|
947
|
+
self.add_item(self.stop_button)
|
|
853
948
|
self.select_taxon = SelectTaxonListTaxon(view=self, page=page, selected=0)
|
|
854
949
|
self.add_item(self.select_taxon)
|
|
855
950
|
self.message = await ctx.send(**kwargs, view=self)
|
|
@@ -1074,9 +1169,9 @@ class CountMenu(DiscordBaseMenu, CoreCountMenu):
|
|
|
1074
1169
|
self.add_item(self.user_button)
|
|
1075
1170
|
self.add_item(self.query_user_button)
|
|
1076
1171
|
# Owner-only button to cancel the menu
|
|
1077
|
-
self.stop_button = StopButton(discord.ButtonStyle.
|
|
1172
|
+
self.stop_button = StopButton(discord.ButtonStyle.grey, 0)
|
|
1078
1173
|
self.add_item(self.stop_button)
|
|
1079
|
-
|
|
1174
|
+
return await self.send_initial_message(ctx)
|
|
1080
1175
|
|
|
1081
1176
|
async def _get_kwargs_from_page(self):
|
|
1082
1177
|
value = await discord.utils.maybe_coroutine(self.source.format_page)
|
|
@@ -1216,7 +1311,7 @@ class TaxonMenu(DiscordBaseMenu, CoreTaxonMenu):
|
|
|
1216
1311
|
self.image_back_button = ImageBackButton(discord.ButtonStyle.grey, row)
|
|
1217
1312
|
self.image_forward_button = ImageForwardButton(discord.ButtonStyle.grey, row)
|
|
1218
1313
|
self.taxonomy_button = TaxonomyButton(discord.ButtonStyle.grey, row)
|
|
1219
|
-
self.stop_button = StopButton(discord.ButtonStyle.
|
|
1314
|
+
self.stop_button = StopButton(discord.ButtonStyle.grey, row)
|
|
1220
1315
|
|
|
1221
1316
|
row = 1
|
|
1222
1317
|
|
|
@@ -1242,7 +1337,7 @@ class TaxonMenu(DiscordBaseMenu, CoreTaxonMenu):
|
|
|
1242
1337
|
self.ctx = ctx
|
|
1243
1338
|
self.bot = self.cog.bot
|
|
1244
1339
|
self.author = ctx.author
|
|
1245
|
-
|
|
1340
|
+
return await self.send_initial_message(ctx)
|
|
1246
1341
|
|
|
1247
1342
|
async def _get_kwargs_from_page(self):
|
|
1248
1343
|
if (
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
[project]
|
|
2
2
|
name = "dronefly-discord"
|
|
3
|
-
version = "0.2.
|
|
3
|
+
version = "0.2.4.dev1"
|
|
4
4
|
description = "Dronefly Discord library"
|
|
5
5
|
authors = [{ name = "Ben Armstrong", email = "synrg@debian.org" }]
|
|
6
6
|
requires-python = ">=3.11,<3.12"
|
|
@@ -13,7 +13,8 @@ classifiers = [
|
|
|
13
13
|
dependencies = [
|
|
14
14
|
"inflect>=5.3.0,<6",
|
|
15
15
|
"discord-py>=2.3.1",
|
|
16
|
-
"
|
|
16
|
+
"pyinaturalist>=1.0.0.dev2",
|
|
17
|
+
"dronefly-core==0.5.4.dev1",
|
|
17
18
|
]
|
|
18
19
|
|
|
19
20
|
[tool.black]
|
|
@@ -24,12 +25,11 @@ max-line-length = 100
|
|
|
24
25
|
|
|
25
26
|
[dependency-groups]
|
|
26
27
|
dev = [
|
|
27
|
-
"black>=
|
|
28
|
+
"black>=26.1.0,<27",
|
|
28
29
|
"flake8-pyproject>=1.2.4,<2",
|
|
29
|
-
"pytest>=
|
|
30
|
-
"pytest-
|
|
31
|
-
"pylint>=
|
|
32
|
-
"pytest-asyncio>=0.20.3,<0.21",
|
|
30
|
+
"pytest>=9.0,<10.dev0",
|
|
31
|
+
"pytest-asyncio>=1.4.0,<1.5",
|
|
32
|
+
"pylint>=4.1.3,<5",
|
|
33
33
|
"pre-commit>=4.6.0",
|
|
34
34
|
]
|
|
35
35
|
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|