2022-05-05 13:30:59 +03:00
|
|
|
|
using Kruzya.TelegramBot.Core.Extensions;
|
|
|
|
|
|
using Telegram.Bot;
|
|
|
|
|
|
using Telegram.Bot.Types;
|
|
|
|
|
|
using Telegram.Bot.Types.Enums;
|
|
|
|
|
|
|
|
|
|
|
|
namespace West.TelegramBot.ChatManagement;
|
2022-05-05 13:26:17 +03:00
|
|
|
|
|
|
|
|
|
|
public class Notifier
|
|
|
|
|
|
{
|
|
|
|
|
|
public static async void WarnNotify(ITelegramBotClient bot, Chat chat, User from, User to, int count, bool isBanned = false)
|
|
|
|
|
|
{
|
|
|
|
|
|
await bot.SendTextMessageAsync(chat.Id, $"{to.ToHtml()}<code>, Вам выдано предупреждение! " +
|
|
|
|
|
|
$"Текущее кол-во: {count}/3</code>",
|
|
|
|
|
|
disableNotification: true,
|
|
|
|
|
|
parseMode: ParseMode.Html);
|
|
|
|
|
|
|
|
|
|
|
|
if (isBanned)
|
|
|
|
|
|
{
|
|
|
|
|
|
await bot.SendTextMessageAsync(
|
|
|
|
|
|
chat.Id,
|
|
|
|
|
|
$"{from.ToHtml()} <code>заблокировал</code> {to.ToHtml()} <code>на 7 дней</code>",
|
|
|
|
|
|
disableNotification: true, parseMode: ParseMode.Html);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public static async void UnWarnNotify(ITelegramBotClient bot, Chat chat, User from, User to, int count)
|
|
|
|
|
|
{
|
|
|
|
|
|
await bot.SendTextMessageAsync(chat.Id,
|
|
|
|
|
|
$"{to.ToHtml()}<code>, с Вас снято предупреждение! " +
|
|
|
|
|
|
$"Текущее кол-во: {count}/3</code>",
|
|
|
|
|
|
disableNotification: true,
|
|
|
|
|
|
parseMode: ParseMode.Html);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|