fix: allow servernameformat to be run in DMs

This commit is contained in:
rladenson 2024-11-20 16:28:42 -07:00 committed by Petal Ladenson
parent ec6cbb2a64
commit c0bc2163f5

View file

@ -137,12 +137,24 @@ public class Config
ProxyMember.DefaultFormat ProxyMember.DefaultFormat
)); ));
items.Add(new( if (ctx.Guild == null)
"Server Name Format", {
"Format string used to display a member's name in the current server", items.Add(new(
(await ctx.Repository.GetSystemGuild(ctx.Guild.Id, ctx.System.Id)).NameFormat ?? "none set", "Server Name Format",
"none set" "Format string used to display a member's name in the current server",
)); "only available in servers",
"only available in servers"
));
}
else
{
items.Add(new(
"Server Name Format",
"Format string used to display a member's name in the current server",
(await ctx.Repository.GetSystemGuild(ctx.Guild.Id, ctx.System.Id)).NameFormat ?? "none set",
"none set"
));
}
await ctx.Paginate<PaginatedConfigItem>( await ctx.Paginate<PaginatedConfigItem>(
items.ToAsyncEnumerable(), items.ToAsyncEnumerable(),
@ -593,6 +605,7 @@ public class Config
public async Task ServerNameFormat(Context ctx) public async Task ServerNameFormat(Context ctx)
{ {
ctx.CheckGuildContext();
var clearFlag = ctx.MatchClear(); var clearFlag = ctx.MatchClear();
var format = ctx.MatchFormat(); var format = ctx.MatchFormat();