mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
Use the new version of TelegramBotFramework
This commit is contained in:
+1
-1
@@ -7,7 +7,7 @@
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="AleXr64.BotFramework" Version="0.0.17" />
|
||||
<PackageReference Include="AleXr64.BotFramework" Version="0.3.11" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="3.1.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Proxies" Version="3.1.2" />
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.1.2" />
|
||||
|
||||
@@ -20,6 +20,6 @@ namespace Kruzya.TelegramBot.Core.Data
|
||||
/// <summary>
|
||||
/// The Telegram User identifier.
|
||||
/// </summary>
|
||||
public int UserId { get; set; }
|
||||
public long UserId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -51,7 +51,7 @@ namespace Kruzya.TelegramBot.Core.Extensions
|
||||
|
||||
#region BotUser
|
||||
|
||||
public static async Task<BotUser> FindOrCreate(this DbSet<BotUser> repository, long chatId, int userId)
|
||||
public static async Task<BotUser> FindOrCreate(this DbSet<BotUser> 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<BotUserValue> FindOption(this DbSet<BotUserValue> repository, BotUser user,
|
||||
string option) => await repository.FindOption(user.ChatId, user.UserId, option);
|
||||
|
||||
public static async Task<BotUserValue> FindOption(this DbSet<BotUserValue> repository, long chatId, int userId,
|
||||
public static async Task<BotUserValue> FindOption(this DbSet<BotUserValue> 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<BotUserValue> FindOrCreateOption(this DbSet<BotUserValue> 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<T>(this DbSet<BotUserValue> repository, BotUser user, string option,
|
||||
T val) => await repository.SetOptionValue(user.ChatId, user.UserId, option, val);
|
||||
|
||||
public static async Task SetOptionValue<T>(this DbSet<BotUserValue> repository, long chatId, int userId,
|
||||
public static async Task SetOptionValue<T>(this DbSet<BotUserValue> repository, long chatId, long userId,
|
||||
string option, T val)
|
||||
{
|
||||
var opt = await repository.FindOrCreateOption(chatId, userId, option);
|
||||
|
||||
@@ -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()
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user