Merge remote-tracking branch 'origin/master'
This commit is contained in:
commit
32566d3730
5 changed files with 20 additions and 11 deletions
|
@ -9,7 +9,7 @@ const downloader = require('../../utils/download');
|
||||||
class cursesCommand extends Command {
|
class cursesCommand extends Command {
|
||||||
constructor() {
|
constructor() {
|
||||||
super('curses', {
|
super('curses', {
|
||||||
aliases: ['curses'],
|
aliases: ['curses', 'curse'],
|
||||||
category: 'fun',
|
category: 'fun',
|
||||||
clientPermissions: ['SEND_MESSAGES', 'ATTACH_FILES'],
|
clientPermissions: ['SEND_MESSAGES', 'ATTACH_FILES'],
|
||||||
args: [
|
args: [
|
||||||
|
@ -17,6 +17,11 @@ class cursesCommand extends Command {
|
||||||
id: 'link',
|
id: 'link',
|
||||||
type: 'url',
|
type: 'url',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
id: 'webm',
|
||||||
|
match: 'flag',
|
||||||
|
flag: ['--webm']
|
||||||
|
},
|
||||||
],
|
],
|
||||||
description: {
|
description: {
|
||||||
content: 'Mess with video length. webm = expanding length and mp4 = very long length',
|
content: 'Mess with video length. webm = expanding length and mp4 = very long length',
|
||||||
|
@ -38,12 +43,15 @@ class cursesCommand extends Command {
|
||||||
link = await attachment(message);
|
link = await attachment(message);
|
||||||
|
|
||||||
let ext = path.extname(link.toLowerCase());
|
let ext = path.extname(link.toLowerCase());
|
||||||
if (ext !== '.webm' || ext !== '.mp4') {
|
console.log(ext);
|
||||||
|
if (ext !== '.webm' && ext !== '.mp4')
|
||||||
ext = '.mp4';
|
ext = '.mp4';
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
if (args.webm) ext = '.webm';
|
||||||
|
|
||||||
let loadingmsg = await message.channel.send('Processing <a:loadingmin:527579785212329984>');
|
let loadingmsg = await message.channel.send('Processing <a:loadingmin:527579785212329984>');
|
||||||
downloader(link, null, `${os.tmpdir()}/${message.id}${ext}`)
|
downloader(link, [`--format=${ext.replace('.', '')}`], `${os.tmpdir()}/${message.id}${ext}`)
|
||||||
.on('error', async err => {
|
.on('error', async err => {
|
||||||
loadingmsg.delete();
|
loadingmsg.delete();
|
||||||
console.error(err);
|
console.error(err);
|
||||||
|
@ -53,14 +61,14 @@ class cursesCommand extends Command {
|
||||||
let file = fs.readFileSync(output).toString('hex');
|
let file = fs.readFileSync(output).toString('hex');
|
||||||
|
|
||||||
let searchHex = '6d766864';
|
let searchHex = '6d766864';
|
||||||
let replaceHex = '0000017FFFFFFF';
|
let replaceHex = '0000180FFFFFF7F';
|
||||||
let skipByte = 34;
|
let skipByte = 34;
|
||||||
|
|
||||||
let endResult;
|
let endResult;
|
||||||
|
|
||||||
if (ext === '.webm') {
|
if (ext === '.webm') {
|
||||||
searchHex = '2ad7b1';
|
searchHex = '2ad7b1';
|
||||||
replaceHex = '00000000';
|
replaceHex = '42FFB060';
|
||||||
skipByte = 8;
|
skipByte = 8;
|
||||||
|
|
||||||
endResult = replaceAt(file, file.indexOf(searchHex) + file.substring(file.indexOf(searchHex)).indexOf('4489') + skipByte, replaceHex);
|
endResult = replaceAt(file, file.indexOf(searchHex) + file.substring(file.indexOf(searchHex)).indexOf('4489') + skipByte, replaceHex);
|
||||||
|
@ -69,7 +77,8 @@ class cursesCommand extends Command {
|
||||||
}
|
}
|
||||||
|
|
||||||
fs.writeFileSync(`${os.tmpdir()}/cursed${message.id}${ext}`, Buffer.from(endResult, 'hex'));
|
fs.writeFileSync(`${os.tmpdir()}/cursed${message.id}${ext}`, Buffer.from(endResult, 'hex'));
|
||||||
return message.channel.send({files: [`${os.tmpdir()}/cursed${message.id}${ext}`]})
|
message.delete();
|
||||||
|
return message.channel.send(`Cursed by ${message.author}`, {files: [`${os.tmpdir()}/cursed${message.id}${ext}`]})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
return message.channel.send('Video is too big! try again with something smaller');
|
return message.channel.send('Video is too big! try again with something smaller');
|
||||||
|
|
|
@ -85,7 +85,7 @@ class vidshittyfierCommand extends Command {
|
||||||
ffmpegCommand.on('end', () => {
|
ffmpegCommand.on('end', () => {
|
||||||
loadingmsg.delete();
|
loadingmsg.delete();
|
||||||
message.delete();
|
message.delete();
|
||||||
return message.channel.send({files: [output2]})
|
return message.channel.send(`Shittyfied by ${message.author}`, {files: [output2]})
|
||||||
.catch(err => {
|
.catch(err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
return message.channel.send(`${err.name}: ${err.message} ${err.message === 'Request entity too large' ? 'The file size is too big' : ''}`);
|
return message.channel.send(`${err.name}: ${err.message} ${err.message === 'Request entity too large' ? 'The file size is too big' : ''}`);
|
||||||
|
|
|
@ -57,7 +57,7 @@ class gif2vidCommand extends Command {
|
||||||
ffmpegCommand.on('end', () => {
|
ffmpegCommand.on('end', () => {
|
||||||
loadingmsg.delete();
|
loadingmsg.delete();
|
||||||
message.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 => {
|
.catch(err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
return message.channel.send(`${err.name}: ${err.message} ${err.message === 'Request entity too large' ? 'The file size is too big' : ''}`);
|
return message.channel.send(`${err.name}: ${err.message} ${err.message === 'Request entity too large' ? 'The file size is too big' : ''}`);
|
||||||
|
|
|
@ -63,7 +63,7 @@ class vid2gifCommand extends Command {
|
||||||
ffmpegCommand.on('end', () => {
|
ffmpegCommand.on('end', () => {
|
||||||
loadingmsg.delete();
|
loadingmsg.delete();
|
||||||
message.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 => {
|
.catch(err => {
|
||||||
console.error(err);
|
console.error(err);
|
||||||
return message.channel.send(`${err.name}: ${err.message} ${err.message === 'Request entity too large' ? 'The file size is too big' : ''}`);
|
return message.channel.send(`${err.name}: ${err.message} ${err.message === 'Request entity too large' ? 'The file size is too big' : ''}`);
|
||||||
|
|
2
rand.js
2
rand.js
|
@ -27,7 +27,7 @@ exports.random = function (text, message) {
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: /\[member\]/,
|
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\]/,
|
name: /\[memberRand\]/,
|
||||||
|
|
Loading…
Reference in a new issue