feat(api): generate missing icons

This commit is contained in:
Isaac
2024-04-21 02:04:46 +01:00
parent c6a982e702
commit 46bd58daf6
5 changed files with 48 additions and 2 deletions

View File

@@ -1,3 +1,6 @@
const { createHash } = require('crypto');
module.exports.md5 = str => createHash('md5').update(str).digest('hex');
module.exports.msToMins = ms => Number((ms / 1000 / 60).toFixed(2));
module.exports.iconURL = guildLike => guildLike.icon
? guildLike.client.rest.cdn.icon(guildLike.id, guildLike.icon)
: `https://api.dicebear.com/8.x/initials/png?seed=${encodeURIComponent(guildLike.name)}&size=96&backgroundType=gradientLinear&fontWeight=600`;