mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
31 lines
757 B
C#
31 lines
757 B
C#
|
|
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 List<long> _superUsers;
|
||
|
|
|
||
|
|
public UserService(IConfiguration configuration)
|
||
|
|
{
|
||
|
|
_superUsers = configuration.GetSection("SuperUsers")
|
||
|
|
.GetChildren()
|
||
|
|
.Select(q => Convert.ToInt64(q.Value))
|
||
|
|
.ToList();
|
||
|
|
}
|
||
|
|
|
||
|
|
public bool IsUserSuper(User user)
|
||
|
|
{
|
||
|
|
return IsUserSuper(user.Id);
|
||
|
|
}
|
||
|
|
|
||
|
|
public bool IsUserSuper(long userId)
|
||
|
|
{
|
||
|
|
return _superUsers.Contains(userId);
|
||
|
|
}
|
||
|
|
}
|
||
|
|
}
|