Allow setting member avatar by mention
This commit is contained in:
parent
e0a93ba608
commit
003f64abbd
@ -186,6 +186,20 @@ namespace PluralKit.Bot.Commands
|
||||
await Context.Channel.SendMessageAsync($"{Emojis.Success} Member deleted.");
|
||||
}
|
||||
|
||||
[Command("avatar")]
|
||||
[Alias("profile", "picture", "icon", "image", "pic", "pfp")]
|
||||
[Remarks("member <member> avatar <avatar url>")]
|
||||
[MustPassOwnMember]
|
||||
public async Task MemberAvatarByMention(IUser member)
|
||||
{
|
||||
if (member.AvatarId == null) throw Errors.UserHasNoAvatar;
|
||||
ContextEntity.AvatarUrl = member.GetAvatarUrl(ImageFormat.Png, size: 256);
|
||||
|
||||
var embed = new EmbedBuilder().WithImageUrl(ContextEntity.AvatarUrl).Build();
|
||||
await Context.Channel.SendMessageAsync(
|
||||
$"{Emojis.Success} Member avatar changed to {member.Username}'s avatar! {Emojis.Warn} Please note that if {member.Username} changes their avatar, the webhook's avatar will need to be re-set.", embed: embed);
|
||||
}
|
||||
|
||||
[Command("avatar")]
|
||||
[Alias("profile", "picture", "icon", "image", "pic", "pfp")]
|
||||
[Remarks("member <member> avatar <avatar url>")]
|
||||
|
@ -32,6 +32,7 @@ namespace PluralKit.Bot {
|
||||
public static PKError AvatarFileSizeLimit(long size) => new PKError($"File size too large ({size.Bytes().ToString("#.#")} > {Limits.AvatarFileSizeLimit.Bytes().ToString("#.#")}), try shrinking or compressing the image.");
|
||||
public static PKError AvatarNotAnImage(string mimeType) => new PKError($"The given link does not point to an image{(mimeType != null ? $" ({mimeType.Sanitize()})" : "")}. Make sure you're using a direct link (ending in .jpg, .png, .gif).");
|
||||
public static PKError AvatarDimensionsTooLarge(int width, int height) => new PKError($"Image too large ({width}x{height} > {Limits.AvatarDimensionLimit}x{Limits.AvatarDimensionLimit}), try resizing the image.");
|
||||
public static PKError UserHasNoAvatar => new PKError("The given user has no avatar set.");
|
||||
public static PKError InvalidUrl(string url) => new PKError($"The given URL is invalid.");
|
||||
|
||||
public static PKError AccountAlreadyLinked => new PKError("That account is already linked to your system.");
|
||||
|
Loading…
Reference in New Issue
Block a user