19 lines
No EOL
889 B
Python
19 lines
No EOL
889 B
Python
import discord
|
|
|
|
class ButtonMenu(discord.ui.View):
|
|
def __init__(self, embeds: list, timeout: int = 180):
|
|
super().__init__(timeout=timeout)
|
|
self.embeds = embeds
|
|
self.current_page = 0
|
|
|
|
@discord.ui.button(label="◀️", style=discord.ButtonStyle.gray)
|
|
async def previous(self, interaction: discord.Interaction, button: discord.ui.Button):
|
|
if self.current_page > 0:
|
|
self.current_page -= 1
|
|
await interaction.response.edit_message(embed=self.embeds[self.current_page])
|
|
|
|
@discord.ui.button(label="▶️", style=discord.ButtonStyle.gray)
|
|
async def next(self, interaction: discord.Interaction, button: discord.ui.Button):
|
|
if self.current_page < len(self.embeds) - 1:
|
|
self.current_page += 1
|
|
await interaction.response.edit_message(embed=self.embeds[self.current_page]) |