Base for 4.3 work. Split Nadeko.Common into a separate project

This commit is contained in:
Kwoth
2022-07-11 00:06:19 +02:00
parent 1396d9d55a
commit f41b1fb93c
113 changed files with 271 additions and 255 deletions

View File

@@ -3,6 +3,7 @@ using NadekoBot.Common.Configs;
using NadekoBot.Common.ModuleBehaviors;
using NadekoBot.Db;
using System.Collections.Immutable;
using Nadeko.Common;
using ExecuteResult = Discord.Commands.ExecuteResult;
using PreconditionResult = Discord.Commands.PreconditionResult;

View File

@@ -1,6 +1,7 @@
#nullable disable
using Grpc.Core;
using Grpc.Net.Client;
using Nadeko.Common;
using NadekoBot.Common.ModuleBehaviors;
using NadekoBot.Coordinator;

View File

@@ -1,15 +1,14 @@
#nullable disable
using System.Collections;
using System.Collections.Immutable;
namespace NadekoBot.Services;
public class StartingGuildsService : IEnumerable<ulong>, INService
{
private readonly ImmutableList<ulong> _guilds;
private readonly IReadOnlyList<ulong> _guilds;
public StartingGuildsService(DiscordSocketClient client)
=> _guilds = client.Guilds.Select(x => x.Id).ToImmutableList();
=> _guilds = client.Guilds.Select(x => x.Id).ToList();
public IEnumerator<ulong> GetEnumerator()
=> _guilds.GetEnumerator();

View File

@@ -2,6 +2,7 @@
using System.ComponentModel;
using System.Diagnostics;
using System.Text;
using Nadeko.Common;
namespace NadekoBot.Services;

View File

@@ -1,36 +0,0 @@
#nullable disable
using Serilog.Events;
using Serilog.Sinks.SystemConsole.Themes;
using System.Text;
namespace NadekoBot.Services;
public static class LogSetup
{
public static void SetupLogger(object source)
{
Log.Logger = new LoggerConfiguration().MinimumLevel.Override("Microsoft", LogEventLevel.Information)
.MinimumLevel.Override("System", LogEventLevel.Information)
.MinimumLevel.Override("Microsoft.AspNetCore", LogEventLevel.Warning)
.Enrich.FromLogContext()
.WriteTo.Console(LogEventLevel.Information,
theme: GetTheme(),
outputTemplate:
"[{Timestamp:HH:mm:ss} {Level:u3}] | #{LogSource} | {Message:lj}{NewLine}{Exception}")
.Enrich.WithProperty("LogSource", source)
.CreateLogger();
Console.OutputEncoding = Encoding.UTF8;
}
private static ConsoleTheme GetTheme()
{
if (Environment.OSVersion.Platform == PlatformID.Unix)
return AnsiConsoleTheme.Code;
#if DEBUG
return AnsiConsoleTheme.Code;
#else
return ConsoleTheme.None;
#endif
}
}

View File

@@ -1,8 +0,0 @@
#nullable disable
namespace NadekoBot.Services;
public static class StandardConversions
{
public static double CelsiusToFahrenheit(double cel)
=> (cel * 1.8f) + 32;
}

View File

@@ -1,6 +1,7 @@
#nullable disable
using StackExchange.Redis;
using System.Web;
using Nadeko.Common;
namespace NadekoBot.Services;