@@ -9,7 +9,7 @@ class Program
99 {
1010 static async Task Main ( )
1111 {
12- var fbApiAddress = "https://graph.facebook.com/v8 .0/" ;
12+ var fbApiAddress = "https://graph.facebook.com/v11 .0/" ;
1313 Console . Write ( "Введите access token:" ) ;
1414 var token = Console . ReadLine ( ) ;
1515 var cs = new ConnectSettings ( ) { Token = token } ;
@@ -22,25 +22,49 @@ static async Task Main()
2222 {
2323 Console . WriteLine ( $ "{ i + 1 } . { posts [ i ] . Item2 } ") ;
2424 }
25+ Console . WriteLine ( "Q. Прокомментировать все посты" ) ;
2526 Console . Write ( "Выберите пост:" ) ;
26- var index = int . Parse ( Console . ReadLine ( ) ) - 1 ;
27- var postId = posts [ index ] . Item1 ;
28- var comments = CommentsHelper . GetComments ( ) ;
29- Console . WriteLine ( $ "Найдено { comments . Count } комментариев!") ;
30- await BulkHelper . BulkProcessAsync ( fbApiAddress , async ( re , cs ) =>
31- {
32- if ( comments . Count == 0 )
33- {
34- Console . WriteLine ( "Комментарии кончились!" ) ;
35- return ;
27+ var user_input = Console . ReadLine ( ) ;
28+ if ( user_input . Equals ( "Q" ) || user_input . Equals ( "q" ) ) {
29+ for ( var index = 0 ; index < posts . Count ; index ++ ) {
30+ var postId = posts [ index ] . Item1 ;
31+ var comments = CommentsHelper . GetComments ( ) ;
32+ Console . WriteLine ( $ "Найдено { comments . Count } комментариев!") ;
33+ await BulkHelper . BulkProcessAsync ( fbApiAddress , async ( re , cs ) =>
34+ {
35+ if ( comments . Count == 0 )
36+ {
37+ Console . WriteLine ( "Комментарии кончились!" ) ;
38+ return ;
39+ }
40+ var c = comments [ 0 ] ;
41+ comments . RemoveAt ( 0 ) ;
42+ Console . WriteLine ( $ "Оставляем коммент:{ c } ") ;
43+ var cm = new CommentsManager ( re ) ;
44+ await cm . AddCommentAsync ( c , postId ) ;
45+ } ) ;
3646 }
37- var c = comments [ 0 ] ;
38- comments . RemoveAt ( 0 ) ;
39- Console . WriteLine ( $ "Оставляем коммент:{ c } ") ;
40- var cm = new CommentsManager ( re ) ;
41- await cm . AddCommentAsync ( c , postId ) ;
42- } ) ;
43- Console . ReadKey ( ) ;
47+ Console . ReadKey ( ) ;
48+ } else {
49+ var index = int . Parse ( user_input ) - 1 ;
50+ var postId = posts [ index ] . Item1 ;
51+ var comments = CommentsHelper . GetComments ( ) ;
52+ Console . WriteLine ( $ "Найдено { comments . Count } комментариев!") ;
53+ await BulkHelper . BulkProcessAsync ( fbApiAddress , async ( re , cs ) =>
54+ {
55+ if ( comments . Count == 0 )
56+ {
57+ Console . WriteLine ( "Комментарии кончились!" ) ;
58+ return ;
59+ }
60+ var c = comments [ 0 ] ;
61+ comments . RemoveAt ( 0 ) ;
62+ Console . WriteLine ( $ "Оставляем коммент:{ c } ") ;
63+ var cm = new CommentsManager ( re ) ;
64+ await cm . AddCommentAsync ( c , postId ) ;
65+ } ) ;
66+ Console . ReadKey ( ) ;
67+ }
4468 }
4569 }
4670}
0 commit comments