Skip to content

Commit b9a9193

Browse files
committed
Add check for invalid vote change configuration (Fix #2)
1 parent 04483f3 commit b9a9193

File tree

4 files changed

+6
-1
lines changed

4 files changed

+6
-1
lines changed

.idea/misc.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

build.gradle.kts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ plugins {
55
alias(libs.plugins.kotlin.serialization) apply false
66
}
77
allprojects {
8-
version = "5.8.0"
8+
version = "5.8.1"
99
group = "space.votebot"
1010

1111
repositories {

plugin/src/main/kotlin/space/votebot/commands/vote/create/CreateCommand.kt

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -71,6 +71,9 @@ suspend fun VoteBotModule.createCommand() = ephemeralSlashCommand(::CreateArgume
7171
voteCommandContext()
7272

7373
action commandAction@{
74+
if (arguments.maxVotes != 1 && arguments.maxChanges != 0) {
75+
throw DiscordRelayedException(VoteBotTranslations.Vote.Create.invalidChangeConfiguration)
76+
}
7477
var currentSettings = (VoteBotDatabase.userSettings.findOneById(user.id)?.settings
7578
?: StoredPollSettings()).merge(
7679
StoredPollSettings(

plugin/src/main/resources/translations/votebot/strings.properties

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ vote.create.too_short=Please enter a duration, which is at least **one minute**.
2626
vote.settings.vote_channel_updated=The vote channel was updated.
2727
vote.settings.no_channel_defined=There currently is no vote channel set.
2828
vote.settings.vote_channel_removed=The vote channel was removed.
29+
vote.create.invalid_change-configuration=If `max-votes` is greater than 1 `max-changes` cannot be specified
2930
commands.add_option.success=Successfully added option: `{0}`.
3031
commands.change_heading.success=Successfully changed heading to: `{0}`.
3132
commands.create.success=Vote created successfully.

0 commit comments

Comments
 (0)