mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
fix: remove another bunch of obsolete method calls
This commit is contained in:
@@ -12,7 +12,7 @@ public static class BotExtension
|
||||
|
||||
if (victim != null && canUse)
|
||||
{
|
||||
var victimMember = await bot.GetChatMemberAsync(chat, victim.Id);
|
||||
var victimMember = await bot.GetChatMember(chat, victim.Id);
|
||||
canUse = victimMember is not ChatMemberOwner && victimMember is not ChatMemberAdministrator && !victim.IsBot;
|
||||
}
|
||||
|
||||
@@ -21,7 +21,7 @@ public static class BotExtension
|
||||
|
||||
public static async Task<bool> IsUserAdminAsync(this ITelegramBotClient bot, Chat chat, User user)
|
||||
{
|
||||
var callerMember = await bot.GetChatMemberAsync(chat, user.Id);
|
||||
var callerMember = await bot.GetChatMember(chat, user.Id);
|
||||
var isAdmin = callerMember is ChatMemberOwner;
|
||||
|
||||
if (callerMember is ChatMemberAdministrator callerAdmin)
|
||||
@@ -34,12 +34,12 @@ public static class BotExtension
|
||||
|
||||
public static async Task<bool> CanDeleteMessagesAsync(this ITelegramBotClient bot, Chat chat)
|
||||
{
|
||||
return await CanDeleteMessagesAsync(bot, chat, await bot.GetMeAsync());
|
||||
return await CanDeleteMessagesAsync(bot, chat, await bot.GetMe());
|
||||
}
|
||||
|
||||
public static async Task<bool> CanDeleteMessagesAsync(this ITelegramBotClient bot, Chat chat, User user)
|
||||
{
|
||||
return await bot.GetChatMemberAsync(chat.Id, user.Id) is ChatMemberOwner
|
||||
return await bot.GetChatMember(chat.Id, user.Id) is ChatMemberOwner
|
||||
or ChatMemberAdministrator {CanRestrictMembers: true};
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user