mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
Whois command. Some refactorings.
This commit is contained in:
@@ -1,6 +1,9 @@
|
||||
using System.Threading.Tasks;
|
||||
#nullable enable
|
||||
|
||||
using System.Threading.Tasks;
|
||||
using BotFramework.Attributes;
|
||||
using BotFramework.Enums;
|
||||
using Kruzya.TelegramBot.Core.Data;
|
||||
using Telegram.Bot;
|
||||
using Telegram.Bot.Types;
|
||||
|
||||
@@ -8,12 +11,14 @@ namespace West.TelegramBot.ChatManagement.Handler
|
||||
{
|
||||
public class Ban : ManagementHandler
|
||||
{
|
||||
public Ban(CoreContext db) : base(db) {}
|
||||
|
||||
[Command("ban", CommandParseMode.Both)]
|
||||
public async Task HandleBan()
|
||||
{
|
||||
if (!await CanPunish()) return;
|
||||
|
||||
await BanMember(GetVictim());
|
||||
await BanMember(RepliedUser!);
|
||||
}
|
||||
|
||||
[Command("unban", CommandParseMode.Both)]
|
||||
@@ -21,7 +26,7 @@ namespace West.TelegramBot.ChatManagement.Handler
|
||||
{
|
||||
if (!await CanPunish()) return;
|
||||
|
||||
await Bot.RestrictChatMemberAsync(Chat.Id, GetVictim().Id,
|
||||
await Bot.RestrictChatMemberAsync(Chat.Id, RepliedUser!.Id,
|
||||
new ChatPermissions
|
||||
{
|
||||
CanSendMessages = true,
|
||||
|
||||
Reference in New Issue
Block a user