init
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
||||
config.json
|
||||
node_modules/
|
||||
downloads/
|
||||
stickers/
|
26
commands/emotes/stickerlog.js
Normal file
26
commands/emotes/stickerlog.js
Normal file
@@ -0,0 +1,26 @@
|
||||
const { ContextMenuCommandBuilder, ApplicationCommandType, StickerFormatType } = require("discord.js");
|
||||
const fs = require('fs/promises');
|
||||
|
||||
module.exports = {
|
||||
data : new ContextMenuCommandBuilder()
|
||||
.setName("Sticker Log")
|
||||
.setType(ApplicationCommandType.Message),
|
||||
async execute(interaction) {
|
||||
await interaction.deferReply();
|
||||
|
||||
const sticker = interaction.targetMessage.stickers.first();
|
||||
if (!sticker) {
|
||||
await interaction.editReply("This message does not contain a sticker.");
|
||||
return;
|
||||
}
|
||||
const link = sticker.url;
|
||||
const copyname = sticker.name + "_FE";
|
||||
const response = await fetch(link);
|
||||
const extension = (sticker.format == StickerFormatType.PNG) ? ".png" :
|
||||
(sticker.format == StickerFormatType.APNG) ? ".apng" :
|
||||
(sticker.format == StickerFormatType.LOTTIE) ? ".json" : ".webp";
|
||||
// save the file
|
||||
await fs.writeFile(`./stickers/${copyname}${extension}`, response.body);
|
||||
await interaction.editReply(`Dowloaded ${sticker.name}!\n`);
|
||||
}
|
||||
}
|
@@ -3,7 +3,6 @@ const { Events } = require('discord.js');
|
||||
module.exports = {
|
||||
name: Events.InteractionCreate,
|
||||
async execute(interaction) {
|
||||
if (!interaction.isChatInputCommand()) return;
|
||||
|
||||
const command = interaction.client.commands.get(interaction.commandName);
|
||||
|
||||
|
Reference in New Issue
Block a user