Compare commits

..

2 commits

2 changed files with 25 additions and 22 deletions

View file

@ -2,6 +2,7 @@ const {ApplicationCommandOptionTypes, MessageFlags} = require("#util/dconstants.
const InteractionCommand = require("#lib/interactionCommand.js");
const events = require("#lib/events.js");
const logger = require("#lib/logger.js");
const {hasFlag} = require("#lib/guildSettings.js");
const REGEX_GITHUB =
/(?:\s|^)(\|\|\s*)?https?:\/\/(www\.)?github\.com\/[a-z0-9-]+\/[a-z0-9-._]+\/blob\/([a-z0-9-_.?&=#root/%]*)(\s*\|\|)?/gi;
@ -120,6 +121,7 @@ events.add("messageCreate", "codePreviews", async function (msg) {
for (const link of githubLinks) {
const spoiler = REGEX_SPOILER.test(link);
files.push(await processFile(link.replace("/blob/", "/raw/"), link, spoiler));
logger.verbose("hf:codePreviews", `Processed GitHub file: ${link}`);
}
}
@ -127,6 +129,7 @@ events.add("messageCreate", "codePreviews", async function (msg) {
for (const link of gitlabLinks) {
const spoiler = REGEX_SPOILER.test(link);
files.push(await processFile(link.replace("/blob/", "/raw/"), link, spoiler));
logger.verbose("hf:codePreviews", `Processed GitLab file: ${link}`);
}
}
@ -134,6 +137,7 @@ events.add("messageCreate", "codePreviews", async function (msg) {
for (const link of giteaLinks) {
const spoiler = REGEX_SPOILER.test(link);
files.push(await processFile(link.replace("/src/", "/raw/"), link, spoiler));
logger.verbose("hf:codePreviews", `Processed Gitea file: ${link}`);
}
}
@ -147,6 +151,7 @@ events.add("messageCreate", "codePreviews", async function (msg) {
if (file == "") continue;
if (out.length + file.length > 2000) {
if (out.length > 0)
await msg.channel.createMessage({
content: out,
allowedMentions: {

View file

@ -121,20 +121,18 @@ lookupinvite.callback = async function (msg, line) {
if (invite.guild.features) {
const features = formatGuildFeatures(invite.guild.features);
embed.fields.push(
{
embed.fields.push({
name: `Features (${features.length})`,
value: features.length > 0 ? features.slice(0, Math.ceil(features.length / 2)).join("\n") : "None",
inline: true,
},
features.length > 1
? {
});
if (features.length > 1) {
embed.fields.push({
name: "\u200b",
value: features.slice(Math.ceil(features.length / 2), features.length).join("\n"),
inline: true,
});
}
: null
);
}
const guildIcon = invite.guild?.icon && CDNEndpoints.GUILD_ICON(invite.guild.id, invite.guild.icon);