bot: enable .NET configuration management

This commit is contained in:
Ske
2019-05-08 20:08:56 +02:00
parent c5d2b7c251
commit 9b49f22048
5 changed files with 33 additions and 11 deletions

View File

@@ -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) {