group import/export

This commit is contained in:
spiral
2021-09-21 21:42:41 -04:00
parent a09f819924
commit bc2c198a82
8 changed files with 219 additions and 9 deletions

View File

@@ -45,7 +45,7 @@ namespace PluralKit.Bot
await using var conn = await _db.Obtain();
// Check group cap
var existingGroupCount = await conn.QuerySingleAsync<int>("select count(*) from groups where system = @System", new { System = ctx.System.Id });
var existingGroupCount = await _repo.GetSystemGroupCount(conn, ctx.System.Id);
var groupLimit = ctx.System.GroupLimitOverride ?? Limits.MaxGroupCount;
if (existingGroupCount >= groupLimit)
throw new PKError($"System has reached the maximum number of groups ({groupLimit}). Please delete unused groups first in order to create new ones.");