Merge branch 'master' into fix/updategroup-retainall-type-mismatch

This commit is contained in:
joeykrim 2026-03-12 23:06:18 -07:00 committed by GitHub
commit 50d50bdf08
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 15 additions and 1 deletions

View File

@ -443,6 +443,7 @@ By default, recipients can select multiple options.
*-o* OPTION [OPTION ...], *--option* OPTION [OPTION ...]*::
The options for the poll.
Between 2 and 10 options must be specified.
Each option must be between 1 and 100 characters.
=== sendPollVote

View File

@ -25,6 +25,7 @@ public class SendPollCreateCommand implements JsonRpcLocalCommand {
private static final Logger logger = LoggerFactory.getLogger(SendPollCreateCommand.class);
private static final int MAX_POLL_OPTIONS = 10;
private static final int MAX_POLL_OPTION_LENGTH = 100;
@Override
public String getName() {
@ -76,6 +77,14 @@ public class SendPollCreateCommand implements JsonRpcLocalCommand {
if (options.size() > MAX_POLL_OPTIONS) {
throw new UserErrorException("Poll cannot have more than " + MAX_POLL_OPTIONS + " options");
}
for (final var option : options) {
if (option.isEmpty()) {
throw new UserErrorException("Poll options must not be empty");
}
if (option.length() > MAX_POLL_OPTION_LENGTH) {
throw new UserErrorException("Poll option \"" + option + "\" exceeds the maximum length of " + MAX_POLL_OPTION_LENGTH + " characters");
}
}
try {
var results = m.sendPollCreateMessage(question, !noMulti, options, recipientIdentifiers, notifySelf);

View File

@ -2397,6 +2397,10 @@
"name": "internal",
"parameterTypes": []
},
{
"name": "isArchived",
"parameterTypes": []
},
{
"name": "isBlocked",
"parameterTypes": []
@ -9807,4 +9811,4 @@
"bundle": "net.sourceforge.argparse4j.internal.ArgumentParserImpl"
}
]
}
}