Show list of custom commands

This commit is contained in:
Stijn De Clercq 2021-06-19 23:08:42 +02:00
parent a310d1696c
commit 7847cc1d29
11 changed files with 57 additions and 7 deletions

View file

@ -1,4 +1,4 @@
from data import paginatedLeaderboard
from data.menus import paginatedLeaderboard
from decorators import help
import discord
from discord.ext import commands

View file

@ -1,4 +1,4 @@
from data import paginatedLeaderboard
from data.menus import paginatedLeaderboard
from decorators import help
import discord
from discord.ext import commands

View file

@ -5,11 +5,10 @@ from discord.ext import commands
from enums.help_categories import Category
from functions import checks, config, timeFormatters
from functions.database import memes, githubs, twitch, dadjoke
from functions.database.custom_commands import add_command, add_alias
import json
import os
from functions.database.custom_commands import is_name_free, add_command, add_alias
class ModCommands(commands.Cog):

30
cogs/other.py Normal file
View file

@ -0,0 +1,30 @@
from discord.ext import commands
from data.menus import custom_commands
from decorators import help
from enums.help_categories import Category
from functions.database.custom_commands import get_all
from functions.stringFormatters import capitalize
class Other(commands.Cog):
def __init__(self, client):
self.client = client
# Don't allow any commands to work when locked
def cog_check(self, ctx):
return not self.client.locked
@commands.command(name="Custom")
@help.Category(category=Category.Didier)
async def list_custom(self, ctx):
"""
Get a list of all custom commands
"""
all_commands = get_all()
formatted = list(sorted(map(lambda x: capitalize(x["name"]), all_commands)))
src = custom_commands.CommandsList(formatted)
await custom_commands.Pages(source=src, clear_reactions_after=True).start(ctx)
def setup(client):
client.add_cog(Other(client))

View file

@ -1,5 +1,5 @@
from converters.numbers import Abbreviated
from data import storePages
from data.menus import storePages
from decorators import help
import discord
from discord.ext import commands

View file

@ -1,5 +1,4 @@
from data import paginatedLeaderboard
import datetime
from data.menus import paginatedLeaderboard
from decorators import help
import discord
from discord.ext import commands, menus