Updated base project files

This commit is contained in:
Toastie (DCS Team) 2024-06-18 23:45:23 +12:00
parent 547aa8b34d
commit 34eb87b13d
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4
3 changed files with 226 additions and 256 deletions

View file

@ -1,28 +1,26 @@
#nullable disable #nullable disable
using DryIoc;
using Microsoft.Extensions.Caching.Memory;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using EllieBot.Common.Configs; using EllieBot.Common.Configs;
using EllieBot.Common.ModuleBehaviors; using EllieBot.Common.ModuleBehaviors;
using EllieBot.Db; using EllieBot.Db.Models;
using EllieBot.Modules.Utility;
using EllieBot.Services.Database.Models;
using System.Collections.Immutable; using System.Collections.Immutable;
using System.Diagnostics; using System.Diagnostics;
using System.Net;
using System.Reflection; using System.Reflection;
using RunMode = Discord.Commands.RunMode; using RunMode = Discord.Commands.RunMode;
namespace EllieBot; namespace EllieBot;
public sealed class Bot public sealed class Bot : IBot
{ {
public event Func<GuildConfig, Task> JoinedGuild = delegate { return Task.CompletedTask; }; public event Func<GuildConfig, Task> JoinedGuild = delegate { return Task.CompletedTask; };
public DiscordSocketClient Client { get; } public DiscordSocketClient Client { get; }
public ImmutableArray<GuildConfig> AllGuildConfigs { get; private set; } public IReadOnlyCollection<GuildConfig> AllGuildConfigs { get; private set; }
private IServiceProvider Services { get; set; } private IContainer Services { get; set; }
public string Mention { get; private set; }
public bool IsReady { get; private set; } public bool IsReady { get; private set; }
public int ShardId { get; set; } public int ShardId { get; set; }
@ -31,18 +29,19 @@ public sealed class Bot
private readonly DbService _db; private readonly DbService _db;
private readonly IBotCredsProvider _credsProvider; private readonly IBotCredsProvider _credsProvider;
private readonly Assembly[] _loadedAssemblies;
// private readonly InteractionService _interactionService; // private readonly InteractionService _interactionService;
public Bot(int shardId, int? totalShards, string credPath = null) public Bot(int shardId, int? totalShards, string credPath = null)
{ {
if (shardId < 0) ArgumentOutOfRangeException.ThrowIfLessThan(shardId, 0);
throw new ArgumentOutOfRangeException(nameof(shardId));
ShardId = shardId; ShardId = shardId;
_credsProvider = new BotCredsProvider(totalShards, credPath); _credsProvider = new BotCredsProvider(totalShards, credPath);
_creds = _credsProvider.GetCreds(); _creds = _credsProvider.GetCreds();
_db = new(_credsProvider); _db = new EllieDbService(_credsProvider);
var messageCacheSize = var messageCacheSize =
#if GLOBAL_ELLIE #if GLOBAL_ELLIE
@ -51,7 +50,7 @@ public sealed class Bot
50; 50;
#endif #endif
if(!_creds.UsePrivilegedIntents) if (!_creds.UsePrivilegedIntents)
Log.Warning("You are not using privileged intents. Some features will not work properly"); Log.Warning("You are not using privileged intents. Some features will not work properly");
Client = new(new() Client = new(new()
@ -81,10 +80,14 @@ public sealed class Bot
// _interactionService = new(Client.Rest); // _interactionService = new(Client.Rest);
Client.Log += Client_Log; Client.Log += Client_Log;
_loadedAssemblies =
[
typeof(Bot).Assembly // bot
];
} }
public List<ulong> GetCurrentGuildIds() public IReadOnlyList<ulong> GetCurrentGuildIds()
=> Client.Guilds.Select(x => x.Id).ToList(); => Client.Guilds.Select(x => x.Id).ToList();
private void AddServices() private void AddServices()
@ -96,120 +99,89 @@ public sealed class Bot
using (var uow = _db.GetDbContext()) using (var uow = _db.GetDbContext())
{ {
uow.EnsureUserCreated(bot.Id, bot.Username, bot.Discriminator, bot.AvatarId); uow.EnsureUserCreated(bot.Id, bot.Username, bot.Discriminator, bot.AvatarId);
AllGuildConfigs = uow.GuildConfigs.GetAllGuildConfigs(startingGuildIdList).ToImmutableArray(); AllGuildConfigs = uow.Set<GuildConfig>().GetAllGuildConfigs(startingGuildIdList).ToImmutableArray();
} }
var svcs = new ServiceCollection().AddTransient(_ => _credsProvider.GetCreds()) // bot creds // var svcs = new StandardKernel(new NinjectSettings()
.AddSingleton(_credsProvider) // {
.AddSingleton(_db) // database // // ThrowOnGetServiceNotFound = true,
.AddSingleton(Client) // discord socket client // ActivationCacheDisabled = true,
.AddSingleton(_commandService) // });
// .AddSingleton(_interactionService)
.AddSingleton(this) var svcs = new Container();
.AddSingleton<ISeria, JsonSeria>()
.AddSingleton<IConfigSeria, YamlSeria>() // this is required in order for medusa unloading to work
.AddConfigServices() // svcs.Components.Remove<IPlanner, Planner>();
.AddConfigMigrators() // svcs.Components.Add<IPlanner, RemovablePlanner>();
.AddMemoryCache()
// music svcs.AddSingleton<IBotCredentials, IBotCredentials>(_ => _credsProvider.GetCreds());
.AddMusic() svcs.AddSingleton<DbService, DbService>(_db);
// cache svcs.AddSingleton<IBotCredsProvider>(_credsProvider);
.AddCache(_creds); svcs.AddSingleton<DiscordSocketClient>(Client);
svcs.AddSingleton<CommandService>(_commandService);
svcs.AddSingleton<Bot>(this);
svcs.AddSingleton<IBot>(this);
svcs.AddSingleton<ISeria, JsonSeria>();
svcs.AddSingleton<IConfigSeria, YamlSeria>();
svcs.AddSingleton<IMemoryCache, MemoryCache>(new MemoryCache(new MemoryCacheOptions()));
svcs.AddSingleton<IBehaviorHandler, BehaviorHandler>();
svcs.AddSingleton<ILocalization, Localization>();
svcs.AddHttpClient(); foreach (var a in _loadedAssemblies)
svcs.AddHttpClient("memelist") {
.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler svcs.AddConfigServices(a)
{ .AddLifetimeServices(a);
AllowAutoRedirect = false }
});
svcs.AddHttpClient("google:search") svcs.AddMusic()
.ConfigurePrimaryHttpMessageHandler(() => new HttpClientHandler() .AddCache(_creds)
{ .AddHttpClients();
AutomaticDecompression = DecompressionMethods.GZip | DecompressionMethods.Deflate
});
if (Environment.GetEnvironmentVariable("ELLIE_IS_COORDINATED") != "1") if (Environment.GetEnvironmentVariable("ELLIEBOT_IS_COORDINATED") != "1")
{
svcs.AddSingleton<ICoordinator, SingleProcessCoordinator>(); svcs.AddSingleton<ICoordinator, SingleProcessCoordinator>();
}
else else
{ {
svcs.AddSingleton<RemoteGrpcCoordinator>() svcs.AddSingleton<RemoteGrpcCoordinator>();
.AddSingleton<ICoordinator>(x => x.GetRequiredService<RemoteGrpcCoordinator>()) svcs.AddSingleton<ICoordinator>(_ => svcs.GetRequiredService<RemoteGrpcCoordinator>());
.AddSingleton<IReadyExecutor>(x => x.GetRequiredService<RemoteGrpcCoordinator>()); svcs.AddSingleton<IReadyExecutor>(_ => svcs.GetRequiredService<RemoteGrpcCoordinator>());
} }
svcs.Scan(scan => scan.FromAssemblyOf<IReadyExecutor>() svcs.AddSingleton<IServiceProvider>(svcs);
.AddClasses(classes => classes.AssignableToAny(
// services
typeof(IEService),
// behaviours
typeof(IExecOnMessage),
typeof(IInputTransformer),
typeof(IExecPreCommand),
typeof(IExecPostCommand),
typeof(IExecNoCommand))
.WithoutAttribute<DontAddToIocContainerAttribute>()
#if GLOBAL_ELLIE
.WithoutAttribute<NoPublicBotAttribute>()
#endif
)
.AsSelfWithInterfaces()
.WithSingletonLifetime());
//initialize Services //initialize Services
Services = svcs.BuildServiceProvider(); Services = svcs;
Services.GetRequiredService<IBehaviorHandler>().Initialize(); Services.GetRequiredService<IBehaviorHandler>().Initialize();
Services.GetRequiredService<CurrencyRewardService>();
if (Client.ShardId == 0) foreach (var a in _loadedAssemblies)
ApplyConfigMigrations(); {
LoadTypeReaders(a);
_ = LoadTypeReaders(typeof(Bot).Assembly); }
sw.Stop(); sw.Stop();
Log.Information( "All services loaded in {ServiceLoadTime:F2}s", sw.Elapsed.TotalSeconds); Log.Information("All services loaded in {ServiceLoadTime:F2}s", sw.Elapsed.TotalSeconds);
} }
private void ApplyConfigMigrations() private void LoadTypeReaders(Assembly assembly)
{ {
// execute all migrators var filteredTypes = assembly.GetExportedTypes()
var migrators = Services.GetServices<IConfigMigrator>(); .Where(x => x.IsSubclassOf(typeof(TypeReader))
foreach (var migrator in migrators)
migrator.EnsureMigrated();
}
private IEnumerable<object> LoadTypeReaders(Assembly assembly)
{
Type[] allTypes;
try
{
allTypes = assembly.GetTypes();
}
catch (ReflectionTypeLoadException ex)
{
Log.Warning(ex.LoaderExceptions[0], "Error getting types");
return Enumerable.Empty<object>();
}
var filteredTypes = allTypes.Where(x => x.IsSubclassOf(typeof(TypeReader))
&& x.BaseType?.GetGenericArguments().Length > 0 && x.BaseType?.GetGenericArguments().Length > 0
&& !x.IsAbstract); && !x.IsAbstract);
var toReturn = new List<object>();
foreach (var ft in filteredTypes) foreach (var ft in filteredTypes)
{ {
var x = (TypeReader)ActivatorUtilities.CreateInstance(Services, ft);
var baseType = ft.BaseType; var baseType = ft.BaseType;
if (baseType is null) if (baseType is null)
continue; continue;
var typeArgs = baseType.GetGenericArguments();
_commandService.AddTypeReader(typeArgs[0], x);
toReturn.Add(x);
}
return toReturn; var typeReader = (TypeReader)ActivatorUtilities.CreateInstance(Services, ft);
var typeArgs = baseType.GetGenericArguments();
_commandService.AddTypeReader(typeArgs[0], typeReader);
}
} }
private async Task LoginAsync(string token) private async Task LoginAsync(string token)
@ -291,7 +263,6 @@ public sealed class Bot
await LoginAsync(_creds.Token); await LoginAsync(_creds.Token);
Mention = Client.CurrentUser.Mention;
Log.Information("Shard {ShardId} loading services...", Client.ShardId); Log.Information("Shard {ShardId} loading services...", Client.ShardId);
try try
{ {
@ -310,7 +281,11 @@ public sealed class Bot
// start handling messages received in commandhandler // start handling messages received in commandhandler
await commandHandler.StartHandling(); await commandHandler.StartHandling();
await _commandService.AddModulesAsync(typeof(Bot).Assembly, Services); foreach (var a in _loadedAssemblies)
{
await _commandService.AddModulesAsync(a, Services);
}
// await _interactionService.AddModulesAsync(typeof(Bot).Assembly, Services); // await _interactionService.AddModulesAsync(typeof(Bot).Assembly, Services);
IsReady = true; IsReady = true;
@ -364,26 +339,27 @@ public sealed class Bot
if (arg.Exception is { InnerException: WebSocketClosedException { CloseCode: 4014 } }) if (arg.Exception is { InnerException: WebSocketClosedException { CloseCode: 4014 } })
{ {
Log.Error(@" Log.Error("""
Login failed. Login failed.
*** Please enable privileged intents *** *** Please enable privileged intents ***
Certain Ellie features require Discord's privileged gateway intents. Certain Ellie features require Discord's privileged gateway intents.
These include greeting and goodbye messages, as well as creating the Owner message channels for DM forwarding. These include greeting and goodbye messages, as well as creating the Owner message channels for DM forwarding.
How to enable privileged intents: How to enable privileged intents:
1. Head over to the Discord Developer Portal https://discord.com/developers/applications/ 1. Head over to the Discord Developer Portal https://discord.com/developers/applications/
2. Select your Application. 2. Select your Application.
3. Click on `Bot` in the left side navigation panel, and scroll down to the intents section. 3. Click on `Bot` in the left side navigation panel, and scroll down to the intents section.
4. Enable all intents. 4. Enable all intents.
5. Restart your bot. 5. Restart your bot.
Read this only if your bot is in 100 or more servers: Read this only if your bot is in 100 or more servers:
You'll need to apply to use the intents with Discord, but for small selfhosts, all that is required is enabling the intents in the developer portal. You'll need to apply to use the intents with Discord, but for small selfhosts, all that is required is enabling the intents in the developer portal.
Yes, this is a new thing from Discord, as of October 2020. No, there's nothing we can do about it. Yes, we're aware it worked before. Yes, this is a new thing from Discord, as of October 2020. No, there's nothing we can do about it. Yes, we're aware it worked before.
While waiting for your bot to be accepted, you can change the 'usePrivilegedIntents' inside your creds.yml to 'false', although this will break many of the ellie's features"); While waiting for your bot to be accepted, you can change the 'usePrivilegedIntents' inside your creds.yml to 'false', although this will break many of the ellie's features
""");
return Task.CompletedTask; return Task.CompletedTask;
} }

View file

@ -1,7 +0,0 @@
<Project>
<ItemDefinitionGroup>
<ProjectReference>
<PrivateAssets>all</PrivateAssets>
</ProjectReference>
</ItemDefinitionGroup>
</Project>

View file

@ -1,142 +1,143 @@
<Project Sdk="Microsoft.NET.Sdk"> <Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup> <PropertyGroup>
<TargetFramework>net6.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<LangVersion>preview</LangVersion> <Nullable>enable</Nullable>
<Nullable>enable</Nullable> <ImplicitUsings>true</ImplicitUsings>
<EnablePreviewFeatures>true</EnablePreviewFeatures> <SatelliteResourceLanguages>en</SatelliteResourceLanguages>
<ImplicitUsings>true</ImplicitUsings> <Version>5.0.8</Version>
<!-- Output/build --> <!-- Output/build -->
<RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory> <RunWorkingDirectory>$(MSBuildProjectDirectory)</RunWorkingDirectory>
<OutputType>exe</OutputType> <OutputType>exe</OutputType>
<ApplicationIcon>ellie_icon.ico</ApplicationIcon> <ApplicationIcon>ellie_icon.ico</ApplicationIcon>
<!-- Analysis/Warnings --> <!-- Analysis/Warnings -->
<!-- <AnalysisMode>Recommended</AnalysisMode>--> <!-- <AnalysisMode>Recommended</AnalysisMode>-->
<!-- <AnalysisModeGlobalization>None</AnalysisModeGlobalization>--> <!-- <AnalysisModeGlobalization>None</AnalysisModeGlobalization>-->
<NoWarn>CS1066</NoWarn> <NoWarn>CS1066;CS8981</NoWarn>
</PropertyGroup>
<ItemGroup> <!-- Profile-guided optimization -->
<PackageReference Include="AngleSharp" Version="0.17.1"> <TieredPGO>true</TieredPGO>
<PrivateAssets>all</PrivateAssets> <DebugType>embedded</DebugType>
<Publish>True</Publish>
</PackageReference>
<PackageReference Include="AWSSDK.S3" Version="3.7.9.25" />
<PackageReference Include="CodeHollow.FeedReader" Version="1.2.4" />
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="CsvHelper" Version="28.0.1" />
<PackageReference Include="Discord.Net" Version="3.203.0" />
<PackageReference Include="CoreCLR-NCalc" Version="2.2.110" />
<PackageReference Include="Google.Apis.Urlshortener.v1" Version="1.41.1.138" />
<PackageReference Include="Google.Apis.YouTube.v3" Version="1.62.1.3205" />
<PackageReference Include="Google.Apis.Customsearch.v1" Version="1.49.0.2084" />
<PackageReference Include="Google.Protobuf" Version="3.21.2" />
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.47.0" />
<PackageReference Include="Grpc.Tools" Version="2.47.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Html2Markdown" Version="5.0.2.561" />
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.2.0" />
<PackageReference Include="Microsoft.Extensions.Configuration" Version="6.0.1" /> </PropertyGroup>
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="6.0.1" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="6.0.0" />
<PackageReference Include="MorseCode.ITask" Version="2.0.3" />
<PackageReference Include="NetEscapades.Configuration.Yaml" Version="2.2.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Http" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Console" Version="6.0.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="6.0.0" />
<PackageReference Include="Microsoft.SyndicationFeed.ReaderWriter" Version="1.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NonBlocking" Version="2.1.0" />
<PackageReference Include="OneOf" Version="3.0.223" />
<PackageReference Include="Scrutor" Version="4.2.0" />
<PackageReference Include="Serilog.Sinks.Console" Version="4.0.1" />
<PackageReference Include="Serilog.Sinks.Seq" Version="5.1.1" />
<PackageReference Include="SharpToken" Version="1.2.14" />
<PackageReference Include="SixLabors.Fonts" Version="1.0.0-beta17" />
<PackageReference Include="SixLabors.ImageSharp" Version="2.1.7" />
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta14" />
<PackageReference Include="SixLabors.Shapes" Version="1.0.0-beta0009" />
<PackageReference Include="StackExchange.Redis" Version="2.6.48" />
<PackageReference Include="YamlDotNet" Version="11.2.1" />
<PackageReference Include="Humanizer" Version="2.14.1"> <ItemGroup>
<PrivateAssets>all</PrivateAssets> <PackageReference Include="AngleSharp" Version="1.1.2">
<Publish>True</Publish> <PrivateAssets>all</PrivateAssets>
</PackageReference> <Publish>True</Publish>
</PackageReference>
<PackageReference Include="CodeHollow.FeedReader" Version="1.2.6" />
<PackageReference Include="CommandLineParser" Version="2.9.1" />
<PackageReference Include="Discord.Net" Version="3.204.0" />
<PackageReference Include="CoreCLR-NCalc" Version="3.1.246" />
<PackageReference Include="Google.Apis.Urlshortener.v1" Version="1.41.1.138" />
<PackageReference Include="Google.Apis.YouTube.v3" Version="1.68.0.3414" />
<PackageReference Include="Google.Apis.Customsearch.v1" Version="1.49.0.2084" />
<!-- <PackageReference Include="Grpc.AspNetCore" Version="2.62.0" />-->
<PackageReference Include="Google.Protobuf" Version="3.26.1" />
<PackageReference Include="Grpc.Net.ClientFactory" Version="2.62.0" />
<PackageReference Include="Grpc.Tools" Version="2.63.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Scripting" Version="4.5.0" />
<PackageReference Include="JetBrains.Annotations" Version="2022.1.0" /> <PackageReference Include="Microsoft.Extensions.Configuration" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="8.0.0" />
<PackageReference Include="Microsoft.Extensions.Configuration.Json" Version="8.0.0" />
<!-- Db-related packages --> <PackageReference Include="MorseCode.ITask" Version="2.0.3" />
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="6.0.7" /> <PackageReference Include="NetEscapades.Configuration.Yaml" Version="3.1.0" />
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="6.0.7">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
<PackageReference Include="linq2db.EntityFrameworkCore" Version="6.8.0" /> <!-- DI -->
<!-- <PackageReference Include="Ninject" Version="3.3.6"/>-->
<!-- <PackageReference Include="Ninject.Extensions.Conventions" Version="3.3.0"/>-->
<!-- <PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="8.0.0" />-->
<PackageReference Include="Microsoft.Extensions.DependencyInjection.Abstractions" Version="8.0.1" />
<PackageReference Include="DryIoc.dll" Version="5.4.3" />
<!-- <PackageReference Include="Scrutor" Version="4.2.0" />-->
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="6.0.7" /> <PackageReference Include="Microsoft.Extensions.Http" Version="8.0.0" />
<PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="6.0.5" /> <PackageReference Include="Microsoft.Extensions.Logging.Console" Version="8.0.0" />
<PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="6.0.1" /> <PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
<PackageReference Include="Microsoft.SyndicationFeed.ReaderWriter" Version="1.0.2" />
<PackageReference Include="Newtonsoft.Json" Version="13.0.3" />
<PackageReference Include="NonBlocking" Version="2.1.2" />
<PackageReference Include="OneOf" Version="3.0.263" />
<PackageReference Include="OneOf.SourceGenerator" Version="3.0.263" />
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.1" />
<PackageReference Include="Serilog.Sinks.Seq" Version="7.0.1" />
<!-- Used by stream notifications --> <PackageReference Include="SixLabors.Fonts" Version="1.0.0-beta17" />
<PackageReference Include="TwitchLib.Api" Version="3.4.1" /> <PackageReference Include="SixLabors.ImageSharp" Version="2.1.8" />
<PackageReference Include="SixLabors.ImageSharp.Drawing" Version="1.0.0-beta14" />
<PackageReference Include="SixLabors.Shapes" Version="1.0.0-beta0009" />
<PackageReference Include="StackExchange.Redis" Version="2.7.33" />
<PackageReference Include="YamlDotNet" Version="15.1.4" />
<PackageReference Include="SharpToken" Version="2.0.2" />
<!-- Uncomment to check for disposable issues --> <PackageReference Include="JetBrains.Annotations" Version="2023.3.0" />
<!-- <PackageReference Include="IDisposableAnalyzers" Version="4.0.2">-->
<!-- <PrivateAssets>all</PrivateAssets>-->
<!-- <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>-->
<!-- </PackageReference>-->
<PackageReference Include="EFCore.NamingConventions" Version="6.0.0" />
</ItemGroup>
<ItemGroup> <!-- Db-related packages -->
<ProjectReference Include="..\Ellie.Common\Ellie.Common.csproj" /> <PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.4" />
<ProjectReference Include="..\Ellie.Econ\Ellie.Econ.csproj" /> <PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.4">
<ProjectReference Include="..\Ellie.Marmalade\Ellie.Marmalade.csproj" /> <PrivateAssets>all</PrivateAssets>
<ProjectReference Include="..\EllieBot.Generators\EllieBot.Generators.csproj" OutputItemType="Analyzer" /> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</ItemGroup> </PackageReference>
<ItemGroup> <PackageReference Include="linq2db.EntityFrameworkCore" Version="8.1.0" />
<AdditionalFiles Include="data\strings\responses\responses.en-US.json" />
</ItemGroup>
<ItemGroup>
<Protobuf Include="..\EllieBot.Coordinator\Protos\coordinator.proto" GrpcServices="Client">
<Link>Protos\coordinator.proto</Link>
</Protobuf>
<None Update="data\**\*">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="ellie_icon.ico;libopus.so;libsodium.so;libsodium.dll;opus.dll">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="creds.yml;creds_example.yml">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<PropertyGroup Condition=" '$(Version)' == '' "> <PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="8.0.4" />
<VersionPrefix Condition=" '$(VersionPrefix)' == '' ">4.0.0</VersionPrefix> <PackageReference Include="Npgsql.EntityFrameworkCore.PostgreSQL" Version="8.0.4" />
<Version Condition=" '$(VersionSuffix)' != '' ">$(VersionPrefix).$(VersionSuffix)</Version> <PackageReference Include="Pomelo.EntityFrameworkCore.MySql" Version="8.0.2" />
<Version Condition=" '$(Version)' == '' ">$(VersionPrefix)</Version>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'GlobalEllie' "> <PackageReference Include="EFCore.NamingConventions" Version="8.0.3" />
<!-- Define trace doesn't seem to affect the build at all so I had to remove $(DefineConstants)-->
<DefineTrace>false</DefineTrace>
<DefineConstants>GLOBAL_ELLIE</DefineConstants>
<NoWarn>$(NoWarn);CS1573;CS1591</NoWarn>
<Optimize>true</Optimize>
<DebugType>portable</DebugType>
<DebugSymbols>false</DebugSymbols>
</PropertyGroup>
<!-- Used by stream notifications -->
<PackageReference Include="TwitchLib.Api" Version="3.4.1" />
<!-- sqlselectcsv and stock -->
<PackageReference Include="CsvHelper" Version="32.0.3" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Ellie.Marmalade\Ellie.Marmalade.csproj" />
<ProjectReference Include="..\EllieBot.Voice\EllieBot.Voice.csproj" />
<ProjectReference Include="..\EllieBot.Generators\EllieBot.Generators.csproj" OutputItemType="Analyzer" />
</ItemGroup>
<ItemGroup>
<AdditionalFiles Include="data\strings\responses\responses.en-US.json" />
</ItemGroup>
<ItemGroup>
<Protobuf Include="..\EllieBot.Coordinator\Protos\coordinator.proto" GrpcServices="Client">
<Link>Protos\coordinator.proto</Link>
</Protobuf>
<None Update="data\**\*">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="creds.yml">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="creds_example.yml">
<ExcludeFromSingleFile>true</ExcludeFromSingleFile>
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
<PropertyGroup Condition=" '$(Configuration)' == 'GlobalEllie' ">
<!-- Define trace doesn't seem to affect the build at all so I had to remove $(DefineConstants)-->
<DefineTrace>false</DefineTrace>
<DefineConstants>GLOBAL_ELLIE</DefineConstants>
<NoWarn>$(NoWarn);CS1573;CS1591</NoWarn>
<Optimize>true</Optimize>
<DebugType>portable</DebugType>
<DebugSymbols>false</DebugSymbols>
</PropertyGroup>
</Project> </Project>