Fixed complaint command #341 #1.1.0.rc3
This commit is contained in:
parent
fe3d67eff5
commit
2d5ce58612
@ -30,7 +30,8 @@
|
|||||||
"requests-oauthlib==1.3.1",
|
"requests-oauthlib==1.3.1",
|
||||||
"icmplib==3.0.3",
|
"icmplib==3.0.3",
|
||||||
"ariadne==0.20.1",
|
"ariadne==0.20.1",
|
||||||
"cryptography==41.0.2"
|
"cryptography==41.0.2",
|
||||||
|
"discord>=2.3.2"
|
||||||
],
|
],
|
||||||
"DevDependencies": [
|
"DevDependencies": [
|
||||||
"cpl-cli==2023.4.0.post3",
|
"cpl-cli==2023.4.0.post3",
|
||||||
|
@ -43,7 +43,7 @@ class ServerConfigMutation(QueryABC):
|
|||||||
if "id" not in input:
|
if "id" not in input:
|
||||||
raise ValueError("Id not set")
|
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)
|
self._can_user_mutate_data(Route.get_user().users[0].server, UserRoleEnum.technician)
|
||||||
|
|
||||||
server_config.message_delete_timer = (
|
server_config.message_delete_timer = (
|
||||||
@ -137,7 +137,7 @@ class ServerConfigMutation(QueryABC):
|
|||||||
return server_config
|
return server_config
|
||||||
|
|
||||||
def _update_afk_channel_ids(self, new_config: ServerConfig):
|
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:
|
for channel_id in old_config.afk_channel_ids:
|
||||||
if channel_id in new_config.afk_channel_ids:
|
if channel_id in new_config.afk_channel_ids:
|
||||||
continue
|
continue
|
||||||
@ -155,7 +155,7 @@ class ServerConfigMutation(QueryABC):
|
|||||||
)
|
)
|
||||||
|
|
||||||
def _update_team_role_ids(self, new_config: ServerConfig):
|
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:
|
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)):
|
if role_id.role_id in new_config.team_role_ids.select(lambda x: int(x.role_id)):
|
||||||
continue
|
continue
|
||||||
|
@ -1,3 +1,4 @@
|
|||||||
|
from cpl_core.dependency_injection import ServiceProviderABC
|
||||||
from cpl_core.logging import LoggerABC
|
from cpl_core.logging import LoggerABC
|
||||||
from cpl_discord.command import DiscordCommandABC
|
from cpl_discord.command import DiscordCommandABC
|
||||||
from cpl_discord.service import DiscordBotServiceABC
|
from cpl_discord.service import DiscordBotServiceABC
|
||||||
@ -10,15 +11,12 @@ from modules.base.forms.complaint_form import ComplaintForm
|
|||||||
|
|
||||||
|
|
||||||
class SubmitGroup(DiscordCommandABC):
|
class SubmitGroup(DiscordCommandABC):
|
||||||
def __init__(
|
def __init__(self, services: ServiceProviderABC, logger: LoggerABC, bot: DiscordBotServiceABC):
|
||||||
self, logger: LoggerABC, bot: DiscordBotServiceABC, complaint_form: ComplaintForm, bug_form: BugReportForm
|
|
||||||
):
|
|
||||||
DiscordCommandABC.__init__(self)
|
DiscordCommandABC.__init__(self)
|
||||||
|
|
||||||
|
self._services = services
|
||||||
self._logger = logger
|
self._logger = logger
|
||||||
self._bot = bot
|
self._bot = bot
|
||||||
self._complaint_form = complaint_form
|
|
||||||
self._bug_form = bug_form
|
|
||||||
|
|
||||||
@commands.hybrid_group()
|
@commands.hybrid_group()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@ -30,14 +28,15 @@ class SubmitGroup(DiscordCommandABC):
|
|||||||
@CommandChecks.check_is_ready()
|
@CommandChecks.check_is_ready()
|
||||||
async def complaint(self, ctx: Context):
|
async def complaint(self, ctx: Context):
|
||||||
self._logger.debug(__name__, f"Received command complaint {ctx}")
|
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}")
|
self._logger.trace(__name__, f"Finished command complaint {ctx}")
|
||||||
pass
|
|
||||||
|
|
||||||
@submit.command()
|
@submit.command()
|
||||||
@commands.guild_only()
|
@commands.guild_only()
|
||||||
@CommandChecks.check_is_ready()
|
@CommandChecks.check_is_ready()
|
||||||
async def bug_report(self, ctx: Context):
|
async def bug_report(self, ctx: Context):
|
||||||
self._logger.debug(__name__, f"Received command complaint {ctx}")
|
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}")
|
self._logger.trace(__name__, f"Finished command complaint {ctx}")
|
||||||
|
Loading…
Reference in New Issue
Block a user