init
This commit is contained in:
1
.gitignore
vendored
1
.gitignore
vendored
@@ -1,3 +1,4 @@
|
|||||||
config.json
|
config.json
|
||||||
node_modules/
|
node_modules/
|
||||||
downloads/
|
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 = {
|
module.exports = {
|
||||||
name: Events.InteractionCreate,
|
name: Events.InteractionCreate,
|
||||||
async execute(interaction) {
|
async execute(interaction) {
|
||||||
if (!interaction.isChatInputCommand()) return;
|
|
||||||
|
|
||||||
const command = interaction.client.commands.get(interaction.commandName);
|
const command = interaction.client.commands.get(interaction.commandName);
|
||||||
|
|
||||||
@@ -11,7 +10,7 @@ module.exports = {
|
|||||||
console.error(`No command matching ${interaction.commandName} was found.`);
|
console.error(`No command matching ${interaction.commandName} was found.`);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
await command.execute(interaction);
|
await command.execute(interaction);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
|
Reference in New Issue
Block a user