mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
[core] move core handlers into subfolder
This commit is contained in:
@@ -9,7 +9,7 @@ using Telegram.Bot;
|
||||
using Telegram.Bot.Types;
|
||||
using Telegram.Bot.Types.Enums;
|
||||
|
||||
namespace Kruzya.TelegramBot.Core
|
||||
namespace Kruzya.TelegramBot.Core.Handler
|
||||
{
|
||||
public abstract class CommonHandler : BotEventHandler
|
||||
{
|
||||
@@ -18,7 +18,7 @@ namespace Kruzya.TelegramBot.Core
|
||||
protected Message? Message => RawUpdate.Message;
|
||||
|
||||
protected User? RepliedUser => Message?.ReplyToMessage?.From;
|
||||
|
||||
|
||||
protected CommonHandler(CoreContext db)
|
||||
{
|
||||
Db = db;
|
||||
@@ -34,8 +34,8 @@ namespace Kruzya.TelegramBot.Core
|
||||
{
|
||||
return RepliedUser != null && await Bot.CanPunishMember(Chat, From, RepliedUser);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
protected async Task BanMember(long userId, DateTime banEnd)
|
||||
{
|
||||
await Bot.RestrictChatMemberAsync(
|
||||
@@ -48,7 +48,7 @@ namespace Kruzya.TelegramBot.Core
|
||||
banEnd
|
||||
);
|
||||
}
|
||||
|
||||
|
||||
protected async Task<BotUserValue> GetWarnOption(User user)
|
||||
{
|
||||
return await Db.UserValues.FindOrCreateOption(Chat.Id, user.Id, "warnCount");
|
||||
@@ -1,14 +1,12 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using BotFramework;
|
||||
using BotFramework.Attributes;
|
||||
using Kruzya.TelegramBot.Core.Data;
|
||||
using Kruzya.TelegramBot.Core.Extensions;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Telegram.Bot.Types;
|
||||
|
||||
namespace Kruzya.TelegramBot.Core
|
||||
namespace Kruzya.TelegramBot.Core.Handler
|
||||
{
|
||||
public class GeneralHandler : BotEventHandler
|
||||
{
|
||||
@@ -22,7 +20,7 @@ namespace Kruzya.TelegramBot.Core
|
||||
}
|
||||
|
||||
protected readonly CoreContext databaseContext;
|
||||
|
||||
|
||||
public GeneralHandler(CoreContext dbCtx)
|
||||
{
|
||||
databaseContext = dbCtx;
|
||||
@@ -32,7 +30,7 @@ namespace Kruzya.TelegramBot.Core
|
||||
[Priority(short.MaxValue - 10)]
|
||||
public async Task<bool> Listener()
|
||||
{
|
||||
foreach (var message in new Message[] {RawUpdate.Message, RawUpdate.EditedMessage, RawUpdate.ChannelPost, RawUpdate.EditedChannelPost})
|
||||
foreach (var message in new Message[] { RawUpdate.Message, RawUpdate.EditedMessage, RawUpdate.ChannelPost, RawUpdate.EditedChannelPost })
|
||||
{
|
||||
if (message == null)
|
||||
{
|
||||
@@ -4,9 +4,9 @@ using System;
|
||||
using System.Threading.Tasks;
|
||||
using BotFramework.Attributes;
|
||||
using BotFramework.Enums;
|
||||
using Kruzya.TelegramBot.Core;
|
||||
using Kruzya.TelegramBot.Core.Data;
|
||||
using Kruzya.TelegramBot.Core.Extensions;
|
||||
using Kruzya.TelegramBot.Core.Handler;
|
||||
using Telegram.Bot;
|
||||
using Telegram.Bot.Types;
|
||||
using Telegram.Bot.Types.Enums;
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
using Kruzya.TelegramBot.Core;
|
||||
using Kruzya.TelegramBot.Core.Data;
|
||||
using Kruzya.TelegramBot.Core.Data;
|
||||
using Kruzya.TelegramBot.Core.Handler;
|
||||
|
||||
namespace West.TelegramBot.ChatManagement.Handler;
|
||||
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
using System.Threading.Tasks;
|
||||
using BotFramework.Attributes;
|
||||
using BotFramework.Enums;
|
||||
using Kruzya.TelegramBot.Core;
|
||||
using Kruzya.TelegramBot.Core.Data;
|
||||
using Kruzya.TelegramBot.Core.Extensions;
|
||||
using Kruzya.TelegramBot.Core.Handler;
|
||||
using Telegram.Bot;
|
||||
using Telegram.Bot.Exceptions;
|
||||
using West.TelegramBot.ChatManagement.Service;
|
||||
|
||||
@@ -3,8 +3,8 @@
|
||||
using System.Threading.Tasks;
|
||||
using BotFramework.Attributes;
|
||||
using BotFramework.Enums;
|
||||
using Kruzya.TelegramBot.Core;
|
||||
using Kruzya.TelegramBot.Core.Data;
|
||||
using Kruzya.TelegramBot.Core.Handler;
|
||||
using West.TelegramBot.ChatManagement.Service;
|
||||
|
||||
namespace West.TelegramBot.ChatManagement.Handler;
|
||||
|
||||
@@ -3,9 +3,9 @@ using System;
|
||||
using System.Threading.Tasks;
|
||||
using BotFramework.Attributes;
|
||||
using BotFramework.Enums;
|
||||
using Kruzya.TelegramBot.Core;
|
||||
using Kruzya.TelegramBot.Core.Data;
|
||||
using Kruzya.TelegramBot.Core.Extensions;
|
||||
using Kruzya.TelegramBot.Core.Handler;
|
||||
using Kruzya.TelegramBot.Core.Service;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
using Telegram.Bot;
|
||||
|
||||
@@ -9,6 +9,7 @@ using Kruzya.TelegramBot.Core;
|
||||
using Kruzya.TelegramBot.Core.AutoDelete;
|
||||
using Kruzya.TelegramBot.Core.Data;
|
||||
using Kruzya.TelegramBot.Core.Extensions;
|
||||
using Kruzya.TelegramBot.Core.Handler;
|
||||
using Kruzya.TelegramBot.Core.Service;
|
||||
using Telegram.Bot;
|
||||
using Telegram.Bot.Types;
|
||||
|
||||
@@ -15,6 +15,7 @@ using System.Collections.Concurrent;
|
||||
using Telegram.Bot.Types.Enums;
|
||||
using Telegram.Bot.Types;
|
||||
using Microsoft.AspNetCore.Components.Forms;
|
||||
using Kruzya.TelegramBot.Core.Handler;
|
||||
|
||||
namespace West.Entertainment.Handler;
|
||||
|
||||
|
||||
@@ -3,9 +3,9 @@
|
||||
using BotFramework.Attributes;
|
||||
using BotFramework.Enums;
|
||||
using BotFramework.Utils;
|
||||
using Kruzya.TelegramBot.Core;
|
||||
using Kruzya.TelegramBot.Core.Data;
|
||||
using Kruzya.TelegramBot.Core.Extensions;
|
||||
using Kruzya.TelegramBot.Core.Handler;
|
||||
using Kruzya.TelegramBot.Core.Service;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Telegram.Bot;
|
||||
|
||||
Reference in New Issue
Block a user