Add system avatar command (which I totally forgot)
This commit is contained in:
parent
6f082de40e
commit
5599f0a4a8
@ -4,6 +4,7 @@ using System.Runtime.Serialization;
|
|||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Dapper;
|
using Dapper;
|
||||||
|
using Discord;
|
||||||
using Discord.Commands;
|
using Discord.Commands;
|
||||||
using NodaTime;
|
using NodaTime;
|
||||||
using NodaTime.Extensions;
|
using NodaTime.Extensions;
|
||||||
@ -98,6 +99,22 @@ namespace PluralKit.Bot.Commands
|
|||||||
await Context.Channel.SendMessageAsync($"{Emojis.Success} System tag {(newTag != null ? "changed" : "cleared")}.");
|
await Context.Channel.SendMessageAsync($"{Emojis.Success} System tag {(newTag != null ? "changed" : "cleared")}.");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Command("avatar")]
|
||||||
|
[Alias("profile", "picture", "icon", "image", "pic", "pfp")]
|
||||||
|
[Remarks("system avatar <avatar url>")]
|
||||||
|
[MustHaveSystem]
|
||||||
|
public async Task SystemAvatar([Remainder] string avatarUrl = null)
|
||||||
|
{
|
||||||
|
string url = avatarUrl ?? Context.Message.Attachments.FirstOrDefault()?.ProxyUrl;
|
||||||
|
if (url != null) await Context.BusyIndicator(() => Utils.VerifyAvatarOrThrow(url));
|
||||||
|
|
||||||
|
Context.SenderSystem.AvatarUrl = url;
|
||||||
|
await Systems.Save(Context.SenderSystem);
|
||||||
|
|
||||||
|
var embed = url != null ? new EmbedBuilder().WithImageUrl(url).Build() : null;
|
||||||
|
await Context.Channel.SendMessageAsync($"{Emojis.Success} System avatar {(url == null ? "cleared" : "changed")}.", embed: embed);
|
||||||
|
}
|
||||||
|
|
||||||
[Command("delete")]
|
[Command("delete")]
|
||||||
[Alias("remove", "destroy", "erase", "yeet")]
|
[Alias("remove", "destroy", "erase", "yeet")]
|
||||||
[Remarks("system delete")]
|
[Remarks("system delete")]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user