Formatting
This commit is contained in:
parent
5181e31012
commit
69c78c1458
1 changed files with 5 additions and 5 deletions
|
@ -6,11 +6,11 @@ import {
|
||||||
EmbedBuilder,
|
EmbedBuilder,
|
||||||
type Message,
|
type Message,
|
||||||
ThreadChannel,
|
ThreadChannel,
|
||||||
} from 'discord.js';
|
} from "discord.js";
|
||||||
|
|
||||||
function findFirstImage(message: Message): string | undefined {
|
function findFirstImage(message: Message): string | undefined {
|
||||||
const result = message.attachments.find((attach) => {
|
const result = message.attachments.find((attach) => {
|
||||||
return attach.contentType?.startsWith('image/');
|
return attach.contentType?.startsWith("image/");
|
||||||
});
|
});
|
||||||
if (result == undefined) {
|
if (result == undefined) {
|
||||||
return undefined;
|
return undefined;
|
||||||
|
@ -64,12 +64,12 @@ export async function expandDiscordLink(message: Message): Promise<void> {
|
||||||
builder.setDescription(messageToShow.content);
|
builder.setDescription(messageToShow.content);
|
||||||
}
|
}
|
||||||
if (messageToShow.attachments.size > 0) {
|
if (messageToShow.attachments.size > 0) {
|
||||||
let attachmentsString = '';
|
let attachmentsString = "";
|
||||||
messageToShow.attachments.forEach((value) => {
|
messageToShow.attachments.forEach((value) => {
|
||||||
attachmentsString += `[${value.name}](${value.url}) `;
|
attachmentsString += `[${value.name}](${value.url}) `;
|
||||||
});
|
});
|
||||||
|
|
||||||
builder.addFields({ name: 'Attachments', value: attachmentsString });
|
builder.addFields({ name: "Attachments", value: attachmentsString });
|
||||||
|
|
||||||
const firstImage = findFirstImage(messageToShow);
|
const firstImage = findFirstImage(messageToShow);
|
||||||
if (firstImage != undefined) {
|
if (firstImage != undefined) {
|
||||||
|
@ -79,7 +79,7 @@ export async function expandDiscordLink(message: Message): Promise<void> {
|
||||||
|
|
||||||
const row = new ActionRowBuilder<ButtonBuilder>().addComponents(
|
const row = new ActionRowBuilder<ButtonBuilder>().addComponents(
|
||||||
new ButtonBuilder()
|
new ButtonBuilder()
|
||||||
.setLabel('Jump to original message')
|
.setLabel("Jump to original message")
|
||||||
.setStyle(ButtonStyle.Link)
|
.setStyle(ButtonStyle.Link)
|
||||||
.setURL(messageToShow.url)
|
.setURL(messageToShow.url)
|
||||||
);
|
);
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue