mirror of
https://github.com/Bubuni-Team/telegram-bot.git
synced 2026-07-31 00:29:24 +03:00
Use file-scoped namespaces
This commit is contained in:
@@ -1,9 +1,8 @@
|
||||
namespace Kruzya.TelegramBot.Core.Cache
|
||||
{
|
||||
namespace Kruzya.TelegramBot.Core.Cache;
|
||||
|
||||
public interface ICacheStorage<TKey, TValue>
|
||||
{
|
||||
public bool TryGetValue(TKey key, out TValue value);
|
||||
public void SetValue(TKey key, TValue value, int timeToLive);
|
||||
public TValue GetOr(TKey key, TValue value);
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,8 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Threading;
|
||||
|
||||
namespace Kruzya.TelegramBot.Core.Cache
|
||||
{
|
||||
namespace Kruzya.TelegramBot.Core.Cache;
|
||||
|
||||
public class MemoryCache<TKey, TValue> : ICacheStorage<TKey, TValue>
|
||||
{
|
||||
/// <summary>
|
||||
@@ -101,4 +101,3 @@ namespace Kruzya.TelegramBot.Core.Cache
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -7,8 +7,8 @@ using System.Linq;
|
||||
using System.Reflection;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
namespace Kruzya.TelegramBot.Core
|
||||
{
|
||||
namespace Kruzya.TelegramBot.Core;
|
||||
|
||||
public sealed class Core
|
||||
{
|
||||
/// <summary>
|
||||
@@ -204,4 +204,3 @@ namespace Kruzya.TelegramBot.Core
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,8 +1,8 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Kruzya.TelegramBot.Core.Data
|
||||
{
|
||||
namespace Kruzya.TelegramBot.Core.Data;
|
||||
|
||||
public class BotUser
|
||||
{
|
||||
/// <summary>
|
||||
@@ -21,4 +21,3 @@ namespace Kruzya.TelegramBot.Core.Data
|
||||
/// </summary>
|
||||
public long UserId { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,8 @@ using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace Kruzya.TelegramBot.Core.Data
|
||||
{
|
||||
namespace Kruzya.TelegramBot.Core.Data;
|
||||
|
||||
public class BotUserValue
|
||||
{
|
||||
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
||||
@@ -38,4 +38,3 @@ namespace Kruzya.TelegramBot.Core.Data
|
||||
ValueType = value.GetType().FullName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
using Kruzya.TelegramBot.Core.EF;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Kruzya.TelegramBot.Core.Data
|
||||
{
|
||||
namespace Kruzya.TelegramBot.Core.Data;
|
||||
|
||||
public class CoreContext : AutoSaveDbContext
|
||||
{
|
||||
/// <summary>
|
||||
@@ -22,4 +22,3 @@ namespace Kruzya.TelegramBot.Core.Data
|
||||
Database.Migrate();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,8 @@
|
||||
using BotFramework;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Kruzya.TelegramBot.Core
|
||||
{
|
||||
namespace Kruzya.TelegramBot.Core;
|
||||
|
||||
/// <summary>
|
||||
/// Resolves the GUIDs from database to entities.
|
||||
/// </summary>
|
||||
@@ -38,4 +38,3 @@ namespace Kruzya.TelegramBot.Core
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,8 @@
|
||||
using Telegram.Bot;
|
||||
using Telegram.Bot.Types;
|
||||
|
||||
namespace Kruzya.TelegramBot.Core.Extensions
|
||||
{
|
||||
namespace Kruzya.TelegramBot.Core.Extensions;
|
||||
|
||||
public static class BotExtension
|
||||
{
|
||||
public static async Task<bool> CanPunishMember(this ITelegramBotClient bot, Chat chat, User user, User victim = null)
|
||||
@@ -43,4 +43,3 @@ namespace Kruzya.TelegramBot.Core.Extensions
|
||||
or ChatMemberAdministrator {CanRestrictMembers: true};
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,8 @@ using System.Net.Http;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Kruzya.TelegramBot.Core.Extensions
|
||||
{
|
||||
namespace Kruzya.TelegramBot.Core.Extensions;
|
||||
|
||||
public static class HttpClientExtension
|
||||
{
|
||||
public static async Task<T> GetJsonAsync<T>(this HttpClient client, Uri requestUri)
|
||||
@@ -19,4 +19,3 @@ namespace Kruzya.TelegramBot.Core.Extensions
|
||||
return JsonConvert.DeserializeObject<T>(response);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,8 @@
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Kruzya.TelegramBot.Core.Extensions
|
||||
{
|
||||
namespace Kruzya.TelegramBot.Core.Extensions;
|
||||
|
||||
internal static class ModuleArrayExtension
|
||||
{
|
||||
public static void ConfigureServices(this Module[] modules, IServiceCollection services)
|
||||
@@ -16,4 +16,3 @@ namespace Kruzya.TelegramBot.Core.Extensions
|
||||
foreach (var module in modules) module.Configure(app, env);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Kruzya.TelegramBot.Core.Extensions
|
||||
{
|
||||
namespace Kruzya.TelegramBot.Core.Extensions;
|
||||
|
||||
public static partial class RepositoryExtension
|
||||
{
|
||||
public static TEntity Create<TEntity>(this DbSet<TEntity> repository) where TEntity : class, new()
|
||||
@@ -12,4 +12,3 @@ namespace Kruzya.TelegramBot.Core.Extensions
|
||||
return entity;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,7 +1,7 @@
|
||||
using System.Web;
|
||||
|
||||
namespace Kruzya.TelegramBot.Core.Extensions
|
||||
{
|
||||
namespace Kruzya.TelegramBot.Core.Extensions;
|
||||
|
||||
public static class StringExtension
|
||||
{
|
||||
public static string HtmlEncode(this string content)
|
||||
@@ -14,4 +14,3 @@ namespace Kruzya.TelegramBot.Core.Extensions
|
||||
return HttpUtility.HtmlDecode(content);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
using System.Text;
|
||||
using Telegram.Bot.Types;
|
||||
|
||||
namespace Kruzya.TelegramBot.Core.Extensions
|
||||
{
|
||||
namespace Kruzya.TelegramBot.Core.Extensions;
|
||||
|
||||
public static class UserExtension
|
||||
{
|
||||
public static string ToHtml(this User user, bool byUsername = false)
|
||||
@@ -28,4 +28,3 @@ namespace Kruzya.TelegramBot.Core.Extensions
|
||||
return $"{name} (ID: {user.Id}, Username: {user.Username ?? "N/A"})";
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -9,8 +9,8 @@ using Telegram.Bot;
|
||||
using Telegram.Bot.Types;
|
||||
using Telegram.Bot.Types.Enums;
|
||||
|
||||
namespace Kruzya.TelegramBot.Core.Handler
|
||||
{
|
||||
namespace Kruzya.TelegramBot.Core.Handler;
|
||||
|
||||
public abstract class CommonHandler : BotEventHandler
|
||||
{
|
||||
protected readonly CoreContext Db;
|
||||
@@ -59,4 +59,3 @@ namespace Kruzya.TelegramBot.Core.Handler
|
||||
await Bot.AnswerCallbackQueryAsync(id, message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,8 @@ using Kruzya.TelegramBot.Core.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Telegram.Bot.Types;
|
||||
|
||||
namespace Kruzya.TelegramBot.Core.Handler
|
||||
{
|
||||
namespace Kruzya.TelegramBot.Core.Handler;
|
||||
|
||||
public class GeneralHandler : BotEventHandler
|
||||
{
|
||||
[AttributeUsage(AttributeTargets.Method)]
|
||||
@@ -73,4 +73,3 @@ namespace Kruzya.TelegramBot.Core.Handler
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -3,8 +3,8 @@ using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Kruzya.TelegramBot.Core
|
||||
{
|
||||
namespace Kruzya.TelegramBot.Core;
|
||||
|
||||
public abstract class Module
|
||||
{
|
||||
protected readonly Core Core;
|
||||
@@ -33,4 +33,3 @@ namespace Kruzya.TelegramBot.Core
|
||||
return (T) Core.EnsureLoaded(typeof(T));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
+2
-3
@@ -2,8 +2,8 @@ using System.Globalization;
|
||||
using Microsoft.AspNetCore.Hosting;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
|
||||
namespace Kruzya.TelegramBot.Core
|
||||
{
|
||||
namespace Kruzya.TelegramBot.Core;
|
||||
|
||||
public class Program
|
||||
{
|
||||
public static void Main(string[] args)
|
||||
@@ -17,4 +17,3 @@ namespace Kruzya.TelegramBot.Core
|
||||
.UseSystemd()
|
||||
.ConfigureWebHostDefaults(webBuilder => { webBuilder.UseStartup<Startup>(); });
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,8 +5,8 @@ using BotFramework.Abstractions;
|
||||
using Microsoft.Extensions.Hosting;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace Kruzya.TelegramBot.Core.Service
|
||||
{
|
||||
namespace Kruzya.TelegramBot.Core.Service;
|
||||
|
||||
public abstract class AbstractTimedHostedService : IHostedService, IDisposable
|
||||
{
|
||||
private Timer _timer;
|
||||
@@ -71,4 +71,3 @@ namespace Kruzya.TelegramBot.Core.Service
|
||||
await Task.Delay(500);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,8 @@ using System.Threading.Tasks;
|
||||
using Kruzya.TelegramBot.Core.Data;
|
||||
using Telegram.Bot.Types;
|
||||
|
||||
namespace Kruzya.TelegramBot.Core.Service
|
||||
{
|
||||
namespace Kruzya.TelegramBot.Core.Service;
|
||||
|
||||
public interface IReputation
|
||||
{
|
||||
public Task<double> GetUserReputationAsync(Chat chat, User user);
|
||||
@@ -13,4 +13,3 @@ namespace Kruzya.TelegramBot.Core.Service
|
||||
public Task<double> IncrementReputationAsync(Chat chat, User user, double diff);
|
||||
public Task<IEnumerable<IReputationEntity>> GetChatRatingAsync(Chat chat, int limit = 10, int offset = 0);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -11,8 +11,8 @@ using Microsoft.Extensions.Logging;
|
||||
using Telegram.Bot;
|
||||
using Telegram.Bot.Types;
|
||||
|
||||
namespace Kruzya.TelegramBot.Core.Service
|
||||
{
|
||||
namespace Kruzya.TelegramBot.Core.Service;
|
||||
|
||||
public class UserService
|
||||
{
|
||||
private readonly List<long> _superUsers;
|
||||
@@ -88,4 +88,3 @@ namespace Kruzya.TelegramBot.Core.Service
|
||||
return _statusMap.ContainsKey(userId) ? _statusMap[userId] : null;
|
||||
}
|
||||
}
|
||||
}
|
||||
+2
-3
@@ -14,8 +14,8 @@ using System.Collections.Concurrent;
|
||||
using Kruzya.TelegramBot.Core.Options;
|
||||
using Telegram.Bot.Types;
|
||||
|
||||
namespace Kruzya.TelegramBot.Core
|
||||
{
|
||||
namespace Kruzya.TelegramBot.Core;
|
||||
|
||||
public class Startup
|
||||
{
|
||||
private Core _core;
|
||||
@@ -67,4 +67,3 @@ namespace Kruzya.TelegramBot.Core
|
||||
_core.Modules.Configure(app, env);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,8 +6,8 @@ using Newtonsoft.Json.Converters;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
using West.TelegramBot.ChatQuotes.Json;
|
||||
|
||||
namespace West.TelegramBot.ChatQuotes
|
||||
{
|
||||
namespace West.TelegramBot.ChatQuotes;
|
||||
|
||||
public class ChatQuotes : Module
|
||||
{
|
||||
public static readonly JsonSerializerSettings SerializerSettings = new()
|
||||
@@ -29,4 +29,3 @@ namespace West.TelegramBot.ChatQuotes
|
||||
services.AddSingleton<QuoteGeneratorService>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
using Newtonsoft.Json;
|
||||
using Newtonsoft.Json.Serialization;
|
||||
|
||||
namespace West.TelegramBot.ChatQuotes.Json
|
||||
{
|
||||
namespace West.TelegramBot.ChatQuotes.Json;
|
||||
|
||||
class NullToEmptyObjectResolver : DefaultContractResolver
|
||||
{
|
||||
protected override IList<JsonProperty> CreateProperties(Type type, MemberSerialization memberSerialization)
|
||||
@@ -15,4 +15,3 @@ namespace West.TelegramBot.ChatQuotes.Json
|
||||
}).ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,8 +4,8 @@ using Microsoft.Extensions.DependencyInjection;
|
||||
using West.TelegramBot.CodeWatcher.Options;
|
||||
using West.TelegramBot.CodeWatcher.Service;
|
||||
|
||||
namespace West.TelegramBot.CodeWatcher
|
||||
{
|
||||
namespace West.TelegramBot.CodeWatcher;
|
||||
|
||||
public class CodeWatcher : Module
|
||||
{
|
||||
public CodeWatcher(Core core) : base(core) {}
|
||||
@@ -20,4 +20,3 @@ namespace West.TelegramBot.CodeWatcher
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,7 +6,6 @@ using BotFramework.Enums;
|
||||
using Kruzya.TelegramBot.CombotAntiSpam.Combot;
|
||||
using Kruzya.TelegramBot.Core.Extensions;
|
||||
using Telegram.Bot;
|
||||
using Telegram.Bot.Types;
|
||||
using Telegram.Bot.Types.Enums;
|
||||
|
||||
namespace Kruzya.TelegramBot.CombotAntiSpam;
|
||||
|
||||
@@ -1,10 +1,9 @@
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Kruzya.TelegramBot.Destiny2.WhereIsXur.Provider
|
||||
{
|
||||
namespace Kruzya.TelegramBot.Destiny2.WhereIsXur.Provider;
|
||||
|
||||
public interface IXurPlaceProvider
|
||||
{
|
||||
public Task<string> GetPlaceAsync();
|
||||
public string GetPlace();
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,8 @@ using System.Threading.Tasks;
|
||||
using Fizzler.Systems.HtmlAgilityPack;
|
||||
using HtmlAgilityPack;
|
||||
|
||||
namespace Kruzya.TelegramBot.Destiny2.WhereIsXur.Provider
|
||||
{
|
||||
namespace Kruzya.TelegramBot.Destiny2.WhereIsXur.Provider;
|
||||
|
||||
public class XurWiki : IXurPlaceProvider
|
||||
{
|
||||
public async Task<string> GetPlaceAsync()
|
||||
@@ -25,4 +25,3 @@ namespace Kruzya.TelegramBot.Destiny2.WhereIsXur.Provider
|
||||
return GetPlaceAsync().GetAwaiter().GetResult();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,8 @@ using Kruzya.TelegramBot.Destiny2.WhereIsXur.Provider;
|
||||
using Telegram.Bot;
|
||||
using Telegram.Bot.Types.Enums;
|
||||
|
||||
namespace Kruzya.TelegramBot.Destiny2.WhereIsXur
|
||||
{
|
||||
namespace Kruzya.TelegramBot.Destiny2.WhereIsXur;
|
||||
|
||||
public class RequestHandler : BotEventHandler
|
||||
{
|
||||
protected readonly IXurPlaceProvider _placeProvider;
|
||||
@@ -34,4 +34,3 @@ namespace Kruzya.TelegramBot.Destiny2.WhereIsXur
|
||||
await Bot.SendTextMessageAsync(Chat, $"<b>Xûr</b> place is <code>{place}</code>", parseMode: ParseMode.Html);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,8 @@
|
||||
using Kruzya.TelegramBot.Destiny2.WhereIsXur.Provider;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Kruzya.TelegramBot.Destiny2.WhereIsXur
|
||||
{
|
||||
namespace Kruzya.TelegramBot.Destiny2.WhereIsXur;
|
||||
|
||||
public class WhereIsXur : Module
|
||||
{
|
||||
public WhereIsXur(Core.Core core) : base(core)
|
||||
@@ -15,4 +15,3 @@ namespace Kruzya.TelegramBot.Destiny2.WhereIsXur
|
||||
services.AddSingleton<IXurPlaceProvider, XurWiki>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,8 @@ using Kruzya.TelegramBot.Core;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
|
||||
namespace West.Entertainment
|
||||
{
|
||||
namespace West.Entertainment;
|
||||
|
||||
public class Entertainment : Module
|
||||
{
|
||||
public Entertainment(Core core) : base(core) { }
|
||||
@@ -17,4 +17,3 @@ namespace West.Entertainment
|
||||
services.AddSingleton<IGuessCache, GuessCache>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,8 +13,8 @@ using Microsoft.Extensions.Logging;
|
||||
using Telegram.Bot;
|
||||
using Telegram.Bot.Types.Enums;
|
||||
|
||||
namespace West.Entertainment.Handler
|
||||
{
|
||||
namespace West.Entertainment.Handler;
|
||||
|
||||
public class Common : BotEventHandler
|
||||
{
|
||||
private readonly UserService _userService;
|
||||
@@ -61,4 +61,3 @@ namespace West.Entertainment.Handler
|
||||
await Bot.SendTextMessageAsync(Chat.Id, msg.ToString(), parseMode: ParseMode.Html);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,8 @@ using Microsoft.Extensions.Logging;
|
||||
using Telegram.Bot;
|
||||
using Telegram.Bot.Types;
|
||||
|
||||
namespace West.Entertainment.Handler.Fun
|
||||
{
|
||||
namespace West.Entertainment.Handler.Fun;
|
||||
|
||||
public abstract class AbstractAnimationReply : BotEventHandler
|
||||
{
|
||||
private readonly CoreContext _db;
|
||||
@@ -105,4 +105,3 @@ namespace West.Entertainment.Handler.Fun
|
||||
|
||||
protected virtual int? GetMessageIdToReply() => Message?.MessageId;
|
||||
}
|
||||
}
|
||||
@@ -10,8 +10,8 @@ using Kruzya.TelegramBot.Core.Data;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Telegram.Bot;
|
||||
|
||||
namespace West.Entertainment.Handler.Fun
|
||||
{
|
||||
namespace West.Entertainment.Handler.Fun;
|
||||
|
||||
public class Bayan : AbstractAnimationReply
|
||||
{
|
||||
protected override TimeSpan Cooldown => TimeSpan.Zero;
|
||||
@@ -48,4 +48,3 @@ namespace West.Entertainment.Handler.Fun
|
||||
=> Message?.ReplyToMessage != null;
|
||||
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,8 @@ using Kruzya.TelegramBot.Core;
|
||||
using Kruzya.TelegramBot.Core.Data;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace West.Entertainment.Handler.Fun
|
||||
{
|
||||
namespace West.Entertainment.Handler.Fun;
|
||||
|
||||
public class JavaScript : AbstractAnimationReply
|
||||
{
|
||||
public JavaScript(CoreContext db, ILogger<JavaScript> logger, ThreadSafeRandom rng) : base(db, logger, rng) { }
|
||||
@@ -30,4 +30,3 @@ namespace West.Entertainment.Handler.Fun
|
||||
await HandleAnimation();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,8 @@ using Kruzya.TelegramBot.Core;
|
||||
using Kruzya.TelegramBot.Core.Data;
|
||||
using Microsoft.Extensions.Logging;
|
||||
|
||||
namespace West.Entertainment.Handler.Fun
|
||||
{
|
||||
namespace West.Entertainment.Handler.Fun;
|
||||
|
||||
public class Python : AbstractAnimationReply
|
||||
{
|
||||
protected override Regex AnimationMatch =>
|
||||
@@ -33,4 +33,3 @@ namespace West.Entertainment.Handler.Fun
|
||||
|
||||
public Python(CoreContext db, ILogger<Python> logger, ThreadSafeRandom rng) : base(db, logger, rng) { }
|
||||
}
|
||||
}
|
||||
@@ -8,8 +8,8 @@ using System.Collections.Generic;
|
||||
using System.ComponentModel;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary.Data
|
||||
{
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary.Data;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a feed in database.
|
||||
/// </summary>
|
||||
@@ -87,4 +87,3 @@ namespace Kruzya.TelegramBot.RichSiteSummary.Data
|
||||
|
||||
public override string ToString() => Title;
|
||||
}
|
||||
}
|
||||
@@ -9,8 +9,8 @@ using System.Text;
|
||||
using Kruzya.TelegramBot.RichSiteSummary.UrchinTrackingModule;
|
||||
using Telegram.Bot.Types.Enums;
|
||||
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary.Data
|
||||
{
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary.Data;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a post from feed in database.
|
||||
/// </summary>
|
||||
@@ -104,4 +104,3 @@ namespace Kruzya.TelegramBot.RichSiteSummary.Data
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,8 +7,8 @@ using System;
|
||||
using System.Web;
|
||||
using Telegram.Bot.Types.Enums;
|
||||
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary.Data
|
||||
{
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary.Data;
|
||||
|
||||
/// <summary>
|
||||
/// Implements the basic logic for rendering Database Entities in messages.
|
||||
/// </summary>
|
||||
@@ -58,4 +58,3 @@ namespace Kruzya.TelegramBot.RichSiteSummary.Data
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
using Kruzya.TelegramBot.Core.EF;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary.Data
|
||||
{
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary.Data;
|
||||
|
||||
public class RichSiteSummaryContext : AutoSaveDbContext
|
||||
{
|
||||
/// <summary>
|
||||
@@ -55,4 +55,3 @@ namespace Kruzya.TelegramBot.RichSiteSummary.Data
|
||||
.HasForeignKey(s => s.FeedId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,8 @@
|
||||
using System;
|
||||
using System.ComponentModel.DataAnnotations;
|
||||
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary.Data
|
||||
{
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary.Data;
|
||||
|
||||
/// <summary>
|
||||
/// Represents a subscription in database.
|
||||
/// </summary>
|
||||
@@ -53,4 +53,3 @@ namespace Kruzya.TelegramBot.RichSiteSummary.Data
|
||||
Feed = feed;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
using BotFramework;
|
||||
using Kruzya.TelegramBot.RichSiteSummary.Data;
|
||||
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary.Handler
|
||||
{
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary.Handler;
|
||||
|
||||
public abstract class AbstractHandler : BotEventHandler
|
||||
{
|
||||
protected readonly RichSiteSummaryContext _dbContext;
|
||||
@@ -12,4 +12,3 @@ namespace Kruzya.TelegramBot.RichSiteSummary.Handler
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,8 +13,8 @@ using Telegram.Bot.Types;
|
||||
using Telegram.Bot.Types.Enums;
|
||||
using Telegram.Bot.Types.ReplyMarkups;
|
||||
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary.Handler
|
||||
{
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary.Handler;
|
||||
|
||||
public class FeedList : AbstractHandler
|
||||
{
|
||||
public FeedList(RichSiteSummaryContext dbContext) : base(dbContext)
|
||||
@@ -308,4 +308,3 @@ namespace Kruzya.TelegramBot.RichSiteSummary.Handler
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,8 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Telegram.Bot;
|
||||
using Telegram.Bot.Types.Enums;
|
||||
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary.Handler
|
||||
{
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary.Handler;
|
||||
|
||||
public class StatsHandler : AbstractHandler
|
||||
{
|
||||
public StatsHandler(RichSiteSummaryContext dbContext) : base(dbContext)
|
||||
@@ -34,4 +34,3 @@ namespace Kruzya.TelegramBot.RichSiteSummary.Handler
|
||||
await Bot.SendTextMessageAsync(Chat, textMessage.ToString(), parseMode: ParseMode.Html);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -7,8 +7,8 @@ using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using Microsoft.Extensions.DependencyInjection;
|
||||
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary
|
||||
{
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary;
|
||||
|
||||
public class RichSiteSummary : Module
|
||||
{
|
||||
public RichSiteSummary(Core.Core core) : base(core)
|
||||
@@ -34,4 +34,3 @@ namespace Kruzya.TelegramBot.RichSiteSummary
|
||||
.AddHostedService<MessageSender>();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,8 @@ using Kruzya.TelegramBot.RichSiteSummary.Data;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Telegram.Bot.Types;
|
||||
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary
|
||||
{
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary;
|
||||
|
||||
internal static class RichSiteSummaryRepositoryExtension
|
||||
{
|
||||
#region Subscriber
|
||||
@@ -69,4 +69,3 @@ namespace Kruzya.TelegramBot.RichSiteSummary
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -9,8 +9,8 @@ using Telegram.Bot;
|
||||
using Telegram.Bot.Exceptions;
|
||||
using Telegram.Bot.Types;
|
||||
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary.Service
|
||||
{
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary.Service;
|
||||
|
||||
public class MessageSender : AbstractTimedHostedService
|
||||
{
|
||||
protected override TimeSpan TimerPeriod => TimeSpan.FromSeconds(1);
|
||||
@@ -86,4 +86,3 @@ namespace Kruzya.TelegramBot.RichSiteSummary.Service
|
||||
Queue.Enqueue(message);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -20,8 +20,8 @@ using Feed = Kruzya.TelegramBot.RichSiteSummary.Data.Feed;
|
||||
|
||||
using CodeHollow.FeedReader.Feeds;
|
||||
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary.Service
|
||||
{
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary.Service;
|
||||
|
||||
/// <summary>
|
||||
/// Performs a RSS feed parsing.
|
||||
/// Grabs the all feeds from database.
|
||||
@@ -258,4 +258,3 @@ namespace Kruzya.TelegramBot.RichSiteSummary.Service
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -9,8 +9,8 @@ using Microsoft.Extensions.DependencyInjection;
|
||||
using Microsoft.Extensions.Logging;
|
||||
using Telegram.Bot.Types;
|
||||
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary.Service
|
||||
{
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary.Service;
|
||||
|
||||
public class Unsubscriber : AbstractTimedHostedService
|
||||
{
|
||||
protected readonly ConcurrentQueue<UserUnsubscribe> Queue;
|
||||
@@ -46,4 +46,3 @@ namespace Kruzya.TelegramBot.RichSiteSummary.Service
|
||||
await dbContext.SaveChangesAsync();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,5 @@
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary.UrchinTrackingModule
|
||||
{
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary.UrchinTrackingModule;
|
||||
|
||||
public struct UtmParameters
|
||||
{
|
||||
public string Source;
|
||||
@@ -8,4 +8,3 @@ namespace Kruzya.TelegramBot.RichSiteSummary.UrchinTrackingModule
|
||||
public string Term;
|
||||
public string Content;
|
||||
}
|
||||
}
|
||||
@@ -3,8 +3,8 @@ using System.Collections.Generic;
|
||||
using System.Collections.Specialized;
|
||||
using System.Web;
|
||||
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary.UrchinTrackingModule
|
||||
{
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary.UrchinTrackingModule;
|
||||
|
||||
public class UtmUtility
|
||||
{
|
||||
public static string ApplyParameters(string url, UtmParameters parameters)
|
||||
@@ -48,4 +48,3 @@ namespace Kruzya.TelegramBot.RichSiteSummary.UrchinTrackingModule
|
||||
queryParameteters.Set(key, value);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,8 @@
|
||||
using Telegram.Bot.Types;
|
||||
using Telegram.Bot.Types.Enums;
|
||||
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary
|
||||
{
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary;
|
||||
|
||||
public struct UserMessage
|
||||
{
|
||||
public ChatId ChatId;
|
||||
@@ -11,4 +11,3 @@ namespace Kruzya.TelegramBot.RichSiteSummary
|
||||
public bool DisableWebPagePreview;
|
||||
public string ImageUrl;
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
using Telegram.Bot.Types;
|
||||
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary
|
||||
{
|
||||
namespace Kruzya.TelegramBot.RichSiteSummary;
|
||||
|
||||
public struct UserUnsubscribe
|
||||
{
|
||||
public ChatId ChatId;
|
||||
}
|
||||
}
|
||||
@@ -5,8 +5,8 @@ using Telegram.Bot;
|
||||
using Telegram.Bot.Types;
|
||||
using Telegram.Bot.Types.Enums;
|
||||
|
||||
namespace Kruzya.TelegramBot.UrlLimitations
|
||||
{
|
||||
namespace Kruzya.TelegramBot.UrlLimitations;
|
||||
|
||||
public static class MessageExtension
|
||||
{
|
||||
public static async Task<bool> HasUnknownMention(this Message message, ITelegramBotClient bot)
|
||||
@@ -60,4 +60,3 @@ namespace Kruzya.TelegramBot.UrlLimitations
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -11,8 +11,8 @@ using Telegram.Bot;
|
||||
using Telegram.Bot.Types;
|
||||
using Telegram.Bot.Types.Enums;
|
||||
|
||||
namespace Kruzya.TelegramBot.UrlLimitations
|
||||
{
|
||||
namespace Kruzya.TelegramBot.UrlLimitations;
|
||||
|
||||
public class MessageHandler : BotEventHandler
|
||||
{
|
||||
protected ILogger Logger;
|
||||
@@ -56,4 +56,3 @@ namespace Kruzya.TelegramBot.UrlLimitations
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,11 +1,10 @@
|
||||
using Kruzya.TelegramBot.Core;
|
||||
|
||||
namespace Kruzya.TelegramBot.UrlLimitations
|
||||
{
|
||||
namespace Kruzya.TelegramBot.UrlLimitations;
|
||||
|
||||
public class UrlLimitations : Module
|
||||
{
|
||||
public UrlLimitations(Core.Core core) : base(core)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,8 +6,8 @@ using BotFramework.Enums;
|
||||
using Kruzya.TelegramBot.Core.Data;
|
||||
using Kruzya.TelegramBot.Core.Extensions;
|
||||
|
||||
namespace Kruzya.TelegramBot.UrlLimitations
|
||||
{
|
||||
namespace Kruzya.TelegramBot.UrlLimitations;
|
||||
|
||||
public class UserJoinHandler : BotEventHandler
|
||||
{
|
||||
protected readonly CoreContext dbCtx;
|
||||
@@ -26,4 +26,3 @@ namespace Kruzya.TelegramBot.UrlLimitations
|
||||
0);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -14,8 +14,8 @@ using Telegram.Bot;
|
||||
using Telegram.Bot.Types;
|
||||
using Telegram.Bot.Types.Enums;
|
||||
|
||||
namespace UserGroupTag
|
||||
{
|
||||
namespace UserGroupTag;
|
||||
|
||||
public class Handler : BotEventHandler
|
||||
{
|
||||
private readonly CoreContext _db;
|
||||
@@ -104,4 +104,3 @@ namespace UserGroupTag
|
||||
return user;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,9 +1,8 @@
|
||||
using Kruzya.TelegramBot.Core;
|
||||
|
||||
namespace UserGroupTag
|
||||
{
|
||||
namespace UserGroupTag;
|
||||
|
||||
public class UserGroupTag : Module
|
||||
{
|
||||
public UserGroupTag(Core core) : base(core) { }
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user