This commit is contained in:
2024-04-01 21:24:42 +02:00
parent fc8140c0fa
commit 32dafce2a8
+14 -7
View File
@@ -1969,15 +1969,22 @@ class DoSearchView(discord.ui.View):
def __init__(self,*args, **kwargs) -> None:
super().__init__(*args, **kwargs)
self.row1 = "Test"
@discord.ui.button(label="Sprawdz czy istnieje", style=discord.ButtonStyle.danger, row=0)
async def button1_callback(self, interaction, button):
@discord.ui.button(label="Nastepna strona", style=discord.ButtonStyle.primary, row=0)
async def next_callback(self, interaction, button):
#emoji = await ctx.guild.fetch_emoji(id)
#button.emoji=1102174413887111189
logger.info("Pressed")
await interaction.response.edit_message(content = "You clicked the button!") # Send a message when the button is clicked
@discord.ui.button(label="Sprawdz czy istnieje", style=discord.ButtonStyle.danger, row=1)
async def button2_callback(self, interaction, button):
@discord.ui.button(label="Odśwież wyszukanie", style=discord.ButtonStyle.danger, row=0)
async def reset_callback(self, interaction, button):
#emoji = await ctx.guild.fetch_emoji(id)
#button.emoji=1102174413887111189
logger.info("Pressed")
await interaction.response.edit_message(content = "You clicked the button!") # Send a message when the button is clicked
@discord.ui.button(label="Poprzednia Strona", style=discord.ButtonStyle.primary, row=0)
async def perv_callback(self, interaction, button):
#emoji = await ctx.guild.fetch_emoji(id)
#button.emoji=1102174413887111189
logger.info("Pressed")
@@ -2001,12 +2008,12 @@ async def wyszukaj_linki_do_dokumentow(ctx):
#5 przyciski przy każdym wierszu pozwalają sprawdzić czy plik istnieje na scihubie - jeśli tak podaje link do sciagniecia
#6 ostatni wiersz to dalej, wróć, skasuj, zaciagnij kolejne wyniki (jeśli jest ich więcej niż 1000)
result_view = DoSearchView()
resulttab = ["r1", "r2", "r3", "r4", "r5"]
resulttab = ["r1", "r2", "r3", "r4", "r5", "r6"]
for i in range(0,5):
for i in range(1,7):
query = quote_plus(resulttab[i])
url = f'https://www.google.com/search?q={query}'
result_view.add_item(discord.ui.Button(label = resulttab[i], row = i,url=url))
result_view.add_item(discord.ui.Button(label = resulttab[i-1], row = i,url=url))
await ctx.send("This is a button!", view=result_view) # Send a message with our View class that contains the button