Require MessageType's start with a letter

May cause issues with YML serialization as it can get finicky with keys starting with numbers.
This commit is contained in:
Josh Roy 2021-07-28 16:51:27 -04:00
parent f1d7e50dc0
commit 17e026f9aa
1 changed files with 2 additions and 2 deletions

View File

@ -212,8 +212,8 @@ public class JDADiscordService implements DiscordService {
@Override
public void registerMessageType(Plugin plugin, MessageType type) {
if (!type.getKey().matches("^[a-z0-9-]*$")) {
throw new IllegalArgumentException("MessageType key must match \"^[a-z0-9-]*$\"");
if (!type.getKey().matches("^[a-z][a-z0-9-]*$")) {
throw new IllegalArgumentException("MessageType key must match \"^[a-z][a-z0-9-]*$\"");
}
if (registeredTypes.containsKey(type.getKey())) {