Compare commits

..

No commits in common. "f54ec82c9995f5d0e2d95ad6a8119df9213e03d8" and "8e7bd2a1d996eb0876a7a3952f0d0a1197c9aa7d" have entirely different histories.

2 changed files with 22 additions and 25 deletions

View file

@ -2,7 +2,6 @@ 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;
@ -121,7 +120,6 @@ 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}`);
}
}
@ -129,7 +127,6 @@ 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}`);
}
}
@ -137,7 +134,6 @@ 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}`);
}
}
@ -151,16 +147,15 @@ 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: {
repliedUser: false,
},
messageReference: {
messageID: msg.id,
},
});
await msg.channel.createMessage({
content: out,
allowedMentions: {
repliedUser: false,
},
messageReference: {
messageID: msg.id,
},
});
out = file;
} else {

View file

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