Fix setting server name/avatar with no row in the member_guild table

This commit is contained in:
Ske 2020-06-25 22:23:15 +02:00
parent bb75519f6b
commit 4f6a4c000d
2 changed files with 2 additions and 2 deletions

View File

@ -144,7 +144,7 @@ namespace PluralKit.Bot
{
AvatarLocation.Server => _db.Execute(c =>
c.ExecuteAsync(
"update member_guild set avatar_url = @Avatar where member = @Member and guild = @Guild",
"insert into member_guild(member, guild, avatar_url) values (@Member, @Guild, @Avatar) on conflict (member, guild) do update set avatar_url = @Avatar",
new {Avatar = avatar, Guild = ctx.Guild.Id, Member = target.Id})),
AvatarLocation.Member => _db.Execute(c =>
c.ExecuteAsync(

View File

@ -331,7 +331,7 @@ namespace PluralKit.Bot
var newServerName = ctx.RemainderOrNull();
await _db.Execute(c =>
c.ExecuteAsync("update member_guild set display_name = @newServerName where member = @member and guild = @guild",
c.ExecuteAsync("insert into member_guild(member, guild, display_name) values (@member, @guild, @newServerName) on conflict (member, guild) do update set display_name = @newServerName",
new {member = target.Id, guild = ctx.Guild.Id, newServerName}));
await ctx.Reply($"{Emojis.Success} Member server name changed. This member will now be proxied using the name \"{newServerName}\" in this server ({ctx.Guild.Name}).");