From 0fb57f72435c93311f7cced5eaf371edb05167be Mon Sep 17 00:00:00 2001 From: loicbersier Date: Sun, 26 Jul 2020 13:53:36 +0200 Subject: [PATCH 1/5] Add the message author Signed-off-by: loicbersier --- commands/fun/curses.js | 2 +- commands/fun/vidshittyfier.js | 2 +- commands/utility/gif2vid.js | 2 +- commands/utility/vid2gif.js | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/commands/fun/curses.js b/commands/fun/curses.js index df93f6b0..c36f5752 100644 --- a/commands/fun/curses.js +++ b/commands/fun/curses.js @@ -69,7 +69,7 @@ class cursesCommand extends Command { } fs.writeFileSync(`${os.tmpdir()}/cursed${message.id}${ext}`, Buffer.from(endResult, 'hex')); - return message.channel.send({files: [`${os.tmpdir()}/cursed${message.id}${ext}`]}) + return message.channel.send(`Cursed by ${message.author}`, {files: [`${os.tmpdir()}/cursed${message.id}${ext}`]}) .catch(err => { console.error(err); return message.channel.send('Video is too big! try again with something smaller'); diff --git a/commands/fun/vidshittyfier.js b/commands/fun/vidshittyfier.js index 0c07a551..29aa37bb 100644 --- a/commands/fun/vidshittyfier.js +++ b/commands/fun/vidshittyfier.js @@ -85,7 +85,7 @@ class vidshittyfierCommand extends Command { ffmpegCommand.on('end', () => { loadingmsg.delete(); message.delete(); - return message.channel.send({files: [output2]}) + return message.channel.send(`Shittyfied by ${message.author}`, {files: [output2]}) .catch(err => { console.error(err); return message.channel.send(`${err.name}: ${err.message} ${err.message === 'Request entity too large' ? 'The file size is too big' : ''}`); diff --git a/commands/utility/gif2vid.js b/commands/utility/gif2vid.js index 12a234e1..2eb5338e 100644 --- a/commands/utility/gif2vid.js +++ b/commands/utility/gif2vid.js @@ -57,7 +57,7 @@ class gif2vidCommand extends Command { ffmpegCommand.on('end', () => { loadingmsg.delete(); message.delete(); - return message.channel.send({files: [`${os.tmpdir()}/${message.id}g2v.mp4`]}) + return message.channel.send(`Converted by ${message.author}`, {files: [`${os.tmpdir()}/${message.id}g2v.mp4`]}) .catch(err => { console.error(err); return message.channel.send(`${err.name}: ${err.message} ${err.message === 'Request entity too large' ? 'The file size is too big' : ''}`); diff --git a/commands/utility/vid2gif.js b/commands/utility/vid2gif.js index a22b60f9..7a91d88f 100644 --- a/commands/utility/vid2gif.js +++ b/commands/utility/vid2gif.js @@ -63,7 +63,7 @@ class vid2gifCommand extends Command { ffmpegCommand.on('end', () => { loadingmsg.delete(); message.delete(); - return message.channel.send({files: [`${os.tmpdir()}/${message.id}v2g.gif`]}) + return message.channel.send(`Converted by ${message.author}`, {files: [`${os.tmpdir()}/${message.id}v2g.gif`]}) .catch(err => { console.error(err); return message.channel.send(`${err.name}: ${err.message} ${err.message === 'Request entity too large' ? 'The file size is too big' : ''}`); From e7f1d491cd8f86f9bc14c49b19a66d165c74bf28 Mon Sep 17 00:00:00 2001 From: loicbersier Date: Sun, 26 Jul 2020 13:59:25 +0200 Subject: [PATCH 2/5] webm override Signed-off-by: loicbersier --- commands/fun/curses.js | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/commands/fun/curses.js b/commands/fun/curses.js index c36f5752..65c16c98 100644 --- a/commands/fun/curses.js +++ b/commands/fun/curses.js @@ -17,6 +17,11 @@ class cursesCommand extends Command { id: 'link', type: 'url', }, + { + id: 'webm', + match: 'flag', + flag: ['--webm'] + }, ], description: { content: 'Mess with video length. webm = expanding length and mp4 = very long length', @@ -38,9 +43,11 @@ class cursesCommand extends Command { link = await attachment(message); let ext = path.extname(link.toLowerCase()); - if (ext !== '.webm' || ext !== '.mp4') { + if (ext !== '.webm' || ext !== '.mp4') ext = '.mp4'; - } + + + if (args.webm) ext = '.webm'; let loadingmsg = await message.channel.send('Processing '); downloader(link, null, `${os.tmpdir()}/${message.id}${ext}`) From cdab95811c5b159022dee9bc7584a1675e634b55 Mon Sep 17 00:00:00 2001 From: loicbersier Date: Sun, 26 Jul 2020 14:04:22 +0200 Subject: [PATCH 3/5] delete author message and fix webm flag Signed-off-by: loicbersier --- commands/fun/curses.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/commands/fun/curses.js b/commands/fun/curses.js index 65c16c98..0cf3c856 100644 --- a/commands/fun/curses.js +++ b/commands/fun/curses.js @@ -50,7 +50,7 @@ class cursesCommand extends Command { if (args.webm) ext = '.webm'; let loadingmsg = await message.channel.send('Processing '); - downloader(link, null, `${os.tmpdir()}/${message.id}${ext}`) + downloader(link, [`--format=${ext.replace('.', '')}`], `${os.tmpdir()}/${message.id}${ext}`) .on('error', async err => { loadingmsg.delete(); console.error(err); @@ -76,6 +76,7 @@ class cursesCommand extends Command { } fs.writeFileSync(`${os.tmpdir()}/cursed${message.id}${ext}`, Buffer.from(endResult, 'hex')); + message.delete(); return message.channel.send(`Cursed by ${message.author}`, {files: [`${os.tmpdir()}/cursed${message.id}${ext}`]}) .catch(err => { console.error(err); From acfe0010a5657fab69f409dde499ae247cb4b89e Mon Sep 17 00:00:00 2001 From: loicbersier Date: Tue, 28 Jul 2020 16:00:43 +0200 Subject: [PATCH 4/5] What the fuck am i doing Signed-off-by: loicbersier --- rand.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rand.js b/rand.js index 79cc903c..2e1aa75b 100644 --- a/rand.js +++ b/rand.js @@ -27,7 +27,7 @@ exports.random = function (text, message) { }, { name: /\[member\]/, - value: message.guild ? message.guild.members.cache.random().user.username : '' + value: message ? message.guild ? message.guild.members.cache.random().user.username : '' : '' // What the fuck am i doing }, { name: /\[memberRand\]/, From be1db476336aca723f060861f4ace84528985b82 Mon Sep 17 00:00:00 2001 From: loicbersier Date: Tue, 28 Jul 2020 16:03:21 +0200 Subject: [PATCH 5/5] Changed some hex to replace and added an alias Signed-off-by: loicbersier --- commands/fun/curses.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/commands/fun/curses.js b/commands/fun/curses.js index 0cf3c856..09f95876 100644 --- a/commands/fun/curses.js +++ b/commands/fun/curses.js @@ -9,7 +9,7 @@ const downloader = require('../../utils/download'); class cursesCommand extends Command { constructor() { super('curses', { - aliases: ['curses'], + aliases: ['curses', 'curse'], category: 'fun', clientPermissions: ['SEND_MESSAGES', 'ATTACH_FILES'], args: [ @@ -43,12 +43,13 @@ class cursesCommand extends Command { link = await attachment(message); let ext = path.extname(link.toLowerCase()); - if (ext !== '.webm' || ext !== '.mp4') + console.log(ext); + if (ext !== '.webm' && ext !== '.mp4') ext = '.mp4'; if (args.webm) ext = '.webm'; - + let loadingmsg = await message.channel.send('Processing '); downloader(link, [`--format=${ext.replace('.', '')}`], `${os.tmpdir()}/${message.id}${ext}`) .on('error', async err => { @@ -60,14 +61,14 @@ class cursesCommand extends Command { let file = fs.readFileSync(output).toString('hex'); let searchHex = '6d766864'; - let replaceHex = '0000017FFFFFFF'; + let replaceHex = '0000180FFFFFF7F'; let skipByte = 34; let endResult; if (ext === '.webm') { searchHex = '2ad7b1'; - replaceHex = '00000000'; + replaceHex = '42FFB060'; skipByte = 8; endResult = replaceAt(file, file.indexOf(searchHex) + file.substring(file.indexOf(searchHex)).indexOf('4489') + skipByte, replaceHex);