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:
@@ -23,7 +23,7 @@ public static class MessageExtension
|
||||
{
|
||||
try
|
||||
{
|
||||
var chat = await bot.GetChatAsync(
|
||||
var chat = await bot.GetChat(
|
||||
new ChatId(message.Text.Substring(mention.Offset, mention.Length)));
|
||||
|
||||
if (chat != null)
|
||||
@@ -42,7 +42,7 @@ public static class MessageExtension
|
||||
}
|
||||
}
|
||||
|
||||
var status = (await bot.GetChatMemberAsync(message.Chat, userId)).Status;
|
||||
var status = (await bot.GetChatMember(message.Chat, userId)).Status;
|
||||
|
||||
if ((new ChatMemberStatus[]
|
||||
{
|
||||
|
||||
@@ -8,7 +8,6 @@ using Kruzya.TelegramBot.Core.Data;
|
||||
using Kruzya.TelegramBot.Core.Extensions;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Telegram.Bot;
|
||||
using Telegram.Bot.Types;
|
||||
using Telegram.Bot.Types.Enums;
|
||||
|
||||
namespace Kruzya.TelegramBot.UrlLimitations;
|
||||
@@ -46,11 +45,11 @@ public class MessageHandler : BotEventHandler
|
||||
if (message.Entities.Count(e => e.Type == MessageEntityType.Url || e.Type == MessageEntityType.TextLink) >
|
||||
0 || await message.HasUnknownMention(Bot))
|
||||
{
|
||||
var targetChat = new ChatId(Chat.Id);
|
||||
var targetChat = Chat.Id;
|
||||
Task.WaitAll(
|
||||
Bot.BanChatMemberAsync(new ChatId(Chat.Id), From.Id, DateTime.Now.AddDays(1)),
|
||||
Bot.DeleteMessageAsync(targetChat, message.MessageId),
|
||||
Bot.SendTextMessageAsync(targetChat,
|
||||
Bot.BanChatMember(targetChat, From.Id, DateTime.Now.AddDays(1)),
|
||||
Bot.DeleteMessage(targetChat, message.MessageId),
|
||||
Bot.SendMessage(targetChat,
|
||||
$"Member {From.ToHtml(true)} has been banned.\n<b>Reason</b>: <pre>Spam suspicion</pre>", parseMode: ParseMode.Html)
|
||||
);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user