Skip to content

Commit

Permalink
Hopefully fixing some UX
Browse files Browse the repository at this point in the history
Also renamed the ignored exceptions to clear warnings
  • Loading branch information
NovaFox161 committed Sep 11, 2024
1 parent c1ec656 commit 52da4b8
Showing 1 changed file with 10 additions and 15 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ class ProjectCommand(
.map(ApplicationCommandInteractionOptionValue::asString)
.map(String::toLong)
.get()
} catch (ex: NumberFormatException) { -1 }
} catch (_: NumberFormatException) { -1 }


if (projectService.getProject(settings.guildId, projectId) == null) {
Expand Down Expand Up @@ -138,7 +138,7 @@ class ProjectCommand(
.map(ApplicationCommandInteractionOptionValue::asString)
.map(String::toLong)
.get()
} catch (ex: NumberFormatException) { -1 }
} catch (_: NumberFormatException) { -1 }

val project = projectService.getProject(settings.guildId, projectId)
if (project == null) {
Expand All @@ -164,9 +164,7 @@ class ProjectCommand(
.map(ApplicationCommandInteractionOptionValue::asString)
.map(String::toLong)
.get()
} catch (ex: NumberFormatException) {
-1
}
} catch (_: NumberFormatException) { -1 }
val project = projectService.getProject(settings.guildId, projectId)

val prefix = event.options[0].getOption("prefix")
Expand Down Expand Up @@ -226,15 +224,14 @@ class ProjectCommand(
if (staffRoles.contains(staffRole)) staffRoles.remove(staffRole)
else staffRoles.add(staffRole)
}
projectService.updateProject(
project.copy(
prefix = prefix,
staffUsers = staffUsers,
staffRoles = staffRoles,
pingOverride = pingOverride,
)
val updatedProject = project.copy(
prefix = prefix,
staffUsers = staffUsers,
staffRoles = staffRoles,
pingOverride = pingOverride,
)
val updatedProject = projectService.getProject(settings.guildId, project.id)!!

projectService.updateProject(updatedProject)

if (editInfo) {
// Pop Modal for follow-up
Expand All @@ -256,8 +253,6 @@ class ProjectCommand(
event.createFollowup()
.withEmbeds(embedService.getProjectListEmbed(settings))
.withEphemeral(ephemeral)
.map(Message::getId)
.flatMap { event.deleteFollowupDelayed(it, messageDeleteSeconds) }
.awaitSingleOrNull()
}
}

0 comments on commit 52da4b8

Please sign in to comment.