mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-04 04:56:49 +00:00
feat: add support for external avatar hosting service (#614)
This commit is contained in:
parent
8befb1c857
commit
8157c6932e
9 changed files with 94 additions and 5 deletions
|
|
@ -13,10 +13,12 @@ namespace PluralKit.Bot;
|
|||
public class MemberEdit
|
||||
{
|
||||
private readonly HttpClient _client;
|
||||
private readonly AvatarHostingService _avatarHosting;
|
||||
|
||||
public MemberEdit(HttpClient client)
|
||||
public MemberEdit(HttpClient client, AvatarHostingService avatarHosting)
|
||||
{
|
||||
_client = client;
|
||||
_avatarHosting = avatarHosting;
|
||||
}
|
||||
|
||||
public async Task Name(Context ctx, PKMember target)
|
||||
|
|
@ -180,6 +182,7 @@ public class MemberEdit
|
|||
|
||||
async Task SetBannerImage(ParsedImage img)
|
||||
{
|
||||
img = await _avatarHosting.TryRehostImage(img, AvatarHostingService.RehostedImageType.Banner, ctx.Author.Id);
|
||||
await AvatarUtils.VerifyAvatarOrThrow(_client, img.Url, true);
|
||||
|
||||
await ctx.Repository.UpdateMember(target.Id, new MemberPatch { BannerImage = img.CleanUrl ?? img.Url });
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue