mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
fix: build and lots of obsolete warnings
This commit is contained in:
@@ -12,6 +12,7 @@ using Telegram.Bot;
|
||||
using Telegram.Bot.Types;
|
||||
using Telegram.Bot.Types.Enums;
|
||||
using Telegram.Bot.Types.ReplyMarkups;
|
||||
using static Microsoft.EntityFrameworkCore.DbLoggerCategory;
|
||||
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary.Handler;
|
||||
|
||||
@@ -71,11 +72,12 @@ public class FeedList : AbstractHandler
|
||||
var inlineButtons = new InlineKeyboardMarkup(buttons);
|
||||
if (message == null)
|
||||
{
|
||||
await Bot.SendTextMessageAsync(new ChatId(chat.Id), text, 0, ParseMode.Html, null, true, true, false, 0, replyMarkup: inlineButtons);
|
||||
await Bot.SendMessage(chat, text, ParseMode.Html, linkPreviewOptions: true,
|
||||
disableNotification: true, replyMarkup: inlineButtons);
|
||||
}
|
||||
else
|
||||
{
|
||||
await Bot.EditMessageTextAsync(chat, message.MessageId, text, ParseMode.Html, null, true, replyMarkup: inlineButtons);
|
||||
await Bot.EditMessageText(chat, message.MessageId, text, ParseMode.Html, linkPreviewOptions: true, replyMarkup: inlineButtons);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -87,7 +89,8 @@ public class FeedList : AbstractHandler
|
||||
{
|
||||
if (!(await GenerateMenu(query)))
|
||||
{
|
||||
await Bot.SendTextMessageAsync(Chat, $"No one feed match by search pattern (<code>{query}</code>).", 0, ParseMode.Html, null, true);
|
||||
await Bot.SendMessage(Chat, $"No one feed match by search pattern (<code>{query}</code>).", ParseMode.Html,
|
||||
linkPreviewOptions: true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -96,8 +99,7 @@ public class FeedList : AbstractHandler
|
||||
{
|
||||
if (!(await GenerateMenu(":sub")))
|
||||
{
|
||||
await Bot.SendTextMessageAsync(Chat,
|
||||
"There are no one subscription. Add new with /feed_list or /feed_search.");
|
||||
await Bot.SendMessage(Chat, "There are no one subscription. Add new with /feed_list or /feed_search.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -191,13 +193,13 @@ public class FeedList : AbstractHandler
|
||||
|
||||
if (editableMessage == null)
|
||||
{
|
||||
await Bot.SendTextMessageAsync(Chat, "Select the feed for viewing details", 0, null,
|
||||
null, true, true, false, 0, replyMarkup: new InlineKeyboardMarkup(buttons));
|
||||
await Bot.SendMessage(Chat, "Select the feed for viewing details", linkPreviewOptions: true,
|
||||
disableNotification: true, replyMarkup: new InlineKeyboardMarkup(buttons));
|
||||
}
|
||||
else
|
||||
{
|
||||
await Bot.EditMessageTextAsync(editableMessage.Chat, editableMessage.MessageId, "Select the feed for viewing details", null, null, false,
|
||||
new InlineKeyboardMarkup(buttons));
|
||||
await Bot.EditMessageText(editableMessage.Chat, editableMessage.MessageId,
|
||||
"Select the feed for viewing details", replyMarkup: new InlineKeyboardMarkup(buttons));
|
||||
}
|
||||
|
||||
return true;
|
||||
@@ -219,7 +221,7 @@ public class FeedList : AbstractHandler
|
||||
var fromId = Int64.Parse(data[1]);
|
||||
if (fromId != From.Id)
|
||||
{
|
||||
await Bot.AnswerCallbackQueryAsync(RawUpdate.CallbackQuery.Id,
|
||||
await Bot.AnswerCallbackQuery(RawUpdate.CallbackQuery.Id,
|
||||
"You can't perform this action: command called by another user.", true);
|
||||
return;
|
||||
}
|
||||
@@ -238,13 +240,13 @@ public class FeedList : AbstractHandler
|
||||
case "do":
|
||||
if (RawUpdate.CallbackQuery.From.Id != RawUpdate.CallbackQuery.Message.Chat.Id)
|
||||
{
|
||||
var userStatus = (await Bot.GetChatMemberAsync(RawUpdate.CallbackQuery.Message.Chat, RawUpdate.CallbackQuery.From.Id)).Status;
|
||||
var userStatus = (await Bot.GetChatMember(RawUpdate.CallbackQuery.Message.Chat, RawUpdate.CallbackQuery.From.Id)).Status;
|
||||
var allowedUserStatuses = new ChatMemberStatus[]
|
||||
{ChatMemberStatus.Administrator, ChatMemberStatus.Creator};
|
||||
|
||||
if (!allowedUserStatuses.Contains(userStatus))
|
||||
{
|
||||
await Bot.AnswerCallbackQueryAsync(RawUpdate.CallbackQuery.Id,
|
||||
await Bot.AnswerCallbackQuery(RawUpdate.CallbackQuery.Id,
|
||||
"You can't perform this action: you don't have administrator permissions.", true);
|
||||
return;
|
||||
}
|
||||
@@ -268,12 +270,12 @@ public class FeedList : AbstractHandler
|
||||
idx++;
|
||||
}
|
||||
|
||||
await Bot.SendTextMessageAsync(RawUpdate.CallbackQuery.Message.Chat, messageTextBuilder.ToString(),
|
||||
0, ParseMode.Html, null, true);
|
||||
await Bot.SendMessage(RawUpdate.CallbackQuery.Message.Chat, messageTextBuilder.ToString(),
|
||||
ParseMode.Html, linkPreviewOptions: true);
|
||||
break;
|
||||
}
|
||||
|
||||
await Bot.AnswerCallbackQueryAsync(RawUpdate.CallbackQuery.Id);
|
||||
await Bot.AnswerCallbackQuery(RawUpdate.CallbackQuery.Id);
|
||||
}
|
||||
|
||||
protected async Task ChangeFeedSubscription(Guid feedId, Chat chat, User from, Message message)
|
||||
|
||||
@@ -31,6 +31,6 @@ public class StatsHandler : AbstractHandler
|
||||
textMessage.Append(
|
||||
$"- exists <b>{subscriptionsCount} subscriptions on feeds</b> (<b>unique subscribers: {uniqueSubscribers}</b>)");
|
||||
|
||||
await Bot.SendTextMessageAsync(Chat, textMessage.ToString(), parseMode: ParseMode.Html);
|
||||
await Bot.SendMessage(Chat, textMessage.ToString(), parseMode: ParseMode.Html);
|
||||
}
|
||||
}
|
||||
@@ -36,14 +36,12 @@ public class MessageSender : AbstractTimedHostedService
|
||||
{
|
||||
if (string.IsNullOrWhiteSpace(message.ImageUrl))
|
||||
{
|
||||
await _bot.BotClient.SendTextMessageAsync(message.ChatId, message.Text, 0, message.ParseMode, null,
|
||||
message.DisableWebPagePreview);
|
||||
await _bot.BotClient.SendMessage(message.ChatId, message.Text, message.ParseMode, linkPreviewOptions: message.DisableWebPagePreview);
|
||||
}
|
||||
|
||||
else
|
||||
{
|
||||
await _bot.BotClient.SendPhotoAsync(message.ChatId, new InputFileUrl(message.ImageUrl), 0, message.Text,
|
||||
message.ParseMode, null, false, message.DisableWebPagePreview);
|
||||
await _bot.BotClient.SendPhoto(message.ChatId, new InputFileUrl(message.ImageUrl), message.Text, message.ParseMode);
|
||||
}
|
||||
}
|
||||
catch (ApiRequestException e)
|
||||
|
||||
Reference in New Issue
Block a user