mirror of
https://git.arson.gg/lilith/discord-bot.git
synced 2025-12-05 03:34:49 +01:00
38 lines
1.2 KiB
JavaScript
38 lines
1.2 KiB
JavaScript
const { ContextMenuCommandBuilder, ApplicationCommandType, InteractionContextType, ApplicationIntegrationType, AttachmentBuilder } = require("discord.js");
|
|
const { createQuoteImage } = require("../../utils/quoter.js");
|
|
|
|
const data = new ContextMenuCommandBuilder()
|
|
.setName("Quote")
|
|
.setType(ApplicationCommandType.Message)
|
|
.setContexts([
|
|
InteractionContextType.Guild,
|
|
InteractionContextType.BotDM,
|
|
InteractionContextType.PrivateChannel
|
|
])
|
|
.setIntegrationTypes([
|
|
ApplicationIntegrationType.GuildInstall,
|
|
ApplicationIntegrationType.UserInstall
|
|
]);
|
|
|
|
module.exports = {
|
|
data,
|
|
async execute(interaction) {
|
|
await interaction.deferReply();
|
|
|
|
const msg = interaction.targetMessage;
|
|
const user = msg.author;
|
|
const avatar = `https://cdn.discordapp.com/avatars/${user.id}/${user.avatar}.png?size=1024`;
|
|
try {
|
|
const data = await createQuoteImage(avatar, user.displayName, msg.content, true, interaction.client.users.cache);
|
|
|
|
await interaction.followUp({
|
|
files: [{
|
|
attachment: data,
|
|
name: "quote.png"
|
|
}]
|
|
})
|
|
} catch (e) {
|
|
interaction.followUp(e.toString());
|
|
}
|
|
},
|
|
};
|