diff --git a/Core/Core.csproj b/Core/Core.csproj index d625025..a432284 100644 --- a/Core/Core.csproj +++ b/Core/Core.csproj @@ -7,7 +7,7 @@ - + diff --git a/Core/Data/BotUser.cs b/Core/Data/BotUser.cs index 621c45f..dcde794 100644 --- a/Core/Data/BotUser.cs +++ b/Core/Data/BotUser.cs @@ -20,6 +20,6 @@ namespace Kruzya.TelegramBot.Core.Data /// /// The Telegram User identifier. /// - public int UserId { get; set; } + public long UserId { get; set; } } } \ No newline at end of file diff --git a/Core/Extensions/RepositoryExtension.cs b/Core/Extensions/RepositoryExtension.cs index dc53846..db33374 100644 --- a/Core/Extensions/RepositoryExtension.cs +++ b/Core/Extensions/RepositoryExtension.cs @@ -51,7 +51,7 @@ namespace Kruzya.TelegramBot.Core.Extensions #region BotUser - public static async Task FindOrCreate(this DbSet repository, long chatId, int userId) + public static async Task FindOrCreate(this DbSet repository, long chatId, long userId) { var user = await repository.SingleOrDefaultAsync(e => e.ChatId == chatId && e.UserId == userId); if (user == null) @@ -76,7 +76,7 @@ namespace Kruzya.TelegramBot.Core.Extensions public static async Task FindOption(this DbSet repository, BotUser user, string option) => await repository.FindOption(user.ChatId, user.UserId, option); - public static async Task FindOption(this DbSet repository, long chatId, int userId, + public static async Task FindOption(this DbSet repository, long chatId, long userId, string option) => await repository.SingleOrDefaultAsync(e => e.BotUser.ChatId == chatId && e.BotUser.UserId == userId && e.Name == option); @@ -91,7 +91,7 @@ namespace Kruzya.TelegramBot.Core.Extensions string option) => await repository.FindOrCreateOption(user.ChatId, user.UserId, option); public static async Task FindOrCreateOption(this DbSet repository, long chatId, - int userId, string option) + long userId, string option) { var opt = await repository.FindOption(chatId, userId, option); if (opt == null) @@ -113,7 +113,7 @@ namespace Kruzya.TelegramBot.Core.Extensions public static async Task SetOptionValue(this DbSet repository, BotUser user, string option, T val) => await repository.SetOptionValue(user.ChatId, user.UserId, option, val); - public static async Task SetOptionValue(this DbSet repository, long chatId, int userId, + public static async Task SetOptionValue(this DbSet repository, long chatId, long userId, string option, T val) { var opt = await repository.FindOrCreateOption(chatId, userId, option); diff --git a/Core/GeneralHandler.cs b/Core/GeneralHandler.cs index 72bd5af..7c49bd0 100644 --- a/Core/GeneralHandler.cs +++ b/Core/GeneralHandler.cs @@ -53,7 +53,7 @@ namespace Kruzya.TelegramBot.Core await VerifyChatPair(chat.Id, user.Id); } - public async Task VerifyChatPair(long chat, int user) + public async Task VerifyChatPair(long chat, long user) { var hasEntry = await databaseContext.Users.AnyAsync(e => e.ChatId == chat && e.UserId == user); if (hasEntry) @@ -64,7 +64,7 @@ namespace Kruzya.TelegramBot.Core await MakeChatPair(chat, user); } - public async Task MakeChatPair(long chat, int user) + public async Task MakeChatPair(long chat, long user) { await databaseContext.Users.AddAsync(new BotUser() { diff --git a/modules/RichSiteSummary/Handler/FeedList.cs b/modules/RichSiteSummary/Handler/FeedList.cs index 943d7ca..134b293 100644 --- a/modules/RichSiteSummary/Handler/FeedList.cs +++ b/modules/RichSiteSummary/Handler/FeedList.cs @@ -72,11 +72,11 @@ namespace Kruzya.TelegramBot.RichSiteSummary.Handler var inlineButtons = new InlineKeyboardMarkup(buttons); if (message == null) { - await Bot.SendTextMessageAsync(new ChatId(chat.Id), text, ParseMode.Html, true, true, 0, inlineButtons); + await Bot.SendTextMessageAsync(new ChatId(chat.Id), text, ParseMode.Html, null, true, true, 0, replyMarkup: inlineButtons); } else { - await Bot.EditMessageTextAsync(chat, message.MessageId, text, ParseMode.Html, true, inlineButtons); + await Bot.EditMessageTextAsync(chat, message.MessageId, text, ParseMode.Html, null, true, replyMarkup: inlineButtons); } } @@ -88,7 +88,7 @@ namespace Kruzya.TelegramBot.RichSiteSummary.Handler { if (!(await GenerateMenu(query))) { - await Bot.SendTextMessageAsync(Chat, $"No one feed match by search pattern ({query}).", ParseMode.Html, true); + await Bot.SendTextMessageAsync(Chat, $"No one feed match by search pattern ({query}).", ParseMode.Html, null, true); } } @@ -195,11 +195,11 @@ namespace Kruzya.TelegramBot.RichSiteSummary.Handler if (editableMessage == null) { await Bot.SendTextMessageAsync(Chat, "Select the feed for viewing details", ParseMode.Default, - true, true, 0, new InlineKeyboardMarkup(buttons)); + null, true, true, 0, replyMarkup: new InlineKeyboardMarkup(buttons)); } else { - await Bot.EditMessageTextAsync(editableMessage.Chat, editableMessage.MessageId, "Select the feed for viewing details", ParseMode.Default, false, + await Bot.EditMessageTextAsync(editableMessage.Chat, editableMessage.MessageId, "Select the feed for viewing details", ParseMode.Default, null, false, new InlineKeyboardMarkup(buttons)); } @@ -272,7 +272,7 @@ namespace Kruzya.TelegramBot.RichSiteSummary.Handler } await Bot.SendTextMessageAsync(RawUpdate.CallbackQuery.Message.Chat, messageTextBuilder.ToString(), - ParseMode.Html, true); + ParseMode.Html, null, true); break; } diff --git a/modules/RichSiteSummary/Service/MessageSender.cs b/modules/RichSiteSummary/Service/MessageSender.cs index 8b67760..c79a8fa 100644 --- a/modules/RichSiteSummary/Service/MessageSender.cs +++ b/modules/RichSiteSummary/Service/MessageSender.cs @@ -40,11 +40,11 @@ namespace Kruzya.TelegramBot.RichSiteSummary.Service try { if (string.IsNullOrWhiteSpace(message.ImageUrl)) - await _bot.BotClient.SendTextMessageAsync(message.ChatId, message.Text, message.ParseMode, + await _bot.BotClient.SendTextMessageAsync(message.ChatId, message.Text, message.ParseMode, null, message.DisableWebPagePreview); else await _bot.BotClient.SendPhotoAsync(message.ChatId, message.ImageUrl, message.Text, - message.ParseMode, message.DisableWebPagePreview); + message.ParseMode, null, message.DisableWebPagePreview); } catch (ApiRequestException e) { diff --git a/modules/UrlLimitations/MessageExtension.cs b/modules/UrlLimitations/MessageExtension.cs index e2ce906..def68f9 100644 --- a/modules/UrlLimitations/MessageExtension.cs +++ b/modules/UrlLimitations/MessageExtension.cs @@ -15,7 +15,7 @@ namespace Kruzya.TelegramBot.UrlLimitations foreach (var mention in message.Entities.Where(e => e.Type == MessageEntityType.Mention || e.Type == MessageEntityType.TextMention)) { - var userId = 0; + long userId = 0; if (mention.Type == MessageEntityType.TextMention) { userId = mention.User.Id; @@ -34,10 +34,10 @@ namespace Kruzya.TelegramBot.UrlLimitations return true; } - userId = Convert.ToInt32(chat.Id); + userId = Convert.ToInt64(chat.Id); } } - catch (Exception e) + catch (Exception) { return true; }