Do the Big Rename
This commit is contained in:
@@ -46,11 +46,11 @@ namespace PluralKit.Bot
|
||||
if (newName.Contains(" ")) await ctx.Reply($"{Emojis.Note} Note that this member's name now contains spaces. You will need to surround it with \"double quotes\" when using commands referring to it.");
|
||||
if (target.DisplayName != null) await ctx.Reply($"{Emojis.Note} Note that this member has a display name set ({target.DisplayName}), and will be proxied using that name instead.");
|
||||
|
||||
if (ctx.GuildNew != null)
|
||||
if (ctx.Guild != null)
|
||||
{
|
||||
var memberGuildConfig = await _db.Execute(c => _repo.GetMemberGuild(c, ctx.GuildNew.Id, target.Id));
|
||||
var memberGuildConfig = await _db.Execute(c => _repo.GetMemberGuild(c, ctx.Guild.Id, target.Id));
|
||||
if (memberGuildConfig.DisplayName != null)
|
||||
await ctx.Reply($"{Emojis.Note} Note that this member has a server name set ({memberGuildConfig.DisplayName}) in this server ({ctx.GuildNew.Name}), and will be proxied using that name here.");
|
||||
await ctx.Reply($"{Emojis.Note} Note that this member has a server name set ({memberGuildConfig.DisplayName}) in this server ({ctx.Guild.Name}), and will be proxied using that name here.");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -226,8 +226,8 @@ namespace PluralKit.Bot
|
||||
var lcx = ctx.LookupContextFor(target);
|
||||
|
||||
MemberGuildSettings memberGuildConfig = null;
|
||||
if (ctx.GuildNew != null)
|
||||
memberGuildConfig = await _db.Execute(c => _repo.GetMemberGuild(c, ctx.GuildNew.Id, target.Id));
|
||||
if (ctx.Guild != null)
|
||||
memberGuildConfig = await _db.Execute(c => _repo.GetMemberGuild(c, ctx.Guild.Id, target.Id));
|
||||
|
||||
var eb = new EmbedBuilder()
|
||||
.Title($"Member names")
|
||||
@@ -246,12 +246,12 @@ namespace PluralKit.Bot
|
||||
eb.Field(new("Display Name", target.DisplayName ?? "*(none)*"));
|
||||
}
|
||||
|
||||
if (ctx.GuildNew != null)
|
||||
if (ctx.Guild != null)
|
||||
{
|
||||
if (memberGuildConfig?.DisplayName != null)
|
||||
eb.Field(new($"Server Name (in {ctx.GuildNew.Name})", $"**{memberGuildConfig.DisplayName}**"));
|
||||
eb.Field(new($"Server Name (in {ctx.Guild.Name})", $"**{memberGuildConfig.DisplayName}**"));
|
||||
else
|
||||
eb.Field(new($"Server Name (in {ctx.GuildNew.Name})", memberGuildConfig?.DisplayName ?? "*(none)*"));
|
||||
eb.Field(new($"Server Name (in {ctx.Guild.Name})", memberGuildConfig?.DisplayName ?? "*(none)*"));
|
||||
}
|
||||
|
||||
return eb;
|
||||
@@ -262,11 +262,11 @@ namespace PluralKit.Bot
|
||||
async Task PrintSuccess(string text)
|
||||
{
|
||||
var successStr = text;
|
||||
if (ctx.GuildNew != null)
|
||||
if (ctx.Guild != null)
|
||||
{
|
||||
var memberGuildConfig = await _db.Execute(c => _repo.GetMemberGuild(c, ctx.GuildNew.Id, target.Id));
|
||||
var memberGuildConfig = await _db.Execute(c => _repo.GetMemberGuild(c, ctx.Guild.Id, target.Id));
|
||||
if (memberGuildConfig.DisplayName != null)
|
||||
successStr += $" However, this member has a server name set in this server ({ctx.GuildNew.Name}), and will be proxied using that name, \"{memberGuildConfig.DisplayName}\", here.";
|
||||
successStr += $" However, this member has a server name set in this server ({ctx.Guild.Name}), and will be proxied using that name, \"{memberGuildConfig.DisplayName}\", here.";
|
||||
}
|
||||
|
||||
await ctx.Reply(successStr);
|
||||
@@ -311,12 +311,12 @@ namespace PluralKit.Bot
|
||||
ctx.CheckOwnMember(target);
|
||||
|
||||
var patch = new MemberGuildPatch {DisplayName = null};
|
||||
await _db.Execute(conn => _repo.UpsertMemberGuild(conn, target.Id, ctx.GuildNew.Id, patch));
|
||||
await _db.Execute(conn => _repo.UpsertMemberGuild(conn, target.Id, ctx.Guild.Id, patch));
|
||||
|
||||
if (target.DisplayName != null)
|
||||
await ctx.Reply($"{Emojis.Success} Member server name cleared. This member will now be proxied using their global display name \"{target.DisplayName}\" in this server ({ctx.GuildNew.Name}).");
|
||||
await ctx.Reply($"{Emojis.Success} Member server name cleared. This member will now be proxied using their global display name \"{target.DisplayName}\" in this server ({ctx.Guild.Name}).");
|
||||
else
|
||||
await ctx.Reply($"{Emojis.Success} Member server name cleared. This member will now be proxied using their member name \"{target.NameFor(ctx)}\" in this server ({ctx.GuildNew.Name}).");
|
||||
await ctx.Reply($"{Emojis.Success} Member server name cleared. This member will now be proxied using their member name \"{target.NameFor(ctx)}\" in this server ({ctx.Guild.Name}).");
|
||||
}
|
||||
else if (!ctx.HasNext())
|
||||
{
|
||||
@@ -333,9 +333,9 @@ namespace PluralKit.Bot
|
||||
var newServerName = ctx.RemainderOrNull();
|
||||
|
||||
var patch = new MemberGuildPatch {DisplayName = newServerName};
|
||||
await _db.Execute(conn => _repo.UpsertMemberGuild(conn, target.Id, ctx.GuildNew.Id, patch));
|
||||
await _db.Execute(conn => _repo.UpsertMemberGuild(conn, target.Id, ctx.Guild.Id, patch));
|
||||
|
||||
await ctx.Reply($"{Emojis.Success} Member server name changed. This member will now be proxied using the name \"{newServerName}\" in this server ({ctx.GuildNew.Name}).");
|
||||
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}).");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -415,8 +415,8 @@ namespace PluralKit.Bot
|
||||
|
||||
// Get guild settings (mostly for warnings and such)
|
||||
MemberGuildSettings guildSettings = null;
|
||||
if (ctx.GuildNew != null)
|
||||
guildSettings = await _db.Execute(c => _repo.GetMemberGuild(c, ctx.GuildNew.Id, target.Id));
|
||||
if (ctx.Guild != null)
|
||||
guildSettings = await _db.Execute(c => _repo.GetMemberGuild(c, ctx.Guild.Id, target.Id));
|
||||
|
||||
async Task SetAll(PrivacyLevel level)
|
||||
{
|
||||
|
Reference in New Issue
Block a user