mirror of https://github.com/stijndcl/didier
Compare commits
No commits in common. "257eae6fa71643fd3c6e562803524d37a01aa856" and "add939994481cdac714efd443b11bb876f6284ae" have entirely different histories.
257eae6fa7
...
add9399944
|
|
@ -36,6 +36,7 @@ class Owner(commands.Cog):
|
||||||
self.client.tree.copy_global_to(guild=guild)
|
self.client.tree.copy_global_to(guild=guild)
|
||||||
await self.client.tree.sync(guild=guild)
|
await self.client.tree.sync(guild=guild)
|
||||||
else:
|
else:
|
||||||
|
self.client.tree.clear_commands(guild=None)
|
||||||
await self.client.tree.sync()
|
await self.client.tree.sync()
|
||||||
|
|
||||||
await ctx.message.add_reaction("🔄")
|
await ctx.message.add_reaction("🔄")
|
||||||
|
|
@ -72,14 +73,14 @@ class Owner(commands.Cog):
|
||||||
@add_slash.command(name="custom", description="Add a custom command")
|
@add_slash.command(name="custom", description="Add a custom command")
|
||||||
async def add_custom_slash(self, interaction: discord.Interaction):
|
async def add_custom_slash(self, interaction: discord.Interaction):
|
||||||
"""Slash command to add a custom command"""
|
"""Slash command to add a custom command"""
|
||||||
if not await self.client.is_owner(interaction.user):
|
if not self.client.is_owner(interaction.user):
|
||||||
return interaction.response.send_message(
|
return interaction.response.send_message(
|
||||||
"Je hebt geen toestemming om dit commando uit te voeren.", ephemeral=True
|
"Je hebt geen toestemming om dit commando uit te voeren.", ephemeral=True
|
||||||
)
|
)
|
||||||
|
|
||||||
# await interaction.response.defer(ephemeral=True)
|
await interaction.response.defer(ephemeral=True)
|
||||||
modal = CreateCustomCommand()
|
modal = CreateCustomCommand()
|
||||||
await interaction.response.send_modal(modal)
|
await interaction.response.send_message(modal)
|
||||||
|
|
||||||
@commands.group(name="Edit")
|
@commands.group(name="Edit")
|
||||||
async def edit(self, ctx: commands.Context):
|
async def edit(self, ctx: commands.Context):
|
||||||
|
|
|
||||||
|
|
@ -6,10 +6,10 @@ import discord
|
||||||
class CreateCustomCommand(discord.ui.Modal, title="Custom Command"):
|
class CreateCustomCommand(discord.ui.Modal, title="Custom Command"):
|
||||||
"""Modal shown to visually create custom commands"""
|
"""Modal shown to visually create custom commands"""
|
||||||
|
|
||||||
name: discord.ui.TextInput = discord.ui.TextInput(label="Name", placeholder="Name of the command")
|
name: discord.ui.TextInput = discord.ui.TextInput(label="Name", placeholder="Name of the command...")
|
||||||
|
|
||||||
response: discord.ui.TextInput = discord.ui.TextInput(
|
response: discord.ui.TextInput = discord.ui.TextInput(
|
||||||
label="Response", style=discord.TextStyle.long, placeholder="Response of the command", max_length=2000
|
label="Response", style=discord.TextStyle.long, placeholder="Response of the command...", max_length=2000
|
||||||
)
|
)
|
||||||
|
|
||||||
async def on_submit(self, interaction: discord.Interaction) -> None:
|
async def on_submit(self, interaction: discord.Interaction) -> None:
|
||||||
|
|
|
||||||
|
|
@ -3,10 +3,11 @@ from typing import AsyncGenerator, Generator
|
||||||
from unittest.mock import MagicMock
|
from unittest.mock import MagicMock
|
||||||
|
|
||||||
import pytest
|
import pytest
|
||||||
|
|
||||||
|
from alembic import command, config
|
||||||
from sqlalchemy.ext.asyncio import AsyncSession
|
from sqlalchemy.ext.asyncio import AsyncSession
|
||||||
|
|
||||||
from database.engine import engine
|
from database.engine import engine
|
||||||
from database.models import Base
|
|
||||||
from didier import Didier
|
from didier import Didier
|
||||||
|
|
||||||
|
|
||||||
|
|
@ -18,10 +19,15 @@ def event_loop() -> Generator:
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture(scope="session")
|
@pytest.fixture(scope="session")
|
||||||
async def tables(event_loop):
|
def tables(event_loop):
|
||||||
"""Initialize a database before the tests, and then tear it down again"""
|
"""Initialize a database before the tests, and then tear it down again
|
||||||
async with engine.begin() as connection:
|
Starts from an empty database and runs through all the migrations to check those as well
|
||||||
await connection.run_sync(Base.metadata.create_all)
|
while we're at it
|
||||||
|
"""
|
||||||
|
alembic_config = config.Config("alembic.ini")
|
||||||
|
command.upgrade(alembic_config, "head")
|
||||||
|
yield
|
||||||
|
command.downgrade(alembic_config, "base")
|
||||||
|
|
||||||
|
|
||||||
@pytest.fixture
|
@pytest.fixture
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue