From 491723fc3b294861c03f3dc57f890a570c67b343 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rn-Michael=20Miehe?= Date: Sat, 2 Dec 2023 23:56:11 +0100 Subject: [PATCH] move commands into package --- lenaverse_bot/commands/__init__.py | 3 +++ lenaverse_bot/{core => commands}/post.py | 2 +- lenaverse_bot/{core => commands}/verein.py | 2 +- lenaverse_bot/core/bot.py | 5 ++--- 4 files changed, 7 insertions(+), 5 deletions(-) create mode 100644 lenaverse_bot/commands/__init__.py rename lenaverse_bot/{core => commands}/post.py (99%) rename lenaverse_bot/{core => commands}/verein.py (97%) diff --git a/lenaverse_bot/commands/__init__.py b/lenaverse_bot/commands/__init__.py new file mode 100644 index 0000000..c2015d8 --- /dev/null +++ b/lenaverse_bot/commands/__init__.py @@ -0,0 +1,3 @@ +from . import post, verein + +COMMANDS = post.COMMANDS + verein.COMMANDS diff --git a/lenaverse_bot/core/post.py b/lenaverse_bot/commands/post.py similarity index 99% rename from lenaverse_bot/core/post.py rename to lenaverse_bot/commands/post.py index f2632db..27d1db5 100644 --- a/lenaverse_bot/core/post.py +++ b/lenaverse_bot/commands/post.py @@ -4,7 +4,7 @@ from enum import Enum, auto import discord from discord import ui -from .config import CONFIG +from ..core.config import CONFIG _logger = logging.getLogger(__name__) diff --git a/lenaverse_bot/core/verein.py b/lenaverse_bot/commands/verein.py similarity index 97% rename from lenaverse_bot/core/verein.py rename to lenaverse_bot/commands/verein.py index d750eaf..c3cbeef 100644 --- a/lenaverse_bot/core/verein.py +++ b/lenaverse_bot/commands/verein.py @@ -3,7 +3,7 @@ import logging import discord -from .config import CONFIG, FileCommand, InfoCommand +from ..core.config import CONFIG, FileCommand, InfoCommand _logger = logging.getLogger(__name__) diff --git a/lenaverse_bot/core/bot.py b/lenaverse_bot/core/bot.py index 55212d5..5057f96 100644 --- a/lenaverse_bot/core/bot.py +++ b/lenaverse_bot/core/bot.py @@ -2,7 +2,7 @@ import logging import discord -from . import post, verein +from ..commands import COMMANDS from .config import CONFIG _logger = logging.getLogger(__name__) @@ -16,8 +16,7 @@ class LenaverseBot(discord.Client): ) self.tree = discord.app_commands.CommandTree(self) - commands = post.COMMANDS + verein.COMMANDS - for command in commands: + for command in COMMANDS: self.tree.add_command(command) async def setup_hook(self):