Bounds check system name in new system command

This commit is contained in:
Ske 2020-08-11 22:05:27 +02:00
parent a0fc9d3826
commit 0de284cd36

View File

@ -25,7 +25,11 @@ namespace PluralKit.Bot
{ {
ctx.CheckNoSystem(); ctx.CheckNoSystem();
var system = await _data.CreateSystem(ctx.RemainderOrNull()); var systemName = ctx.RemainderOrNull();
if (systemName != null && systemName.Length > Limits.MaxSystemNameLength)
throw Errors.SystemNameTooLongError(systemName.Length);
var system = await _data.CreateSystem(systemName);
await _data.AddAccount(system, ctx.Author.Id); await _data.AddAccount(system, ctx.Author.Id);
await ctx.Reply($"{Emojis.Success} Your system has been created. Type `pk;system` to view it, and type `pk;system help` for more information about commands you can use now. Now that you have that set up, check out the getting started guide on setting up members and proxies: <https://pluralkit.me/start>"); await ctx.Reply($"{Emojis.Success} Your system has been created. Type `pk;system` to view it, and type `pk;system help` for more information about commands you can use now. Now that you have that set up, check out the getting started guide on setting up members and proxies: <https://pluralkit.me/start>");
} }