From 6983ea58b7b8e7855fe07242d40ff8891226cac9 Mon Sep 17 00:00:00 2001 From: Supositware Date: Thu, 11 Jul 2024 07:19:25 +0200 Subject: [PATCH] eslint fix --- commands/owner/ublacklist.js | 14 +++++----- commands/utility/download.js | 2 +- commands/utility/vid2gif.js | 2 +- events/client/interactionCreate.js | 10 +++---- utils/videos.js | 44 +++++++++++++++--------------- 5 files changed, 36 insertions(+), 36 deletions(-) diff --git a/commands/owner/ublacklist.js b/commands/owner/ublacklist.js index 5bbda47..1a572ba 100644 --- a/commands/owner/ublacklist.js +++ b/commands/owner/ublacklist.js @@ -33,20 +33,20 @@ export default { const body = { type:command, uid: userid, reason: reason }; Blacklists.create(body); if (command === 'guild') { - let guildid = userid; + const guildid = userid; await client.guilds.fetch(guildid); - const guild =client.guilds.resolve(guildid).name; - - return interaction.editReply(`The guild ${guild} (${guildid}) has been blacklisted with the following reason \`${reason}\``); + const guild = client.guilds.resolve(guildid).name; + + return interaction.editReply(`The guild ${guild} (${guildid}) has been blacklisted with the following reason \`${reason}\``); } else { let user = userid; await client.users.fetch(userid); user = client.users.resolve(userid).username; - - - return interaction.editReply(`${user} (${userid}) has been blacklisted from ${command} with the following reason \`${reason}\``); + + + return interaction.editReply(`${user} (${userid}) has been blacklisted from ${command} with the following reason \`${reason}\``); } } else { diff --git a/commands/utility/download.js b/commands/utility/download.js index f60acdc..97383f0 100644 --- a/commands/utility/download.js +++ b/commands/utility/download.js @@ -196,7 +196,7 @@ async function download(url, interaction, originalInteraction, format = undefine if (!interaction.doAutocrop) { const bannedFormats = ['hevc']; const codec = await utils.getVideoCodec(output); - + if (bannedFormats.includes(codec)) { const oldOutput = output; output = `${os.tmpdir()}/264${file}`; diff --git a/commands/utility/vid2gif.js b/commands/utility/vid2gif.js index fd831f0..ecb0467 100644 --- a/commands/utility/vid2gif.js +++ b/commands/utility/vid2gif.js @@ -48,7 +48,7 @@ export default { quality = 100; } } - + if (args.fps) { if (args.fps <= 0) { args.fps = 1; diff --git a/events/client/interactionCreate.js b/events/client/interactionCreate.js index 1516c6a..a571050 100644 --- a/events/client/interactionCreate.js +++ b/events/client/interactionCreate.js @@ -12,9 +12,9 @@ export default { const client = interaction.client; if (interaction.type !== InteractionType.ApplicationCommand) return; - const globalBlacklist = await db.Blacklists.findOne({ where: { type:'global', uid:interaction.user.id } }) + const globalBlacklist = await db.Blacklists.findOne({ where: { type:'global', uid:interaction.user.id } }); const commandBlacklist = await db.Blacklists.findOne({ where: { type:interaction.commandName, uid:interaction.user.id } }); - + if (interaction.guild) { const serverBlacklist = await db.Blacklists.findOne({ where: { type:'guild', uid:interaction.guild.id } }); if (serverBlacklist) { @@ -38,12 +38,12 @@ export default { if (!command) return; - const isOptOut = await db.optout.findOne({ where: { userID: interaction.user.id } }); + let isOptOut = await db.optout.findOne({ where: { userID: interaction.user.id } }); if (commandName === 'optout') { - isOptOut = true + isOptOut = true; } - + const timestamp = new Date(); console.log(`[${timestamp.toISOString()}] \x1b[33m${ isOptOut ? 'A user' : `${userTag} (${userID})`}\x1b[0m launched command \x1b[33m${commandName}\x1b[0m using slash`); diff --git a/utils/videos.js b/utils/videos.js index 8476e6c..174618f 100644 --- a/utils/videos.js +++ b/utils/videos.js @@ -139,35 +139,35 @@ async function getMaxFileSize(guild) { async function autoCrop(input, output) { return await new Promise((resolve, reject) => { let ffprobeInput = input; - if (process.platform === 'win32') { + if (process.platform === 'win32') { // ffprobe 'movie=' options does not like windows absolute path ffprobeInput = input.replace(/\\/g, '/').replace(/\:/g, '\\\\:'); } - execFile('ffprobe', + execFile('ffprobe', ['-f', 'lavfi', '-i', `movie=${ffprobeInput},cropdetect`, '-show_entries', - 'packet_tags=lavfi.cropdetect.w,lavfi.cropdetect.h,lavfi.cropdetect.x,lavfi.cropdetect.y', - '-read_intervals', '%+#10', '-hide_banner', '-print_format', 'json'], async (err, stdout, stderr) => { - if (err) { - reject(stderr); - } - if (stderr) { - console.error(stderr); - } - const packets = JSON.parse(stdout).packets; + 'packet_tags=lavfi.cropdetect.w,lavfi.cropdetect.h,lavfi.cropdetect.x,lavfi.cropdetect.y', + '-read_intervals', '%+#10', '-hide_banner', '-print_format', 'json'], async (err, stdout, stderr) => { + if (err) { + reject(stderr); + } + if (stderr) { + console.error(stderr); + } + const packets = JSON.parse(stdout).packets; + + for (let i = 0; i < packets.length; i++) { + const element = packets[i]; - for (let i = 0; i < packets.length; i++) { - const element = packets[i]; - - if (element.tags) { - const cropdetect = element.tags; - await ffmpeg(['-i', input, '-vf', `crop=${cropdetect['lavfi.cropdetect.w']}:${cropdetect['lavfi.cropdetect.h']}:${cropdetect['lavfi.cropdetect.x']}:${cropdetect['lavfi.cropdetect.y']}`, '-vcodec', 'libx264', '-acodec', 'aac', output]) - break; + if (element.tags) { + const cropdetect = element.tags; + await ffmpeg(['-i', input, '-vf', `crop=${cropdetect['lavfi.cropdetect.w']}:${cropdetect['lavfi.cropdetect.h']}:${cropdetect['lavfi.cropdetect.x']}:${cropdetect['lavfi.cropdetect.y']}`, '-vcodec', 'libx264', '-acodec', 'aac', output]); + break; + } } - } - console.log(NODE_ENV === 'development' ? stdout : null); - resolve(); - }); + console.log(NODE_ENV === 'development' ? stdout : null); + resolve(); + }); }); }