Files
telegram-bot/modules/ChatQuotes/ChatQuotes.cs
T

31 lines
981 B
C#
Raw Normal View History

2022-01-21 00:10:27 +02:00
using System.Globalization;
using Kruzya.TelegramBot.Core;
using Microsoft.Extensions.DependencyInjection;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Serialization;
using West.TelegramBot.ChatQuotes.Json;
2023-07-29 15:14:52 +03:00
namespace West.TelegramBot.ChatQuotes;
public class ChatQuotes : Module
2022-01-21 00:10:27 +02:00
{
2023-07-29 15:14:52 +03:00
public static readonly JsonSerializerSettings SerializerSettings = new()
2022-01-21 00:10:27 +02:00
{
2023-07-29 15:14:52 +03:00
MetadataPropertyHandling = MetadataPropertyHandling.Ignore,
DateParseHandling = DateParseHandling.None,
Converters =
2022-01-21 00:10:27 +02:00
{
2023-07-29 15:14:52 +03:00
new IsoDateTimeConverter { DateTimeStyles = DateTimeStyles.AssumeUniversal },
new StringEnumConverter(new CamelCaseNamingStrategy())
},
ContractResolver = new NullToEmptyObjectResolver()
};
2022-01-21 00:10:27 +02:00
2023-07-29 15:14:52 +03:00
public ChatQuotes(Core core) : base(core) { }
2022-01-21 00:10:27 +02:00
2023-07-29 15:14:52 +03:00
public override void ConfigureServices(IServiceCollection services)
{
services.AddSingleton<QuoteGeneratorService>();
2022-01-21 00:10:27 +02:00
}
}