Skip to content

Commit

Permalink
Count callback queries too in handled messages
Browse files Browse the repository at this point in the history
Pietro di Caprio committed Jun 13, 2020
1 parent 234ee44 commit 3bf7daf
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Unifiedban.Terminal/Bot/Manager.cs
Original file line number Diff line number Diff line change
@@ -106,6 +106,8 @@ private static async void BotClient_OnCallbackQuery(object sender, CallbackQuery
{
if (e.CallbackQuery.Message.Date < DateTime.Now.AddDays(-1))
return;

await Task.Run(() => CacheData.IncrementHandledMessages());

if(CacheData.Groups[e.CallbackQuery.Message.Chat.Id].State !=
Models.Group.TelegramGroup.Status.Active) return;
@@ -135,6 +137,9 @@ private static async void BotClient_OnMessage(object sender, MessageEventArgs e)

if (e.Message.Date < DateTime.Now.AddDays(-1))
return;

await Task.Run(() => CacheData.IncrementHandledMessages());

if(CacheData.Groups.Keys.Contains(e.Message.Chat.Id))
if (CacheData.Groups[e.Message.Chat.Id].State !=
Models.Group.TelegramGroup.Status.Active &&
@@ -150,7 +155,6 @@ private static async void BotClient_OnMessage(object sender, MessageEventArgs e)
UserId = -1
});

await Task.Run(() => CacheData.IncrementHandledMessages());
await Task.Run(() => Functions.CacheUsername(e.Message));

if (e.Message.MigrateToChatId != 0)

0 comments on commit 3bf7daf

Please sign in to comment.