[cas] use file-scoped namespaces

This commit is contained in:
Andriy
2023-07-28 19:34:28 +03:00
parent c8951aad45
commit 7aed09c87c
5 changed files with 88 additions and 93 deletions
@@ -1,10 +1,10 @@
using System;
using Newtonsoft.Json;
namespace Kruzya.TelegramBot.CombotAntiSpam.Combot
namespace Kruzya.TelegramBot.CombotAntiSpam.Combot;
internal class CombotApiResponse
{
internal class CombotApiResponse
{
public class ApiResult
{
[JsonProperty("messages")]
@@ -27,5 +27,4 @@ namespace Kruzya.TelegramBot.CombotAntiSpam.Combot
[JsonProperty("result")]
public ApiResult Result { get; set; }
}
}
@@ -4,10 +4,10 @@ using System.Threading.Tasks;
using Kruzya.TelegramBot.Core.Extensions;
using Telegram.Bot.Types;
namespace Kruzya.TelegramBot.CombotAntiSpam.Combot
namespace Kruzya.TelegramBot.CombotAntiSpam.Combot;
public class CombotClient : ICombotClient
{
public class CombotClient : ICombotClient
{
public HttpClient _HttpClient;
public CombotClient()
@@ -26,5 +26,4 @@ namespace Kruzya.TelegramBot.CombotAntiSpam.Combot
var result = await _HttpClient.GetJsonAsync<CombotApiResponse>($"?user_id={user.Id}");
return result.IsSpammer;
}
}
}
@@ -1,11 +1,10 @@
using System.Threading.Tasks;
using Telegram.Bot.Types;
namespace Kruzya.TelegramBot.CombotAntiSpam.Combot
namespace Kruzya.TelegramBot.CombotAntiSpam.Combot;
public interface ICombotClient
{
public interface ICombotClient
{
public bool IsSpammer(User user);
public Task<bool> IsSpammerAsync(User user);
}
}
+3 -4
View File
@@ -2,10 +2,10 @@
using Kruzya.TelegramBot.Core;
using Microsoft.Extensions.DependencyInjection;
namespace Kruzya.TelegramBot.CombotAntiSpam
namespace Kruzya.TelegramBot.CombotAntiSpam;
public class CombotAntiSpam : Module
{
public class CombotAntiSpam : Module
{
public CombotAntiSpam(Core.Core core) : base(core)
{
}
@@ -14,5 +14,4 @@ namespace Kruzya.TelegramBot.CombotAntiSpam
{
services.AddSingleton<ICombotClient, CombotClient>();
}
}
}
+3 -4
View File
@@ -11,10 +11,10 @@ using Telegram.Bot;
using Telegram.Bot.Types;
using Telegram.Bot.Types.Enums;
namespace Kruzya.TelegramBot.CombotAntiSpam
namespace Kruzya.TelegramBot.CombotAntiSpam;
public class UserJoinHandler : BotEventHandler
{
public class UserJoinHandler : BotEventHandler
{
protected ICombotClient _combotClient;
protected ILogger _logger;
@@ -57,5 +57,4 @@ namespace Kruzya.TelegramBot.CombotAntiSpam
}
}
}
}
}