didier/data/menus/custom_commands.py

23 lines
795 B
Python
Raw Normal View History

2021-06-19 23:08:42 +02:00
import discord
from discord.ext import menus
2022-02-05 22:55:09 +01:00
# TODO rework pagination
2021-06-19 23:08:42 +02:00
class CommandsList(menus.ListPageSource):
def __init__(self, data, colour=discord.Colour.blue()):
super().__init__(data, per_page=15)
self.colour = colour
async def format_page(self, menu: menus.MenuPages, entries):
embed = discord.Embed(colour=self.colour)
embed.set_author(name="Custom Commands")
embed.description = "\n".join(entries)
embed.set_footer(text="{}/{}".format(menu.current_page + 1, self.get_max_pages()))
return embed
class Pages(menus.MenuPages):
def __init__(self, source, clear_reactions_after, timeout=30.0):
super().__init__(source, timeout=timeout, delete_message_after=True, clear_reactions_after=clear_reactions_after)