コード例 #1
0
ファイル: AdminUtil.cs プロジェクト: WinTenDev/ZiziBot.NET
    public static async Task <bool> IsAdminChat(
        this ITelegramBotClient botClient,
        long chatId,
        long userId
        )
    {
        var sw = Stopwatch.StartNew();

        var chatMembers = await botClient.GetChatAdmin(chatId);

        var isAdmin = chatMembers.Any(admin => userId == admin.User.Id);

        Log.Debug("Check UserID {V} Admin on Chat {V1}? {V2}. Time: {V3}", userId, chatId, isAdmin, sw.Elapsed);

        sw.Stop();

        return(isAdmin);
    }