utility.avatar: dont show last changed for default avatar

This commit is contained in:
Cynthia Foxwell 2024-08-01 10:54:50 -06:00
parent b5250cc573
commit d5c1e2a3f7

View file

@ -20,6 +20,8 @@ avatar.callback = async function (msg, line, [user], {server, guild}) {
if (!msg.guildID) { if (!msg.guildID) {
return "`--server/--guild` can only be used within guilds."; return "`--server/--guild` can only be used within guilds.";
} else { } else {
if (!guildObj.icon) return "Server has no icon.";
const url = CDNEndpoints.GUILD_ICON(guildObj.id, guildObj.icon); const url = CDNEndpoints.GUILD_ICON(guildObj.id, guildObj.icon);
const res = await fetch(url, {method: "HEAD"}); const res = await fetch(url, {method: "HEAD"});
@ -66,7 +68,7 @@ avatar.callback = async function (msg, line, [user], {server, guild}) {
const res = await fetch(normalUrl, {method: "HEAD"}); const res = await fetch(normalUrl, {method: "HEAD"});
const mod = res.headers.get("last-modified"); const mod = res.headers.get("last-modified");
let modStr = ""; let modStr = "";
if (mod) { if (mod && normalUrl != defaultAvatar) {
const modDate = Math.floor(new Date(mod).getTime() / 1000); const modDate = Math.floor(new Date(mod).getTime() / 1000);
modStr = ` \u2022 Updated <t:${modDate}:R>`; modStr = ` \u2022 Updated <t:${modDate}:R>`;
} }