mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
feat: show appropriate warnings when setting tag
This commit is contained in:
parent
4782b5f825
commit
d2189dea73
1 changed files with 32 additions and 3 deletions
|
|
@ -10,6 +10,7 @@ using Myriad.Types;
|
||||||
using Newtonsoft.Json;
|
using Newtonsoft.Json;
|
||||||
|
|
||||||
using PluralKit.Core;
|
using PluralKit.Core;
|
||||||
|
using SqlKata.Compilers;
|
||||||
|
|
||||||
namespace PluralKit.Bot;
|
namespace PluralKit.Bot;
|
||||||
|
|
||||||
|
|
@ -317,7 +318,19 @@ public class SystemEdit
|
||||||
{
|
{
|
||||||
await ctx.Repository.UpdateSystem(target.Id, new SystemPatch { Tag = null });
|
await ctx.Repository.UpdateSystem(target.Id, new SystemPatch { Tag = null });
|
||||||
|
|
||||||
await ctx.Reply($"{Emojis.Success} System tag cleared.");
|
var replyStr = $"{Emojis.Success} System tag cleared.";
|
||||||
|
|
||||||
|
if (ctx.Guild != null)
|
||||||
|
{
|
||||||
|
var servertag = (await ctx.Repository.GetSystemGuild(ctx.Guild.Id, target.Id)).Tag;
|
||||||
|
if (servertag is not null)
|
||||||
|
replyStr += $"\n{Emojis.Note} You have a server tag set in this server ({servertag}) so it will still be shown on proxies.";
|
||||||
|
|
||||||
|
else if (ctx.GuildConfig.RequireSystemTag)
|
||||||
|
replyStr += $"\n{Emojis.Warn} This server requires a tag in order to proxy. If you do not add a new tag you will not be able to proxy in this server.";
|
||||||
|
}
|
||||||
|
|
||||||
|
await ctx.Reply(replyStr);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
@ -328,8 +341,24 @@ public class SystemEdit
|
||||||
|
|
||||||
await ctx.Repository.UpdateSystem(target.Id, new SystemPatch { Tag = newTag });
|
await ctx.Repository.UpdateSystem(target.Id, new SystemPatch { Tag = newTag });
|
||||||
|
|
||||||
await ctx.Reply(
|
var replyStr = $"{Emojis.Success} System tag changed (using {newTag.Length}/{Limits.MaxSystemTagLength} characters).";
|
||||||
$"{Emojis.Success} System tag changed (using {newTag.Length}/{Limits.MaxSystemTagLength} characters). Member names will now have the tag {newTag.AsCode()} when proxied.\n\nTo check or change where your tag appears in your name use the command `{ctx.DefaultPrefix}cfg name format`.");
|
if (ctx.Config.NameFormat is null || ctx.Config.NameFormat.Contains("{tag}"))
|
||||||
|
replyStr += $"Member names will now have the tag {newTag.AsCode()} when proxied.\n{Emojis.Note}To check or change where your tag appears in your name use the command `{ctx.DefaultPrefix}cfg name format`.";
|
||||||
|
else
|
||||||
|
replyStr += $"\n{Emojis.Warn} You do not have a designated place for a tag in your name format so it **will not be put in proxy names**. To change this type `{ctx.DefaultPrefix}cfg name format`.";
|
||||||
|
if (ctx.Guild != null)
|
||||||
|
{
|
||||||
|
var guildSettings = await ctx.Repository.GetSystemGuild(ctx.Guild.Id, target.Id);
|
||||||
|
|
||||||
|
if (guildSettings.Tag is not null)
|
||||||
|
replyStr += $"\n{Emojis.Note} Note that you have a server tag set ({guildSettings.Tag}) and it will be shown in proxies instead.";
|
||||||
|
if (!guildSettings.TagEnabled)
|
||||||
|
replyStr += $"\n{Emojis.Note} Note that your tag is disabled in this server and will not be shown in proxies. To change this type `{ctx.DefaultPrefix}system servertag enable`.";
|
||||||
|
if (guildSettings.NameFormat is not null && !guildSettings.NameFormat.Contains("{tag}"))
|
||||||
|
replyStr += $"\n{Emojis.Note} You do not have a designated place for a tag in your server name format so it **will not be put in proxy names**. To change this type `{ctx.DefaultPrefix}cfg server name format`.";
|
||||||
|
}
|
||||||
|
|
||||||
|
await ctx.Reply(replyStr);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue