mirror of
https://github.com/Jetsparrow/karmabot.git
synced 2026-01-21 00:56:09 +03:00
Usings and namespace cleanup
This commit is contained in:
parent
d2e8ed4d69
commit
2cc286ad9c
@ -1,15 +1,10 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using Perfusion;
|
|
||||||
using JetKarmaBot.Services.Handling;
|
|
||||||
using NLog;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using NLog;
|
||||||
|
using JetKarmaBot.Services.Handling;
|
||||||
using JetKarmaBot.Models;
|
using JetKarmaBot.Models;
|
||||||
|
|
||||||
namespace JetKarmaBot.Commands
|
namespace JetKarmaBot.Commands;
|
||||||
{
|
|
||||||
class AwardCommand : IChatCommand
|
class AwardCommand : IChatCommand
|
||||||
{
|
{
|
||||||
public IReadOnlyCollection<string> Names => new[] { "award", "revoke" };
|
public IReadOnlyCollection<string> Names => new[] { "award", "revoke" };
|
||||||
@ -159,4 +154,3 @@ namespace JetKarmaBot.Commands
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,13 +1,9 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using Perfusion;
|
|
||||||
using JetKarmaBot.Services.Handling;
|
|
||||||
using NLog;
|
using NLog;
|
||||||
using System.Linq;
|
using JetKarmaBot.Services.Handling;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using JetKarmaBot.Models;
|
using JetKarmaBot.Models;
|
||||||
|
|
||||||
namespace JetKarmaBot.Commands
|
namespace JetKarmaBot.Commands;
|
||||||
{
|
|
||||||
class LocaleCommand : IChatCommand
|
class LocaleCommand : IChatCommand
|
||||||
{
|
{
|
||||||
public IReadOnlyCollection<string> Names => new[] { "changelocale", "locale" };
|
public IReadOnlyCollection<string> Names => new[] { "changelocale", "locale" };
|
||||||
@ -77,4 +73,3 @@ namespace JetKarmaBot.Commands
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
using System;
|
using System.Text.RegularExpressions;
|
||||||
using System.Linq;
|
|
||||||
using System.Text.RegularExpressions;
|
namespace JetKarmaBot.Commands;
|
||||||
|
|
||||||
namespace JetKarmaBot.Commands
|
|
||||||
{
|
|
||||||
public class CommandString
|
public class CommandString
|
||||||
{
|
{
|
||||||
public CommandString(string command, params string[] parameters)
|
public CommandString(string command, params string[] parameters)
|
||||||
@ -48,4 +46,3 @@ namespace JetKarmaBot.Commands
|
|||||||
throw new ArgumentException($"\"{s}\" is not a command");
|
throw new ArgumentException($"\"{s}\" is not a command");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,13 +1,9 @@
|
|||||||
using System.Collections.Generic;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Perfusion;
|
|
||||||
using JetKarmaBot.Services.Handling;
|
using JetKarmaBot.Services.Handling;
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using JetKarmaBot.Models;
|
using JetKarmaBot.Models;
|
||||||
|
|
||||||
namespace JetKarmaBot.Commands
|
namespace JetKarmaBot.Commands;
|
||||||
{
|
|
||||||
public class CurrenciesCommand : IChatCommand
|
public class CurrenciesCommand : IChatCommand
|
||||||
{
|
{
|
||||||
[Inject] Localization Locale { get; set; }
|
[Inject] Localization Locale { get; set; }
|
||||||
@ -30,4 +26,3 @@ namespace JetKarmaBot.Commands
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@ -1,12 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using JetKarmaBot.Services.Handling;
|
||||||
using Perfusion;
|
|
||||||
using JetKarmaBot.Services.Handling;
|
namespace JetKarmaBot.Commands;
|
||||||
using Telegram.Bot.Types.Enums;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using JetKarmaBot.Models;
|
|
||||||
|
|
||||||
namespace JetKarmaBot.Commands
|
|
||||||
{
|
|
||||||
public class HelpCommand : IChatCommand
|
public class HelpCommand : IChatCommand
|
||||||
{
|
{
|
||||||
[Inject] Localization Locale { get; set; }
|
[Inject] Localization Locale { get; set; }
|
||||||
@ -41,4 +36,3 @@ namespace JetKarmaBot.Commands
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
using JetKarmaBot.Services.Handling;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using JetKarmaBot.Services.Handling;
|
namespace JetKarmaBot.Commands;
|
||||||
|
|
||||||
namespace JetKarmaBot.Commands
|
|
||||||
{
|
|
||||||
public interface IChatCommand
|
public interface IChatCommand
|
||||||
{
|
{
|
||||||
IReadOnlyCollection<string> Names { get; }
|
IReadOnlyCollection<string> Names { get; }
|
||||||
@ -29,4 +27,3 @@ namespace JetKarmaBot.Commands
|
|||||||
String,
|
String,
|
||||||
Integer,
|
Integer,
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,13 +1,9 @@
|
|||||||
using System.Linq;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Perfusion;
|
|
||||||
using JetKarmaBot.Services.Handling;
|
using JetKarmaBot.Services.Handling;
|
||||||
using JetKarmaBot.Models;
|
using JetKarmaBot.Models;
|
||||||
|
|
||||||
namespace JetKarmaBot.Commands
|
namespace JetKarmaBot.Commands;
|
||||||
{
|
|
||||||
class LeaderboardCommand : IChatCommand
|
class LeaderboardCommand : IChatCommand
|
||||||
{
|
{
|
||||||
public IReadOnlyCollection<string> Names => new[] { "leaderboard" };
|
public IReadOnlyCollection<string> Names => new[] { "leaderboard" };
|
||||||
@ -67,4 +63,3 @@ namespace JetKarmaBot.Commands
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,13 +1,9 @@
|
|||||||
using System.Linq;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using Perfusion;
|
|
||||||
using JetKarmaBot.Services.Handling;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using JetKarmaBot.Services.Handling;
|
||||||
using JetKarmaBot.Models;
|
using JetKarmaBot.Models;
|
||||||
|
|
||||||
namespace JetKarmaBot.Commands
|
namespace JetKarmaBot.Commands;
|
||||||
{
|
|
||||||
class StatusCommand : IChatCommand
|
class StatusCommand : IChatCommand
|
||||||
{
|
{
|
||||||
public IReadOnlyCollection<string> Names => ["status"];
|
public IReadOnlyCollection<string> Names => ["status"];
|
||||||
@ -53,4 +49,3 @@ namespace JetKarmaBot.Commands
|
|||||||
|
|
||||||
public IReadOnlyCollection<ChatCommandArgument> Arguments => [];
|
public IReadOnlyCollection<ChatCommandArgument> Arguments => [];
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -2,10 +2,9 @@
|
|||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
using JsonNet.PrivateSettersContractResolvers;
|
using JsonNet.PrivateSettersContractResolvers;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace JetKarmaBot
|
namespace JetKarmaBot;
|
||||||
{
|
|
||||||
public class Config : ConfigBase
|
public class Config : ConfigBase
|
||||||
{
|
{
|
||||||
public Config(string path) : base(path) { }
|
public Config(string path) : base(path) { }
|
||||||
@ -74,5 +73,4 @@ namespace JetKarmaBot
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
|
|||||||
@ -1,15 +1,12 @@
|
|||||||
using System.Collections.Generic;
|
namespace JetKarmaBot;
|
||||||
|
|
||||||
namespace JetKarmaBot
|
|
||||||
{
|
|
||||||
public static class IReadOnlyDictionaryExtensions
|
public static class IReadOnlyDictionaryExtensions
|
||||||
{
|
{
|
||||||
public static TValue GetOrDefault<TKey, TValue>(this IReadOnlyDictionary<TKey, TValue> dict, TKey key)
|
public static TValue GetOrDefault<TKey, TValue>(this IReadOnlyDictionary<TKey, TValue> dict, TKey key)
|
||||||
{
|
{
|
||||||
TValue res = default(TValue);
|
TValue res = default;
|
||||||
if (key != null)
|
if (key != null)
|
||||||
dict.TryGetValue(key, out res);
|
dict.TryGetValue(key, out res);
|
||||||
return res;
|
return res;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -3,8 +3,8 @@ using Newtonsoft.Json;
|
|||||||
using Newtonsoft.Json.Serialization;
|
using Newtonsoft.Json.Serialization;
|
||||||
|
|
||||||
// ReSharper disable once CheckNamespace
|
// ReSharper disable once CheckNamespace
|
||||||
namespace JsonNet.PrivateSettersContractResolvers
|
namespace JsonNet.PrivateSettersContractResolvers;
|
||||||
{
|
|
||||||
public class PrivateSetterContractResolver : DefaultContractResolver
|
public class PrivateSetterContractResolver : DefaultContractResolver
|
||||||
{
|
{
|
||||||
protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization)
|
protected override JsonProperty CreateProperty(MemberInfo member, MemberSerialization memberSerialization)
|
||||||
@ -42,4 +42,3 @@ namespace JsonNet.PrivateSettersContractResolvers
|
|||||||
return property?.GetSetMethod(true) != null;
|
return property?.GetSetMethod(true) != null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
6
JetKarmaBot/GlobalUsings.cs
Normal file
6
JetKarmaBot/GlobalUsings.cs
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
global using System;
|
||||||
|
global using System.Collections.Generic;
|
||||||
|
global using System.Linq;
|
||||||
|
global using System.Threading;
|
||||||
|
global using System.Threading.Tasks;
|
||||||
|
global using Perfusion;
|
||||||
@ -3,18 +3,14 @@ using JetKarmaBot.Models;
|
|||||||
using JetKarmaBot.Services;
|
using JetKarmaBot.Services;
|
||||||
using JetKarmaBot.Services.Handling;
|
using JetKarmaBot.Services.Handling;
|
||||||
using NLog;
|
using NLog;
|
||||||
using Perfusion;
|
|
||||||
using System;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
|
|
||||||
using Telegram.Bot;
|
using Telegram.Bot;
|
||||||
using Telegram.Bot.Polling;
|
using Telegram.Bot.Polling;
|
||||||
using Telegram.Bot.Types;
|
using Telegram.Bot.Types;
|
||||||
using Telegram.Bot.Types.Enums;
|
using Telegram.Bot.Types.Enums;
|
||||||
|
|
||||||
namespace JetKarmaBot
|
namespace JetKarmaBot;
|
||||||
{
|
|
||||||
public class JetKarmaBot : IDisposable
|
public class JetKarmaBot : IDisposable
|
||||||
{
|
{
|
||||||
[Inject] Config Config { get; set; }
|
[Inject] Config Config { get; set; }
|
||||||
@ -139,4 +135,3 @@ namespace JetKarmaBot
|
|||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
using System;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
namespace JetKarmaBot.Models;
|
||||||
|
|
||||||
namespace JetKarmaBot.Models
|
|
||||||
{
|
|
||||||
public partial class Award
|
public partial class Award
|
||||||
{
|
{
|
||||||
public int AwardId { get; set; }
|
public int AwardId { get; set; }
|
||||||
@ -22,4 +20,3 @@ namespace JetKarmaBot.Models
|
|||||||
[ForeignKey("ToId")]
|
[ForeignKey("ToId")]
|
||||||
public virtual User To { get; set; }
|
public virtual User To { get; set; }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,8 +1,5 @@
|
|||||||
using System;
|
namespace JetKarmaBot.Models;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace JetKarmaBot.Models
|
|
||||||
{
|
|
||||||
public partial class AwardType
|
public partial class AwardType
|
||||||
{
|
{
|
||||||
public AwardType()
|
public AwardType()
|
||||||
@ -18,4 +15,3 @@ namespace JetKarmaBot.Models
|
|||||||
|
|
||||||
public virtual ICollection<Award> Awards { get; set; }
|
public virtual ICollection<Award> Awards { get; set; }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,8 +1,5 @@
|
|||||||
using System;
|
namespace JetKarmaBot.Models;
|
||||||
using System.Collections.Generic;
|
|
||||||
|
|
||||||
namespace JetKarmaBot.Models
|
|
||||||
{
|
|
||||||
public partial class Chat
|
public partial class Chat
|
||||||
{
|
{
|
||||||
public Chat()
|
public Chat()
|
||||||
@ -16,4 +13,3 @@ namespace JetKarmaBot.Models
|
|||||||
|
|
||||||
public virtual ICollection<Award> Awards { get; set; }
|
public virtual ICollection<Award> Awards { get; set; }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,10 +1,7 @@
|
|||||||
using System;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Microsoft.EntityFrameworkCore.Metadata;
|
namespace JetKarmaBot.Models;
|
||||||
using Perfusion;
|
|
||||||
|
|
||||||
namespace JetKarmaBot.Models
|
|
||||||
{
|
|
||||||
[Transient]
|
[Transient]
|
||||||
public partial class KarmaContext : DbContext
|
public partial class KarmaContext : DbContext
|
||||||
{
|
{
|
||||||
@ -180,4 +177,3 @@ namespace JetKarmaBot.Models
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,9 +1,7 @@
|
|||||||
using System;
|
using System.ComponentModel.DataAnnotations.Schema;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.ComponentModel.DataAnnotations.Schema;
|
namespace JetKarmaBot.Models;
|
||||||
|
|
||||||
namespace JetKarmaBot.Models
|
|
||||||
{
|
|
||||||
public partial class User
|
public partial class User
|
||||||
{
|
{
|
||||||
public User()
|
public User()
|
||||||
@ -20,4 +18,3 @@ namespace JetKarmaBot.Models
|
|||||||
[InverseProperty("To")]
|
[InverseProperty("To")]
|
||||||
public virtual ICollection<Award> AwardsTo { get; set; }
|
public virtual ICollection<Award> AwardsTo { get; set; }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,14 +1,9 @@
|
|||||||
using System;
|
using Microsoft.EntityFrameworkCore;
|
||||||
using System.Reflection;
|
|
||||||
using System.Runtime.Loader;
|
|
||||||
using System.Threading;
|
|
||||||
using JetKarmaBot.Models;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using NLog;
|
using NLog;
|
||||||
using Perfusion;
|
using JetKarmaBot.Models;
|
||||||
|
|
||||||
|
namespace JetKarmaBot;
|
||||||
|
|
||||||
namespace JetKarmaBot
|
|
||||||
{
|
|
||||||
public static class Program
|
public static class Program
|
||||||
{
|
{
|
||||||
private static Logger log = LogManager.GetCurrentClassLogger();
|
private static Logger log = LogManager.GetCurrentClassLogger();
|
||||||
@ -76,4 +71,3 @@ namespace JetKarmaBot
|
|||||||
return (int)ExitCode.Ok;
|
return (int)ExitCode.Ok;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,14 +1,9 @@
|
|||||||
using JetKarmaBot.Commands;
|
using NLog;
|
||||||
using NLog;
|
|
||||||
using Perfusion;
|
|
||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Telegram.Bot;
|
using Telegram.Bot;
|
||||||
|
using JetKarmaBot.Commands;
|
||||||
|
|
||||||
|
namespace JetKarmaBot.Services.Handling;
|
||||||
|
|
||||||
namespace JetKarmaBot.Services.Handling
|
|
||||||
{
|
|
||||||
public class ChatCommandRouter : IRequestHandler
|
public class ChatCommandRouter : IRequestHandler
|
||||||
{
|
{
|
||||||
public class Feature
|
public class Feature
|
||||||
@ -108,4 +103,3 @@ namespace JetKarmaBot.Services.Handling
|
|||||||
|
|
||||||
Dictionary<string, IChatCommand> commands = new Dictionary<string, IChatCommand>();
|
Dictionary<string, IChatCommand> commands = new Dictionary<string, IChatCommand>();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,10 +1,5 @@
|
|||||||
using System;
|
namespace JetKarmaBot.Services.Handling;
|
||||||
using System.Threading.Tasks;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using Perfusion;
|
|
||||||
|
|
||||||
namespace JetKarmaBot.Services.Handling
|
|
||||||
{
|
|
||||||
public class DatabaseHandler : IRequestHandler
|
public class DatabaseHandler : IRequestHandler
|
||||||
{
|
{
|
||||||
[Inject] private KarmaContextFactory Db;
|
[Inject] private KarmaContextFactory Db;
|
||||||
@ -20,4 +15,3 @@ namespace JetKarmaBot.Services.Handling
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@ -1,11 +1,7 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using NLog;
|
using NLog;
|
||||||
using Perfusion;
|
|
||||||
|
|
||||||
namespace JetKarmaBot.Services.Handling
|
namespace JetKarmaBot.Services.Handling;
|
||||||
{
|
|
||||||
public interface IRequestHandler
|
public interface IRequestHandler
|
||||||
{
|
{
|
||||||
Task Handle(RequestContext ctx, Func<RequestContext, Task> next);
|
Task Handle(RequestContext ctx, Func<RequestContext, Task> next);
|
||||||
@ -39,4 +35,3 @@ namespace JetKarmaBot.Services.Handling
|
|||||||
handlerStack.Add(handler);
|
handlerStack.Add(handler);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@ -1,15 +1,9 @@
|
|||||||
using System;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.Linq;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using JetKarmaBot.Commands;
|
|
||||||
using JetKarmaBot.Models;
|
|
||||||
using Telegram.Bot;
|
using Telegram.Bot;
|
||||||
using Telegram.Bot.Args;
|
|
||||||
using Telegram.Bot.Types;
|
using Telegram.Bot.Types;
|
||||||
|
using JetKarmaBot.Commands;
|
||||||
|
|
||||||
|
namespace JetKarmaBot.Services.Handling;
|
||||||
|
|
||||||
namespace JetKarmaBot.Services.Handling
|
|
||||||
{
|
|
||||||
public class RequestContext : IServiceProvider
|
public class RequestContext : IServiceProvider
|
||||||
{
|
{
|
||||||
public ITelegramBotClient Client { get; }
|
public ITelegramBotClient Client { get; }
|
||||||
@ -36,4 +30,3 @@ namespace JetKarmaBot.Services.Handling
|
|||||||
replyParameters: new ReplyParameters { MessageId = EventArgs.Message.MessageId }
|
replyParameters: new ReplyParameters { MessageId = EventArgs.Message.MessageId }
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@ -1,10 +1,8 @@
|
|||||||
using System;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using JetKarmaBot.Models;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
using Microsoft.EntityFrameworkCore;
|
||||||
|
using JetKarmaBot.Models;
|
||||||
|
|
||||||
|
namespace JetKarmaBot.Services.Handling;
|
||||||
|
|
||||||
namespace JetKarmaBot.Services.Handling
|
|
||||||
{
|
|
||||||
public class SaveData : IRequestHandler
|
public class SaveData : IRequestHandler
|
||||||
{
|
{
|
||||||
public async Task Handle(RequestContext ctx, Func<RequestContext, Task> next)
|
public async Task Handle(RequestContext ctx, Func<RequestContext, Task> next)
|
||||||
@ -33,4 +31,3 @@ namespace JetKarmaBot.Services.Handling
|
|||||||
(await db.Users.FindAsync(u.Id)).Username = un;
|
(await db.Users.FindAsync(u.Id)).Username = un;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@ -1,14 +1,8 @@
|
|||||||
using Perfusion;
|
|
||||||
using System.Collections.Generic;
|
|
||||||
using System;
|
|
||||||
using System.Threading.Tasks;
|
|
||||||
using JetKarmaBot.Models;
|
|
||||||
using System.Threading;
|
|
||||||
using System.Linq;
|
|
||||||
using NLog;
|
using NLog;
|
||||||
|
using JetKarmaBot.Models;
|
||||||
|
|
||||||
|
namespace JetKarmaBot.Services.Handling;
|
||||||
|
|
||||||
namespace JetKarmaBot.Services.Handling
|
|
||||||
{
|
|
||||||
[Singleton]
|
[Singleton]
|
||||||
public class TimeoutManager : IRequestHandler
|
public class TimeoutManager : IRequestHandler
|
||||||
{
|
{
|
||||||
@ -130,4 +124,3 @@ namespace JetKarmaBot.Services.Handling
|
|||||||
+ (t.GenericTypeArguments.Length > 0 ? "<" + string.Join(",", t.GenericTypeArguments.Select(getTypeName)) + ">" : "");
|
+ (t.GenericTypeArguments.Length > 0 ? "<" + string.Join(",", t.GenericTypeArguments.Select(getTypeName)) + ">" : "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@ -1,12 +1,10 @@
|
|||||||
using JetKarmaBot.Models;
|
using JetKarmaBot.Models;
|
||||||
using Perfusion;
|
|
||||||
|
|
||||||
namespace JetKarmaBot.Services
|
namespace JetKarmaBot.Services;
|
||||||
{
|
|
||||||
public class KarmaContextFactory
|
public class KarmaContextFactory
|
||||||
{
|
{
|
||||||
[Inject] IContainer C { get; set; }
|
[Inject] IContainer C { get; set; }
|
||||||
|
|
||||||
public KarmaContext GetContext() => C.GetInstance<KarmaContext>();
|
public KarmaContext GetContext() => C.GetInstance<KarmaContext>();
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|||||||
@ -1,15 +1,11 @@
|
|||||||
using System;
|
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using Newtonsoft.Json.Linq;
|
using Newtonsoft.Json.Linq;
|
||||||
using NLog;
|
using NLog;
|
||||||
using Perfusion;
|
|
||||||
|
|
||||||
namespace JetKarmaBot
|
namespace JetKarmaBot;
|
||||||
{
|
|
||||||
public class Localization : IReadOnlyDictionary<string, Locale>
|
public class Localization : IReadOnlyDictionary<string, Locale>
|
||||||
{
|
{
|
||||||
private Dictionary<string, Locale> locales = new Dictionary<string, Locale>();
|
private Dictionary<string, Locale> locales = new Dictionary<string, Locale>();
|
||||||
@ -168,4 +164,3 @@ namespace JetKarmaBot
|
|||||||
SerializationInfo info,
|
SerializationInfo info,
|
||||||
StreamingContext context) : base(info, context) { }
|
StreamingContext context) : base(info, context) { }
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@ -1,10 +1,7 @@
|
|||||||
using System;
|
|
||||||
using System.Linq;
|
|
||||||
using NLog;
|
using NLog;
|
||||||
using Perfusion;
|
|
||||||
|
|
||||||
namespace JetKarmaBot
|
namespace JetKarmaBot;
|
||||||
{
|
|
||||||
public class LogInfo : ObjectInfo
|
public class LogInfo : ObjectInfo
|
||||||
{
|
{
|
||||||
public override ObjectInfo Clone() => new LogInfo();
|
public override ObjectInfo Clone() => new LogInfo();
|
||||||
@ -19,4 +16,3 @@ namespace JetKarmaBot
|
|||||||
+ (t.GenericTypeArguments.Length > 0 ? "<" + string.Join(",", t.GenericTypeArguments.Select(getTypeName)) + ">" : "");
|
+ (t.GenericTypeArguments.Length > 0 ? "<" + string.Join(",", t.GenericTypeArguments.Select(getTypeName)) + ">" : "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
@ -1,10 +1,8 @@
|
|||||||
using System;
|
|
||||||
using Microsoft.Extensions.Logging;
|
using Microsoft.Extensions.Logging;
|
||||||
using NLog;
|
using NLog;
|
||||||
using Perfusion;
|
|
||||||
|
|
||||||
namespace JetKarmaBot
|
namespace JetKarmaBot;
|
||||||
{
|
|
||||||
public class NLoggerFactory : ILoggerFactory
|
public class NLoggerFactory : ILoggerFactory
|
||||||
{
|
{
|
||||||
[Inject]
|
[Inject]
|
||||||
@ -100,4 +98,3 @@ namespace JetKarmaBot
|
|||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue
Block a user