Skip to content

Commit f69afda

Browse files
committed
Posts agora passam por aprovação
1 parent 3f2b93d commit f69afda

File tree

5 files changed

+113
-36
lines changed

5 files changed

+113
-36
lines changed

CypherBot.cs

+8-6
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,14 @@ private static void Main(string[] args)
2525
CultureInfo.CurrentCulture = ci;
2626
CultureInfo.CurrentUICulture = ci;
2727

28+
Data.ChannelPosts.LoadPostsData();
29+
Data.SorteioParticipantes.LoadParticipantesData();
30+
Data.MessagesToDelete.timerMessageToDeletesData.Elapsed += Data.MessagesToDelete.TimerMessageToDeletesData_Elapsed;
31+
Data.MessagesToDelete.LoadMessageToDeletesData();
32+
Data.MessagesToDelete.timerMessageToDeletesData.Start();
33+
34+
Thread.Sleep(1000);
35+
2836
User me = botClient.GetMeAsync().Result;
2937

3038
using var cts = new CancellationTokenSource();
@@ -38,12 +46,6 @@ private static void Main(string[] args)
3846

3947
Console.WriteLine($"Telegram Bot start listening for @{me.Username}");
4048

41-
Data.ChannelPosts.LoadPostsData();
42-
Data.SorteioParticipantes.LoadParticipantesData();
43-
Data.MessagesToDelete.timerMessageToDeletesData.Elapsed += Data.MessagesToDelete.TimerMessageToDeletesData_Elapsed;
44-
Data.MessagesToDelete.LoadMessageToDeletesData();
45-
Data.MessagesToDelete.timerMessageToDeletesData.Start();
46-
4749
while (true)
4850
{
4951
Console.ReadKey();

Props.cs

+4-2
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,12 @@ namespace CypherBot
55
{
66
internal class Props
77
{
8-
public static string telegramToken { get; set; } = "telegram_bot_token";
8+
public static string telegramToken { get; } = "1410185496:AAEm7sjfJnIn_GUOhRc1p1m5nZfQOUgat_8";
99
public static Int64 postChannelChatId { get; } = -1001399462961;
10+
public static Int64 postChannelPeneiraChatId { get; } = -1001417096675;
1011
public static string PostChannelInviteLink { get; } = "https://t.me/CypherpunksBrasil";
11-
public static string OfftopicGroupInviteLink { get; } = "https://t.me/+WromIg-zQmg4MDAx";
12+
public static string OfftopicGroupInviteLink { get; } = "https://t.me/+GMSf4a3JhZdlYmEx";
13+
public static string GrupoPrincipalInviteLink { get; } = "https://t.me/+Ti-3VBjgzwxkZmIx";
1214
public static Int64 moderatorGroupChatId { get; } = -1001153829050;
1315
public static Int64 grupoPrincipalChatId { get; } = -1001206367167;
1416
public static string dataPostsPatch { get; } = Directory.GetCurrentDirectory() + @"/data/posts.json";

Resources/Messages.cs

+4-3
Original file line numberDiff line numberDiff line change
@@ -11,15 +11,16 @@ internal class Messages
1111
public static InlineKeyboardMarkup replyMarkupChannelRating(Int64 chatID = 0, int messageID = 0)
1212
{
1313
string likeText = "👍";
14-
if (Data.ChannelPosts.posts.ContainsKey(chatID + ":" + messageID) && (Data.ChannelPosts.posts[chatID + ":" + messageID].PostLikes.Count > 0 || Data.ChannelPosts.posts[chatID + ":" + messageID].PostDislikes.Count > 0)) { likeText += " " + Data.ChannelPosts.posts[chatID + ":" + messageID].PostLikes.Count; }
14+
if (Data.ChannelPosts.posts != null && Data.ChannelPosts.posts.ContainsKey(chatID + ":" + messageID) && (Data.ChannelPosts.posts[chatID + ":" + messageID].PostLikes.Count > 0 || Data.ChannelPosts.posts[chatID + ":" + messageID].PostDislikes.Count > 0)) { likeText += " " + Data.ChannelPosts.posts[chatID + ":" + messageID].PostLikes.Count; }
1515

1616
string dislikeText = "🚫";
17-
if (Data.ChannelPosts.posts.ContainsKey(chatID + ":" + messageID) && (Data.ChannelPosts.posts[chatID + ":" + messageID].PostLikes.Count > 0 || Data.ChannelPosts.posts[chatID + ":" + messageID].PostDislikes.Count > 0)) { dislikeText += " " + Data.ChannelPosts.posts[chatID + ":" + messageID].PostDislikes.Count; }
17+
if (Data.ChannelPosts.posts != null && Data.ChannelPosts.posts.ContainsKey(chatID + ":" + messageID) && (Data.ChannelPosts.posts[chatID + ":" + messageID].PostLikes.Count > 0 || Data.ChannelPosts.posts[chatID + ":" + messageID].PostDislikes.Count > 0)) { dislikeText += " " + Data.ChannelPosts.posts[chatID + ":" + messageID].PostDislikes.Count; }
1818

1919
return new InlineKeyboardMarkup(new[]
2020
{
2121
InlineKeyboardButton.WithCallbackData(likeText, "ChannelPostLike"),
22-
InlineKeyboardButton.WithCallbackData(dislikeText, "ChannelPostDislike")
22+
InlineKeyboardButton.WithCallbackData(dislikeText, "ChannelPostDislike"),
23+
InlineKeyboardButton.WithUrl("💬 comentários", Props.GrupoPrincipalInviteLink)
2324
});
2425
}
2526
}

0 commit comments

Comments
 (0)