mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 21:16:49 +00:00
Refactor server config models/commands
This commit is contained in:
parent
23c595f675
commit
ed511a6236
5 changed files with 77 additions and 97 deletions
14
PluralKit.Core/Models/ModelQueryExt.cs
Normal file
14
PluralKit.Core/Models/ModelQueryExt.cs
Normal file
|
|
@ -0,0 +1,14 @@
|
|||
using System;
|
||||
using System.Data;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
using Dapper;
|
||||
|
||||
namespace PluralKit.Core
|
||||
{
|
||||
public static class ModelQueryExt
|
||||
{
|
||||
public static Task<GuildConfig> QueryOrInsertGuildConfig(this IDbConnection conn, ulong guild) =>
|
||||
conn.QueryFirstOrDefaultAsync<GuildConfig>("insert into servers (id) values (@Guild) on conflict do nothing returning *", new {Guild = guild});
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue