userinfo: display name styles, subtle caching
This commit is contained in:
parent
6f483d1675
commit
4737ac23d6
3 changed files with 80 additions and 8 deletions
BIN
data/clip.mp4
Normal file
BIN
data/clip.mp4
Normal file
Binary file not shown.
|
@ -1,4 +1,6 @@
|
||||||
const sharp = require("sharp");
|
const sharp = require("sharp");
|
||||||
|
const {readFile} = require("node:fs/promises");
|
||||||
|
const {tinycolor} = require("@ctrl/tinycolor");
|
||||||
|
|
||||||
const Command = require("#lib/command.js");
|
const Command = require("#lib/command.js");
|
||||||
const InteractionCommand = require("#lib/interactionCommand.js");
|
const InteractionCommand = require("#lib/interactionCommand.js");
|
||||||
|
@ -12,6 +14,8 @@ const {
|
||||||
CDNEndpoints,
|
CDNEndpoints,
|
||||||
UserFlags,
|
UserFlags,
|
||||||
NameplatePalettes,
|
NameplatePalettes,
|
||||||
|
DisplayNameEffectNames,
|
||||||
|
DisplayNameFontNames,
|
||||||
} = require("#util/dconstants.js");
|
} = require("#util/dconstants.js");
|
||||||
const {Icons} = require("#util/constants.js");
|
const {Icons} = require("#util/constants.js");
|
||||||
|
|
||||||
|
@ -475,6 +479,17 @@ userinfo.callback = async function (msg, line) {
|
||||||
value: `${primaryGuild?.data?.name ?? "<private guild>"}\n-# ${user.primary_guild.identity_guild_id}`,
|
value: `${primaryGuild?.data?.name ?? "<private guild>"}\n-# ${user.primary_guild.identity_guild_id}`,
|
||||||
inline: true,
|
inline: true,
|
||||||
},
|
},
|
||||||
|
user.display_name_styles != null && {
|
||||||
|
name: "Display Name Style",
|
||||||
|
value: `**Effect:** ${
|
||||||
|
DisplayNameEffectNames[user.display_name_styles.effect_id] ??
|
||||||
|
`*Unknown* (\`${user.display_name_styles.effect_id}\`)`
|
||||||
|
}\n**Font:** ${
|
||||||
|
DisplayNameFontNames[user.display_name_styles.font_id] ??
|
||||||
|
`*Unknown* (\`${user.display_name_styles.font_id}\`)`
|
||||||
|
}\n**Colors**: ${user.display_name_styles.colors.map((color) => tinycolor(color).toHexString()).join(", ")}`,
|
||||||
|
inline: true,
|
||||||
|
},
|
||||||
vcBadges?.length > 0 && {
|
vcBadges?.length > 0 && {
|
||||||
name: `Vencord Donator Badge${vcBadges.length > 1 ? `s (${vcBadges.length})` : ""}`,
|
name: `Vencord Donator Badge${vcBadges.length > 1 ? `s (${vcBadges.length})` : ""}`,
|
||||||
value: vcBadges.map(({tooltip, badge}) => `"[${tooltip}](${badge})"`).join(", "),
|
value: vcBadges.map(({tooltip, badge}) => `"[${tooltip}](${badge})"`).join(", "),
|
||||||
|
@ -559,6 +574,41 @@ userinfo.callback = async function (msg, line) {
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!member && id !== (msg.author?.id ?? msg.user?.id)) {
|
||||||
|
try {
|
||||||
|
const clip = {
|
||||||
|
is_clip: true,
|
||||||
|
clip_created_at: new Date().toISOString(),
|
||||||
|
clip_participant_ids: [id],
|
||||||
|
application_id: hf.bot.application?.id,
|
||||||
|
};
|
||||||
|
|
||||||
|
const video = await readFile(require.resolve("#root/data/clip.mp4"));
|
||||||
|
|
||||||
|
const {upload_url, upload_filename} = await hf.bot.requestHandler.request(
|
||||||
|
"POST",
|
||||||
|
APIEndpoints.MESSAGE_CREATE_ATTACHMENT_UPLOAD(msg.channel.id),
|
||||||
|
true,
|
||||||
|
{
|
||||||
|
file_size: video.length,
|
||||||
|
filename: "clip.mp4",
|
||||||
|
...clip,
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
await fetch(upload_url, {method: "PUT", body: video});
|
||||||
|
|
||||||
|
attachments.push({
|
||||||
|
filename: "clip.mp4",
|
||||||
|
uploaded_filename: upload_filename,
|
||||||
|
is_thumbnail: true,
|
||||||
|
...clip,
|
||||||
|
});
|
||||||
|
} catch {
|
||||||
|
// noop
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return {
|
return {
|
||||||
embeds: [embed, nameplateEmbed].filter((x) => !!x),
|
embeds: [embed, nameplateEmbed].filter((x) => !!x),
|
||||||
attachments,
|
attachments,
|
||||||
|
|
|
@ -37,14 +37,15 @@ delete APIEndpoints.USER_AVATAR_DECORATION_PRESET;
|
||||||
|
|
||||||
delete APIEndpoints.MESSAGE_LINK;
|
delete APIEndpoints.MESSAGE_LINK;
|
||||||
|
|
||||||
APIEndpoints.APPLICATION_ASSETS = (applicationID) => `/oauth2/applications/${applicationID}/assets`; // prettier-ignore
|
APIEndpoints.APPLICATION_ASSETS = (applicationID) => `/oauth2/applications/${applicationID}/assets`; // prettier-ignore
|
||||||
APIEndpoints.APPLICATION_RPC = (applicationID) => `/applications/${applicationID}/rpc`; // prettier-ignore
|
APIEndpoints.APPLICATION_RPC = (applicationID) => `/applications/${applicationID}/rpc`; // prettier-ignore
|
||||||
APIEndpoints.ATTACHMENT_REFRESH = "/attachments/refresh-urls"; // prettier-ignore
|
APIEndpoints.ATTACHMENT_REFRESH = "/attachments/refresh-urls"; // prettier-ignore
|
||||||
APIEndpoints.CLAN = (guildID) => `/discovery/${guildID}/clan`; // prettier-ignore
|
APIEndpoints.CLAN = (guildID) => `/discovery/${guildID}/clan`; // prettier-ignore
|
||||||
APIEndpoints.DISCOVERY_SLUG = (guildID) => `/discovery/${guildID}`; // prettier-ignore
|
APIEndpoints.DISCOVERY_SLUG = (guildID) => `/discovery/${guildID}`; // prettier-ignore
|
||||||
APIEndpoints.GUILD_MEMBER_VERIFICATION = (guildID) => `/guilds/${guildID}/member-verification`; // prettier-ignore
|
APIEndpoints.GUILD_MEMBER_VERIFICATION = (guildID) => `/guilds/${guildID}/member-verification`; // prettier-ignore
|
||||||
APIEndpoints.POMELO_UNAUTHED = "/unique-username/username-attempt-unauthed"; // prettier-ignore
|
APIEndpoints.POMELO_UNAUTHED = "/unique-username/username-attempt-unauthed"; // prettier-ignore
|
||||||
APIEndpoints.STORE_PUBLISHED_LISTING = (skuID) => `/store/published-listings/skus/${skuID}`; // prettier-ignore
|
APIEndpoints.STORE_PUBLISHED_LISTING = (skuID) => `/store/published-listings/skus/${skuID}`; // prettier-ignore
|
||||||
|
APIEndpoints.MESSAGE_CREATE_ATTACHMENT_UPLOAD = (channelID) => `/channels/${channelID}/attachments`; // prettier-ignore
|
||||||
|
|
||||||
module.exports.APIEndpoints = APIEndpoints;
|
module.exports.APIEndpoints = APIEndpoints;
|
||||||
|
|
||||||
|
@ -147,6 +148,27 @@ module.exports.DEFAULT_GROUP_DM_AVATARS = [
|
||||||
"/assets/3cb840d03313467838d658bbec801fcd.png",
|
"/assets/3cb840d03313467838d658bbec801fcd.png",
|
||||||
].map((i) => Endpoints.CLIENT_URL + i);
|
].map((i) => Endpoints.CLIENT_URL + i);
|
||||||
|
|
||||||
|
module.exports.DisplayNameEffectNames = {
|
||||||
|
1: "Solid",
|
||||||
|
2: "Gradient",
|
||||||
|
3: "Neon",
|
||||||
|
4: "Toon",
|
||||||
|
5: "Pop",
|
||||||
|
};
|
||||||
|
module.exports.DisplayNameFontNames = {
|
||||||
|
11: "Default",
|
||||||
|
1: "Bangers",
|
||||||
|
2: "BioRhyme",
|
||||||
|
3: "Cherry Bomb One",
|
||||||
|
4: "Chicle",
|
||||||
|
5: "Compagnon",
|
||||||
|
6: "MuseoModerno",
|
||||||
|
7: "Néo-Castel",
|
||||||
|
8: "Pixelify Sans",
|
||||||
|
9: "Ribes",
|
||||||
|
10: "Sinistre",
|
||||||
|
};
|
||||||
|
|
||||||
module.exports.ExplicitContentFilterStrings = ["Disabled", "Members without roles", "All members"];
|
module.exports.ExplicitContentFilterStrings = ["Disabled", "Members without roles", "All members"];
|
||||||
|
|
||||||
module.exports.Games = require("#root/data/games.json");
|
module.exports.Games = require("#root/data/games.json");
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue