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:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user