#nullable enable using System; using System.Collections.Generic; using System.Linq; using Microsoft.Extensions.Configuration; using Telegram.Bot.Types; namespace Kruzya.TelegramBot.Core.Service { public class UserService { private readonly List _superUsers; private readonly Dictionary _statusMap; public UserService(IConfiguration configuration) { _superUsers = configuration.GetSection("SuperUsers") .GetChildren() .Select(q => Convert.ToInt64(q.Value)) .ToList(); _statusMap = configuration.GetSection("CustomMemberStatus") .GetChildren() .ToDictionary(x => Convert.ToInt64(x.Key), x => x.Value); } public bool IsUserSuper(User user) { return IsUserSuper(user.Id); } public bool IsUserSuper(long userId) { return _superUsers.Contains(userId); } public string? GetUserCustomStatus(long userId) { return _statusMap.ContainsKey(userId) ? _statusMap[userId] : null; } } }