Compare commits

..

No commits in common. "6a9425eccc3c66049b2a33cab6afda6bb95aa6bc" and "bd4dcd087e4a2d48fbd38c72fe3653500eb6a075" have entirely different histories.

6 changed files with 3 additions and 57 deletions

View file

@ -33,5 +33,5 @@ labels:
**Did someone already report that bug?** **Did someone already report that bug?**
- [ ] Yes <!-- If you have to put yes you don't need to submit that bug report. --> - [ ] Yes <!-- If you have to put yes you don't need to submit that feature request. -->
- [ ] No - [ ] No

3
.gitignore vendored
View file

@ -1,8 +1,7 @@
.env .env
node_modules/ node_modules/
bin/
config/config.json config/config.json
json/board/ json/board/
unloaded/ unloaded/
database.sqlite3 database.sqlite3
bin/yt-dlp
tmp/*.js

View file

View file

@ -1,30 +0,0 @@
import { SlashCommandBuilder } from 'discord.js';
import util from 'node:util';
import stream from 'node:stream';
import fs from 'node:fs';
export default {
data: new SlashCommandBuilder()
.setName('downloadandload')
.setDescription('Download a command and load it.')
.addAttachmentOption(option =>
option.setName('file')
.setDescription('The .js file that will be loaded by the bot.')
.setRequired(true)),
category: 'owner',
ownerOnly: true,
async execute(interaction, args, client) {
await interaction.deferReply();
const streamPipeline = util.promisify(stream.pipeline);
const res = await fetch(args.file.url);
if (!res.ok) return interaction.editReply('An error has occured while trying to download your image.');
await streamPipeline(res.body, fs.createWriteStream(`./tmp/${args.file.name}`));
let command = await import(`../../tmp/${args.file.name}`);
command = command.default;
client.commands.set(command.data.name, command);
return await interaction.editReply(`${command.data.name} has been loaded.`);
},
};

View file

View file

@ -9,7 +9,6 @@ export default {
stringIsAValidurl, stringIsAValidurl,
compressVideo, compressVideo,
getVideoCodec, getVideoCodec,
getMaxFileSize,
}; };
async function downloadVideo(urlArg, output, format = 'bestvideo*+bestaudio/best') { async function downloadVideo(urlArg, output, format = 'bestvideo*+bestaudio/best') {
await new Promise((resolve, reject) => { await new Promise((resolve, reject) => {
@ -92,25 +91,3 @@ async function getVideoCodec(input) {
}); });
}); });
} }
async function getMaxFileSize(guild) {
return await new Promise((resolve, reject) => {
const tier = guild.premiumTier;
console.log(tier);
switch (tier) {
case 0:
case 1:
resolve(8);
break;
case 2:
resolve('50');
break;
case 3:
resolve('100');
break;
default:
reject('An error has occured');
break;
}
});
}