Added .shopreq - Shop items can now have a role requirement in order to purchase. Added .shopbuy alias for .buy

This commit is contained in:
Kwoth
2022-09-13 21:33:20 +02:00
parent d1a818542c
commit f23ffe0c67
16 changed files with 17490 additions and 3 deletions

View File

@@ -94,4 +94,20 @@ public class ShopService : IShopService, INService
await uow.SaveChangesAsync();
return true;
}
public async Task<bool> SetItemRoleRequirementAsync(ulong guildId, int index, ulong? roleId)
{
await using var uow = _db.GetDbContext();
var entries = GetEntriesInternal(uow, guildId);
if (index >= entries.Count)
return false;
var entry = entries[index];
entry.RoleRequirement = roleId;
await uow.SaveChangesAsync();
return true;
}
}