[code-watcher] init module.

This commit is contained in:
West14
2022-04-20 00:38:47 +03:00
parent 166363cd50
commit b58fe8b6e9
7 changed files with 128 additions and 1 deletions
+11
View File
@@ -31,5 +31,16 @@ namespace Kruzya.TelegramBot.Core.Extensions
return canUse;
}
public static async Task<bool> CanDeleteMessagesAsync(this ITelegramBotClient bot, Chat chat)
{
return await CanDeleteMessagesAsync(bot, chat, await bot.GetMeAsync());
}
public static async Task<bool> CanDeleteMessagesAsync(this ITelegramBotClient bot, Chat chat, User user)
{
return await bot.GetChatMemberAsync(chat.Id, user.Id) is ChatMemberOwner
or ChatMemberAdministrator {CanRestrictMembers: true};
}
}
}