-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathProgram.cs
More file actions
46 lines (45 loc) · 1.72 KB
/
Program.cs
File metadata and controls
46 lines (45 loc) · 1.72 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
using FB.QuickCommenter.Helpers;
using FB.QuickCommenter.Model;
using System;
using System.Threading.Tasks;
namespace FB.QuickCommenter
{
class Program
{
static async Task Main()
{
var fbApiAddress = "https://graph.facebook.com/v8.0/";
Console.Write("Введите access token:");
var token = Console.ReadLine();
var cs = new ConnectSettings() { Token = token };
ProxyHelper.FillProxy(cs);
var re = new RequestExecutor(fbApiAddress, cs);
var fpm = new FanPageManager(re);
var fp = await fpm.SelectFanPageAsync();
var posts = await fpm.GetPostIdsAsync(fp.Id, fp.Token);
for (var i = 0; i < posts.Count; i++)
{
Console.WriteLine($"{i + 1}. {posts[i].Item2}");
}
Console.Write("Выберите пост:");
var index = int.Parse(Console.ReadLine()) - 1;
var postId = posts[index].Item1;
var comments = CommentsHelper.GetComments();
Console.WriteLine($"Найдено {comments.Count} комментариев!");
await BulkHelper.BulkProcessAsync(fbApiAddress, async (re, cs) =>
{
if (comments.Count == 0)
{
Console.WriteLine("Комментарии кончились!");
return;
}
var c = comments[0];
comments.RemoveAt(0);
Console.WriteLine($"Оставляем коммент:{c}");
var cm = new CommentsManager(re);
await cm.AddCommentAsync(c, postId);
});
Console.ReadKey();
}
}
}