Fixed complaint command #341 #1.1.0.rc3

This commit is contained in:
2023-08-16 22:12:40 +02:00
parent fe3d67eff5
commit 2d5ce58612
3 changed files with 12 additions and 12 deletions

View File

@@ -1,3 +1,4 @@
from cpl_core.dependency_injection import ServiceProviderABC
from cpl_core.logging import LoggerABC
from cpl_discord.command import DiscordCommandABC
from cpl_discord.service import DiscordBotServiceABC
@@ -10,15 +11,12 @@ from modules.base.forms.complaint_form import ComplaintForm
class SubmitGroup(DiscordCommandABC):
def __init__(
self, logger: LoggerABC, bot: DiscordBotServiceABC, complaint_form: ComplaintForm, bug_form: BugReportForm
):
def __init__(self, services: ServiceProviderABC, logger: LoggerABC, bot: DiscordBotServiceABC):
DiscordCommandABC.__init__(self)
self._services = services
self._logger = logger
self._bot = bot
self._complaint_form = complaint_form
self._bug_form = bug_form
@commands.hybrid_group()
@commands.guild_only()
@@ -30,14 +28,15 @@ class SubmitGroup(DiscordCommandABC):
@CommandChecks.check_is_ready()
async def complaint(self, ctx: Context):
self._logger.debug(__name__, f"Received command complaint {ctx}")
await ctx.interaction.response.send_modal(self._complaint_form)
complaint_form: ComplaintForm = self._services.get_service(ComplaintForm)
await ctx.interaction.response.send_modal(complaint_form)
self._logger.trace(__name__, f"Finished command complaint {ctx}")
pass
@submit.command()
@commands.guild_only()
@CommandChecks.check_is_ready()
async def bug_report(self, ctx: Context):
self._logger.debug(__name__, f"Received command complaint {ctx}")
await ctx.interaction.response.send_modal(self._bug_form)
bug_form: BugReportForm = self._services.get_service(BugReportForm)
await ctx.interaction.response.send_modal(bug_form)
self._logger.trace(__name__, f"Finished command complaint {ctx}")