30 lines
917 B
Python
30 lines
917 B
Python
|
|
from discord import Embed, Message, ui
|
|
from redbot.core import commands
|
|
|
|
from .config import config
|
|
|
|
|
|
async def get_config(ctx: commands.Context) -> dict:
|
|
return dict(sorted(await config.guild(ctx.guild).all().items()))
|
|
|
|
async def get_embed(ctx: commands.Context, type: str = None):
|
|
conf = await get_config(ctx)
|
|
if not type or type not in conf.keys():
|
|
embed = Embed(
|
|
title="Logger Configuration - Message Delete",
|
|
description="Please select a configuration option below.",
|
|
color=await ctx.embed_color(),
|
|
)
|
|
|
|
|
|
class ConfigMenu(ui.View):
|
|
def __init__(self, ctx: commands.Context, message: Message, type: str = None, timeout: int = None):
|
|
super().__init__()
|
|
self.ctx = ctx
|
|
self.message = message
|
|
self.type = type
|
|
self.timeout = timeout
|
|
|
|
async def on_timeout(self):
|
|
await self.message.edit(view=None)
|