mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-12 00:30:11 +00:00
feat: implement system serveravatar commands
This commit is contained in:
parent
b62340cbb3
commit
6a840f768f
3 changed files with 104 additions and 86 deletions
|
|
@ -69,6 +69,19 @@ public partial class CommandTree
|
|||
Commands.SystemShowAvatar(var param, var flags) => ctx.Execute<SystemEdit>(SystemAvatar, m => m.ShowAvatar(ctx, param.target, flags.GetReplyFormat())),
|
||||
Commands.SystemClearAvatar(var param, var flags) => ctx.Execute<SystemEdit>(SystemAvatar, m => m.ClearAvatar(ctx, ctx.System, flags.yes)),
|
||||
Commands.SystemChangeAvatar(var param, _) => ctx.Execute<SystemEdit>(SystemAvatar, m => m.ChangeAvatar(ctx, ctx.System, param.avatar)),
|
||||
Commands.SystemShowServerAvatarSelf(_, var flags) => ((Func<Task>)(() =>
|
||||
{
|
||||
// we want to change avatar if an attached image is passed
|
||||
// we can't have a separate parsed command for this since the parser can't be aware of any attachments
|
||||
var attachedImage = ctx.ExtractImageFromAttachment();
|
||||
if (attachedImage is { } image)
|
||||
return ctx.Execute<SystemEdit>(SystemServerAvatar, m => m.ChangeServerAvatar(ctx, ctx.System, image));
|
||||
// if no attachment show the avatar like intended
|
||||
return ctx.Execute<SystemEdit>(SystemServerAvatar, m => m.ShowServerAvatar(ctx, ctx.System, flags.GetReplyFormat()));
|
||||
}))(),
|
||||
Commands.SystemShowServerAvatar(var param, var flags) => ctx.Execute<SystemEdit>(SystemServerAvatar, m => m.ShowServerAvatar(ctx, param.target, flags.GetReplyFormat())),
|
||||
Commands.SystemClearServerAvatar(var param, var flags) => ctx.Execute<SystemEdit>(SystemServerAvatar, m => m.ClearServerAvatar(ctx, ctx.System, flags.yes)),
|
||||
Commands.SystemChangeServerAvatar(var param, _) => ctx.Execute<SystemEdit>(SystemServerAvatar, m => m.ChangeServerAvatar(ctx, ctx.System, param.avatar)),
|
||||
_ =>
|
||||
// this should only ever occur when deving if commands are not implemented...
|
||||
ctx.Reply(
|
||||
|
|
@ -319,9 +332,6 @@ public partial class CommandTree
|
|||
{
|
||||
if (ctx.Match("banner", "splash", "cover"))
|
||||
await ctx.CheckSystem(target).Execute<SystemEdit>(SystemBannerImage, m => m.BannerImage(ctx, target));
|
||||
else if (ctx.Match("serveravatar", "sa", "servericon", "serverimage", "serverpfp", "serverpic", "savatar", "spic",
|
||||
"guildavatar", "guildpic", "guildicon", "sicon", "spfp"))
|
||||
await ctx.CheckSystem(target).Execute<SystemEdit>(SystemServerAvatar, m => m.ServerAvatar(ctx, target));
|
||||
else if (ctx.Match("list", "l", "members", "ls"))
|
||||
await ctx.CheckSystem(target).Execute<SystemList>(SystemList, m => m.MemberList(ctx, target));
|
||||
else if (ctx.Match("find", "search", "query", "fd", "s"))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue