mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 13:06:50 +00:00
bot: enable .NET configuration management
This commit is contained in:
parent
c5d2b7c251
commit
9b49f22048
5 changed files with 33 additions and 11 deletions
7
PluralKit.Core/CoreConfig.cs
Normal file
7
PluralKit.Core/CoreConfig.cs
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
namespace PluralKit
|
||||
{
|
||||
public class CoreConfig
|
||||
{
|
||||
public string Database { get; set; }
|
||||
}
|
||||
}
|
||||
|
|
@ -7,6 +7,10 @@
|
|||
<ItemGroup>
|
||||
<PackageReference Include="Dapper" Version="1.60.6" />
|
||||
<PackageReference Include="Dapper.Contrib" Version="1.60.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Binder" Version="2.2.4" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.CommandLine" Version="2.2.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.EnvironmentVariables" Version="2.2.4" />
|
||||
<PackageReference Include="Npgsql" Version="4.0.6" />
|
||||
</ItemGroup>
|
||||
|
||||
|
|
|
|||
|
|
@ -25,15 +25,15 @@ namespace PluralKit {
|
|||
}
|
||||
|
||||
public async Task<PKSystem> GetByAccount(ulong accountId) {
|
||||
return await conn.QuerySingleAsync<PKSystem>("select systems.* from systems, accounts where accounts.system = system.id and accounts.uid = @Id", new { Id = accountId });
|
||||
return await conn.QuerySingleOrDefaultAsync<PKSystem>("select systems.* from systems, accounts where accounts.system = system.id and accounts.uid = @Id", new { Id = accountId });
|
||||
}
|
||||
|
||||
public async Task<PKSystem> GetByHid(string hid) {
|
||||
return await conn.QuerySingleAsync<PKSystem>("select * from systems where systems.hid = @Hid", new { Hid = hid.ToLower() });
|
||||
return await conn.QuerySingleOrDefaultAsync<PKSystem>("select * from systems where systems.hid = @Hid", new { Hid = hid.ToLower() });
|
||||
}
|
||||
|
||||
public async Task<PKSystem> GetByToken(string token) {
|
||||
return await conn.QuerySingleAsync<PKSystem>("select * from systems where token = @Token", new { Token = token });
|
||||
return await conn.QuerySingleOrDefaultAsync<PKSystem>("select * from systems where token = @Token", new { Token = token });
|
||||
}
|
||||
|
||||
public async Task Save(PKSystem system) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue