fix: build and lots of obsolete warnings

This commit is contained in:
Andriy
2025-02-09 17:40:03 +02:00
parent 8917a8ba5f
commit c3a553f68d
29 changed files with 103 additions and 108 deletions
+7 -8
View File
@@ -48,7 +48,7 @@ public class Handler : BotEventHandler
var memberList = tagDictionary.GetValueOrDefault(groupName, new List<long>());
if (memberList.Contains(fromId))
{
await Bot.SendTextMessageAsync(chatId, $"{from.ToHtml()} уже находится в группе {groupName}",
await Bot.SendMessage(chatId, $"{from.ToHtml()} уже находится в группе {groupName}",
parseMode: ParseMode.Html);
return;
}
@@ -58,8 +58,8 @@ public class Handler : BotEventHandler
userGroupOption.SetValue(tagDictionary);
_db.AddOrUpdate(userGroupOption);
_userCache.SetValue(repliedMessage.From.Id, repliedMessage.From, Int32.MaxValue);
await Bot.SendTextMessageAsync(chatId, $"{from.ToHtml()} добавлен в группу {groupName}",
_userCache.SetValue(repliedMessage.From.Id, repliedMessage.From, int.MaxValue);
await Bot.SendMessage(chatId, $"{from.ToHtml()} добавлен в группу {groupName}",
parseMode: ParseMode.Html);
}
@@ -89,16 +89,15 @@ public class Handler : BotEventHandler
msg.UserMention(await GetUser(userId, Chat)).Text(", ");
}
await Bot.SendTextMessageAsync(Chat.Id, msg.ToString().TrimEnd(',', ' '), parseMode: ParseMode.Html);
await Bot.SendMessage(Chat.Id, msg.ToString().TrimEnd(',', ' '), parseMode: ParseMode.Html);
}
protected async Task<User> GetUser(long userId, Chat chat)
{
User user;
if (!_userCache.TryGetValue(userId, out user))
if (!_userCache.TryGetValue(userId, out var user))
{
user = (await Bot.GetChatMemberAsync(Chat.Id, userId)).User;
_userCache.SetValue(userId, user, Int32.MaxValue);
user = (await Bot.GetChatMember(Chat.Id, userId)).User;
_userCache.SetValue(userId, user, int.MaxValue);
}
return user;