From 6d39c2d33f0e8479f98ba17801174170ac94218e Mon Sep 17 00:00:00 2001 From: Daan Boerlage Date: Sat, 6 Nov 2021 19:07:28 +0100 Subject: [PATCH] Add primitive GetAvatarUrl function to a resolved interaction user --- src/Core/Interactions/Resolved/User.cs | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/Core/Interactions/Resolved/User.cs b/src/Core/Interactions/Resolved/User.cs index 9dc4c53..f9cc657 100644 --- a/src/Core/Interactions/Resolved/User.cs +++ b/src/Core/Interactions/Resolved/User.cs @@ -50,5 +50,15 @@ namespace Geekbot.Core.Interactions.Resolved public int PublicFlags { get; set; } public string Mention => $"<@{Id}>"; + + public string GetAvatarUrl() + { + if (string.IsNullOrEmpty(Avatar)) + { + return "https://discordapp.com/assets/6debd47ed13483642cf09e832ed0bc1b.png"; + } + + return $"https://cdn.discordapp.com/avatars/{Id}/{Avatar}.webp"; + } } } \ No newline at end of file