Changed some hex to replace and added an alias
Signed-off-by: loicbersier <loic.bersier1@gmail.com>
This commit is contained in:
parent
acfe0010a5
commit
be1db47633
1 changed files with 6 additions and 5 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: [
|
||||||
|
@ -43,12 +43,13 @@ 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';
|
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, [`--format=${ext.replace('.', '')}`], `${os.tmpdir()}/${message.id}${ext}`)
|
downloader(link, [`--format=${ext.replace('.', '')}`], `${os.tmpdir()}/${message.id}${ext}`)
|
||||||
.on('error', async err => {
|
.on('error', async err => {
|
||||||
|
@ -60,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);
|
||||||
|
|
Loading…
Reference in a new issue