Skip to content

Commit

Permalink
add upload command
Browse files Browse the repository at this point in the history
  • Loading branch information
jmhayes3 committed Aug 23, 2024
1 parent 17c9d68 commit b9ba5a8
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 12 deletions.
19 changes: 19 additions & 0 deletions commands/core/upload.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
const { readFile } = require('fs/promises');
const { SlashCommandBuilder, AttachmentBuilder } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('upload')
.setDescription('Upload a file.'),
async execute(interaction) {
await interaction.deferReply();

const image_file = await readFile('./data/image.jpg');
const image_name = "data/image.jpg";
const attachment = new AttachmentBuilder(image_file, { name: image_name });
console.log("Attachment:", attachment);

const response = "File uploaded.";
await interaction.followUp({ content: response });
},
};
11 changes: 0 additions & 11 deletions development.md

This file was deleted.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "binksjs",
"version": "0.1.0",
"main": "main.js",
"main": "index.js",
"scripts": {
"test": "npm run lint",
"lint": "npx eslint ."
Expand Down

0 comments on commit b9ba5a8

Please sign in to comment.