mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
33 lines
883 B
C#
33 lines
883 B
C#
using System.Threading.Tasks;
|
|
using BotFramework.Attributes;
|
|
using BotFramework.Enums;
|
|
using Kruzya.TelegramBot.Core.Data;
|
|
using Kruzya.TelegramBot.Core.Handler;
|
|
using West.TelegramBot.ChatManagement.Service;
|
|
|
|
namespace West.TelegramBot.ChatManagement.Handler;
|
|
|
|
public class Warn : CommonHandler
|
|
{
|
|
private readonly WarnService _warnService;
|
|
public Warn(CoreContext db, WarnService warnService) : base(db)
|
|
{
|
|
_warnService = warnService;
|
|
}
|
|
|
|
[Command("warn", CommandParseMode.Both)]
|
|
public async Task HandleWarn()
|
|
{
|
|
if (!await CanPunish()) return;
|
|
|
|
await _warnService.WarnChatUserAsync(Chat, From, RepliedUser!);
|
|
}
|
|
|
|
[Command("unwarn", CommandParseMode.Both)]
|
|
public async Task HandleUnwarn()
|
|
{
|
|
if (!await CanPunish()) return;
|
|
|
|
await _warnService.UnWarnChatUserAsync(Chat, From, RepliedUser!);
|
|
}
|
|
} |