1
0
Fork 0
mirror of https://github.com/myned/modufur.git synced 2024-12-24 22:27:28 +00:00

Fix formatting

This commit is contained in:
Myned 2022-02-21 13:41:01 -06:00
parent 8d9d5df204
commit 2be14bc324
No known key found for this signature in database
GPG key ID: 33790F979F7A28B8
2 changed files with 16 additions and 9 deletions

View file

@ -37,9 +37,10 @@ async def reverse(context):
if len(urls) > 1: if len(urls) > 1:
selector = components.Selector( selector = components.Selector(
pages=[f'**Select {urls.index(url) + 1} out of {len(urls)} potential images to search:**\n{url}' for url in urls], pages=[f'**Select potential images to search: `{urls.index(url) + 1}/{len(urls)}`**\n{url}' for url in urls],
buttons=[components.Select(), components.Back(), components.Forward(), components.Confirm()], buttons=[components.Back(), components.Forward(), components.Select(), components.Confirm()],
urls=urls) urls=urls
)
await selector.send(context.interaction, ephemeral=True) await selector.send(context.interaction, ephemeral=True)
await selector.wait() await selector.wait()
@ -100,7 +101,8 @@ async def _reverse(context, urls, *, selector=None):
selector = components.Selector( selector = components.Selector(
pages=pages, pages=pages,
buttons=[components.Back(), components.Forward()], buttons=[components.Back(), components.Forward()],
timeout=900) timeout=900
)
await selector.send_edit(context.interaction) await selector.send_edit(context.interaction)
else: else:

View file

@ -11,21 +11,24 @@ class Back(nav.PrevButton):
super().__init__( super().__init__(
style=hikari.ButtonStyle.SECONDARY, style=hikari.ButtonStyle.SECONDARY,
label='', label='',
emoji=None) emoji=None
)
class Forward(nav.NextButton): class Forward(nav.NextButton):
def __init__(self): def __init__(self):
super().__init__( super().__init__(
style=hikari.ButtonStyle.SECONDARY, style=hikari.ButtonStyle.SECONDARY,
label='', label='',
emoji=None) emoji=None
)
class Confirm(nav.StopButton): class Confirm(nav.StopButton):
def __init__(self): def __init__(self):
super().__init__( super().__init__(
style=hikari.ButtonStyle.PRIMARY, style=hikari.ButtonStyle.PRIMARY,
label='', label='',
emoji=None) emoji=None
)
async def callback(self, context): async def callback(self, context):
await context.edit_response(content='**Searching...**', components=None) await context.edit_response(content='**Searching...**', components=None)
@ -40,7 +43,8 @@ class Select(nav.NavButton):
super().__init__( super().__init__(
style=hikari.ButtonStyle.DANGER, style=hikari.ButtonStyle.DANGER,
label='', label='',
emoji=None) emoji=None
)
async def callback(self, context): async def callback(self, context):
if self.view.urls[self.view.current_page] not in self.view.selected: if self.view.urls[self.view.current_page] not in self.view.selected:
@ -74,7 +78,8 @@ class Selector(nav.NavigatorView):
super().__init__( super().__init__(
pages=pages, pages=pages,
buttons=buttons, buttons=buttons,
timeout=timeout) timeout=timeout
)
self.urls = urls self.urls = urls
self.selected = [] self.selected = []
self.saved = set() self.saved = set()