diff --git a/kdb-bot/src/bot/bot.json b/kdb-bot/src/bot/bot.json index 4ba86b24..949b297b 100644 --- a/kdb-bot/src/bot/bot.json +++ b/kdb-bot/src/bot/bot.json @@ -30,7 +30,8 @@ "requests-oauthlib==1.3.1", "icmplib==3.0.3", "ariadne==0.20.1", - "cryptography==41.0.2" + "cryptography==41.0.2", + "discord>=2.3.2" ], "DevDependencies": [ "cpl-cli==2023.4.0.post3", diff --git a/kdb-bot/src/bot_graphql/mutations/server_config_mutation.py b/kdb-bot/src/bot_graphql/mutations/server_config_mutation.py index 0968b2d4..4a56d9f0 100644 --- a/kdb-bot/src/bot_graphql/mutations/server_config_mutation.py +++ b/kdb-bot/src/bot_graphql/mutations/server_config_mutation.py @@ -43,7 +43,7 @@ class ServerConfigMutation(QueryABC): if "id" not in input: raise ValueError("Id not set") - server_config = self._server_configs.get_server_config_by_server(input["id"]) + server_config = self._server_configs.get_server_config_by_id(int(input["id"])) self._can_user_mutate_data(Route.get_user().users[0].server, UserRoleEnum.technician) server_config.message_delete_timer = ( @@ -137,7 +137,7 @@ class ServerConfigMutation(QueryABC): return server_config def _update_afk_channel_ids(self, new_config: ServerConfig): - old_config = self._server_configs.get_server_config_by_id(new_config.server.id) + old_config = self._server_configs.get_server_config_by_server(new_config.server.id) for channel_id in old_config.afk_channel_ids: if channel_id in new_config.afk_channel_ids: continue @@ -155,7 +155,7 @@ class ServerConfigMutation(QueryABC): ) def _update_team_role_ids(self, new_config: ServerConfig): - old_config = self._server_configs.get_server_config_by_id(new_config.server.id) + old_config = self._server_configs.get_server_config_by_server(new_config.server.id) for role_id in old_config.team_role_ids: if role_id.role_id in new_config.team_role_ids.select(lambda x: int(x.role_id)): continue diff --git a/kdb-bot/src/modules/base/command/submit_group.py b/kdb-bot/src/modules/base/command/submit_group.py index 56812e14..ad1570e3 100644 --- a/kdb-bot/src/modules/base/command/submit_group.py +++ b/kdb-bot/src/modules/base/command/submit_group.py @@ -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}")