Files

35 lines
901 B
C#
Raw Permalink Normal View History

2021-12-27 22:53:13 +02:00
#nullable enable
using System.Threading.Tasks;
using BotFramework.Attributes;
using BotFramework.Enums;
using Kruzya.TelegramBot.Core.Data;
2023-07-20 21:22:35 +03:00
using Kruzya.TelegramBot.Core.Handler;
2022-05-05 13:26:17 +03:00
using West.TelegramBot.ChatManagement.Service;
2022-02-14 10:35:28 +02:00
namespace West.TelegramBot.ChatManagement.Handler;
public class Warn : CommonHandler
{
2022-05-05 13:26:17 +03:00
private readonly WarnService _warnService;
public Warn(CoreContext db, WarnService warnService) : base(db)
{
_warnService = warnService;
}
2021-12-27 22:53:13 +02:00
2022-02-14 10:35:28 +02:00
[Command("warn", CommandParseMode.Both)]
public async Task HandleWarn()
{
if (!await CanPunish()) return;
2022-05-05 13:26:17 +03:00
await _warnService.WarnChatUserAsync(Chat, From, RepliedUser!);
2022-02-14 10:35:28 +02:00
}
2022-02-14 10:35:28 +02:00
[Command("unwarn", CommandParseMode.Both)]
public async Task HandleUnwarn()
{
if (!await CanPunish()) return;
2022-05-05 13:26:17 +03:00
await _warnService.UnWarnChatUserAsync(Chat, From, RepliedUser!);
}
}