mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-14 01:30:13 +00:00
fix(bot): don't try to get system guild settings while not in a guild (#576)
This commit is contained in:
parent
87337d695b
commit
084df88624
1 changed files with 4 additions and 2 deletions
|
|
@ -134,10 +134,12 @@ public class SystemFront
|
||||||
if (rangeStart.Value.ToInstant() > now) throw Errors.FrontPercentTimeInFuture;
|
if (rangeStart.Value.ToInstant() > now) throw Errors.FrontPercentTimeInFuture;
|
||||||
|
|
||||||
var title = new StringBuilder("Frontpercent of ");
|
var title = new StringBuilder("Frontpercent of ");
|
||||||
var guildSettings = await ctx.Repository.GetSystemGuild(ctx.Guild.Id, system.Id);
|
SystemGuildSettings guildSettings = null;
|
||||||
|
if (ctx.Guild != null)
|
||||||
|
guildSettings = await ctx.Repository.GetSystemGuild(ctx.Guild.Id, system.Id);
|
||||||
if (group != null)
|
if (group != null)
|
||||||
title.Append($"{group.NameFor(ctx)} (`{group.Hid}`)");
|
title.Append($"{group.NameFor(ctx)} (`{group.Hid}`)");
|
||||||
else if (guildSettings.DisplayName != null)
|
else if (ctx.Guild != null && guildSettings.DisplayName != null)
|
||||||
title.Append($"{guildSettings.DisplayName} (`{system.Hid}`)");
|
title.Append($"{guildSettings.DisplayName} (`{system.Hid}`)");
|
||||||
else if (system.NameFor(ctx) != null)
|
else if (system.NameFor(ctx) != null)
|
||||||
title.Append($"{system.NameFor(ctx)} (`{system.Hid}`)");
|
title.Append($"{system.NameFor(ctx)} (`{system.Hid}`)");
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue