Fix changing autoproxy settings with no system_guild row

This commit is contained in:
Ske 2020-06-24 17:50:12 +02:00
parent 2e8d044ca5
commit 50b5a8fbee

View File

@ -126,7 +126,7 @@ namespace PluralKit.Bot
private Task UpdateAutoproxy(Context ctx, AutoproxyMode autoproxyMode, MemberId? autoproxyMember) => private Task UpdateAutoproxy(Context ctx, AutoproxyMode autoproxyMode, MemberId? autoproxyMember) =>
_db.Execute(c => _db.Execute(c =>
c.ExecuteAsync( c.ExecuteAsync(
"update system_guild set autoproxy_mode = @autoproxyMode, autoproxy_member = @autoproxyMember where guild = @guild and system = @system", "insert into system_guild (system, guild, autoproxy_mode, autoproxy_member) values (@system, @guild, @autoproxyMode, @autoproxyMember) on conflict (system, guild) do update set autoproxy_mode = @autoproxyMode, autoproxy_member = @autoproxyMember",
new {autoproxyMode, autoproxyMember, guild = ctx.Guild.Id, system = ctx.System.Id})); new {autoproxyMode, autoproxyMember, guild = ctx.Guild.Id, system = ctx.System.Id}));
} }
} }