mirror of
https://github.com/stijndcl/didier.git
synced 2026-04-07 23:55:46 +02:00
Create command to list custom commands, add shortcuts to memegen commands
This commit is contained in:
parent
8922489a41
commit
bf32a5ef47
8 changed files with 120 additions and 62 deletions
|
|
@ -12,6 +12,7 @@ __all__ = [
|
|||
"create_alias",
|
||||
"create_command",
|
||||
"edit_command",
|
||||
"get_all_commands",
|
||||
"get_command",
|
||||
"get_command_by_alias",
|
||||
"get_command_by_name",
|
||||
|
|
@ -55,6 +56,12 @@ async def create_alias(session: AsyncSession, command: str, alias: str) -> Custo
|
|||
return alias_instance
|
||||
|
||||
|
||||
async def get_all_commands(session: AsyncSession) -> list[CustomCommand]:
|
||||
"""Get a list of all commands"""
|
||||
statement = select(CustomCommand)
|
||||
return (await session.execute(statement)).scalars().all()
|
||||
|
||||
|
||||
async def get_command(session: AsyncSession, message: str) -> Optional[CustomCommand]:
|
||||
"""Try to get a command out of a message"""
|
||||
# Search lowercase & without spaces
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue