mirror of
https://git.arson.gg/lilith/discord-bot.git
synced 2025-12-05 03:34:49 +01:00
quoter
This commit is contained in:
parent
de3c094833
commit
2a84e74cda
6 changed files with 519 additions and 86 deletions
40
src/commands/fun/quote.js
Normal file
40
src/commands/fun/quote.js
Normal file
|
|
@ -0,0 +1,40 @@
|
|||
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`;
|
||||
console.log("Generating quote image");
|
||||
try {
|
||||
const data = await createQuoteImage(avatar, user.username, msg.content, true, interaction.client.users.cache);
|
||||
console.log("Sending quote image");
|
||||
|
||||
await interaction.followUp({
|
||||
files: [{
|
||||
attachment: data,
|
||||
name: "quote.png"
|
||||
}]
|
||||
})
|
||||
} catch (e) {
|
||||
interaction.followUp(e.toString());
|
||||
}
|
||||
},
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue