Make it a link button
This commit is contained in:
parent
d2119299fa
commit
90fbd3f717
1 changed files with 16 additions and 6 deletions
|
@ -1,4 +1,12 @@
|
||||||
import { Colors, EmbedBuilder, type Message, ThreadChannel } from "discord.js";
|
import {
|
||||||
|
ActionRowBuilder,
|
||||||
|
ButtonBuilder,
|
||||||
|
ButtonStyle,
|
||||||
|
Colors,
|
||||||
|
EmbedBuilder,
|
||||||
|
type Message,
|
||||||
|
ThreadChannel,
|
||||||
|
} 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) => {
|
||||||
|
@ -58,11 +66,13 @@ export async function expandDiscordLink(message: Message): Promise<void> {
|
||||||
builder.setImage(firstImage);
|
builder.setImage(firstImage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
builder.addFields({
|
const row = new ActionRowBuilder().addComponents(
|
||||||
name: "Source",
|
new ButtonBuilder()
|
||||||
value: `[Jump to original message](${messageToShow.url})`,
|
.setLabel("Jump to original message")
|
||||||
});
|
.setStyle(ButtonStyle.Link)
|
||||||
message.channel.send({ embeds: [builder] });
|
.setURL(messageToShow.url)
|
||||||
|
);
|
||||||
|
message.channel.send({ embeds: [builder], components: [row] });
|
||||||
} catch (e) {
|
} catch (e) {
|
||||||
console.error(e);
|
console.error(e);
|
||||||
continue;
|
continue;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue