mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
[whois] Add chatmember status to output. Update .gitignore.
This commit is contained in:
@@ -1,21 +1,30 @@
|
||||
using System;
|
||||
#nullable enable
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using SQLitePCL;
|
||||
using Telegram.Bot.Types;
|
||||
|
||||
namespace Kruzya.TelegramBot.Core.Service
|
||||
{
|
||||
public class UserService
|
||||
{
|
||||
private List<long> _superUsers;
|
||||
|
||||
private readonly List<long> _superUsers;
|
||||
|
||||
private readonly Dictionary<long, string> _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)
|
||||
@@ -27,5 +36,10 @@ namespace Kruzya.TelegramBot.Core.Service
|
||||
{
|
||||
return _superUsers.Contains(userId);
|
||||
}
|
||||
|
||||
public string? GetUserCustomStatus(long userId)
|
||||
{
|
||||
return _statusMap.ContainsKey(userId) ? _statusMap[userId] : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user