fix: remove another bunch of obsolete method calls

This commit is contained in:
Andriy
2025-02-09 17:50:46 +02:00
parent c3a553f68d
commit 50774e1af6
17 changed files with 40 additions and 40 deletions
+2 -2
View File
@@ -42,11 +42,11 @@ public class Ban : CommonHandler
}
catch
{
await Bot.SendTextMessageAsync(Chat.Id, "Нет прав на блокировку пользователя.");
await Bot.SendMessage(Chat.Id, "Нет прав на блокировку пользователя.");
return;
}
await Bot.SendTextMessageAsync(
await Bot.SendMessage(
Chat.Id,
$"{From.ToHtml()} <code>заблокировал</code> {RepliedUser!.ToHtml()} <code>{banEndMsg}</code>",
disableNotification: true, parseMode: ParseMode.Html);
@@ -38,7 +38,7 @@ public partial class BanStickerSet
var replyToMsgId = Message?.ReplyToMessage?.MessageId;
if (replyToMsgId != null)
{
await Bot.DeleteMessageAsync(Chat.Id, (int) replyToMsgId);
await Bot.DeleteMessage(Chat.Id, (int) replyToMsgId);
}
await Reply(FormatStickerSetAction(stickerSet.Set, "заблокирован"));
@@ -90,7 +90,7 @@ public partial class BanStickerSet
{
try
{
var stickerSet = await Bot.GetStickerSetAsync(list[i]);
var stickerSet = await Bot.GetStickerSet(list[i]);
htmlString.Text($"{i + 1}. ")
.Url("https://t.me/addstickers/" + stickerSet.Name, stickerSet.Title)
.Br();
@@ -125,7 +125,7 @@ public partial class BanStickerSet
"Этот набор стикеров заблокирован. Чтобы я мог его удалить, выдайте мне право на удаление сообщений.");
}
await Bot.DeleteMessageAsync(Chat.Id, message.MessageId);
await Bot.DeleteMessage(Chat.Id, message.MessageId);
}
}
}
@@ -14,9 +14,9 @@ public partial class BanStickerSet
{
private async Task<bool> CanBotDeleteMessages()
{
return await Bot.GetChatMemberAsync(
return await Bot.GetChatMember(
Chat.Id,
(await Bot.GetMeAsync()).Id
(await Bot.GetMe()).Id
) is ChatMemberAdministrator {CanDeleteMessages: true};
}
@@ -58,7 +58,7 @@ public partial class BanStickerSet
private async Task<bool> CanUseCommands()
{
return await Bot.GetChatMemberAsync(Chat.Id, From.Id) is ChatMemberAdministrator {CanDeleteMessages: true}
return await Bot.GetChatMember(Chat.Id, From.Id) is ChatMemberAdministrator {CanDeleteMessages: true}
or ChatMemberOwner;
}
}
+1 -1
View File
@@ -39,7 +39,7 @@ class Rules : CommonHandler
try
{
await Bot.CopyMessageAsync(Chat.Id, Chat.Id, await _rulesService.GetRulesMessageIdAsync(Chat) ?? 0);
await Bot.CopyMessage(Chat.Id, Chat.Id, await _rulesService.GetRulesMessageIdAsync(Chat) ?? 0);
}
catch (ApiRequestException)
{
+1 -1
View File
@@ -55,7 +55,7 @@ public class WhoIs : CommonHandler
return customStatus;
}
var chatMember = await Bot.GetChatMemberAsync(Chat.Id, user.Id);
var chatMember = await Bot.GetChatMember(Chat.Id, user.Id);
return chatMember.Status switch
{
ChatMemberStatus.Creator => "Владелец",