Skip to content

Commit

Permalink
Add files via upload
Browse files Browse the repository at this point in the history
  • Loading branch information
Nasrullahmalik authored Feb 16, 2024
1 parent 15ec754 commit 356b015
Show file tree
Hide file tree
Showing 6 changed files with 140 additions and 4 deletions.
7 changes: 4 additions & 3 deletions lib/Gifbuffer.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ const GIFBufferToVideoBuffer = async (image) => {

await fs.writeFile(gifFilePath, image);

await promisify(exec)(
`ffmpeg -i ${gifFilePath} -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" ${mp4FilePath}`
);
const ffmpegCommand = `ffmpeg -i "${gifFilePath}" -movflags faststart -pix_fmt yuv420p -vf "scale=trunc(iw/2)*2:trunc(ih/2)*2" "${mp4FilePath}"`;

await promisify(exec)(ffmpegCommand);

await sleep(4000);

Expand All @@ -33,3 +33,4 @@ const GIFBufferToVideoBuffer = async (image) => {
};

export default GIFBufferToVideoBuffer;

1 change: 1 addition & 0 deletions lib/bard.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

54 changes: 54 additions & 0 deletions lib/bard2.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
'use strict';

import axios from 'axios';

class Bard {
constructor() {}

async question({ ask: questionText }) {
if (!questionText) {
throw new Error("Please specify a question!");
}

try {
const response = await axios.post("https://bard.rizzy.eu.org/api/onstage", {
'ask': questionText
}, {
'headers': {
'Content-Type': "application/json"
}
});

return response.data;
} catch (error) {
throw new Error("Error: " + error.message);
}
}

async questionWithImage({ ask: questionText, image: imageUrl }) {
if (!questionText) {
throw new Error("Please specify a question!");
}

if (!imageUrl) {
throw new Error("Please specify a URL for the image!");
}

try {
const response = await axios.post("https://bard.rizzy.eu.org/api/onstage/image", {
'ask': questionText,
'image': imageUrl
}, {
'headers': {
'Content-Type': "application/json"
}
});

return response.data;
} catch (error) {
throw new Error("Error: " + error.message);
}
}
}

export default Bard;
24 changes: 24 additions & 0 deletions lib/imgur.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import pkg from 'imgur';
import fs from 'fs';

const { ImgurClient } = pkg;

const client = new ImgurClient({ clientId: "a0113354926015a" });

async function uploadtoimgur(imagepath) {
try {
const response = await client.upload({
image: fs.createReadStream(imagepath),
type: 'stream',
});

let url = response.data.link;
console.log(url);
return url;
} catch (error) {
console.error('Error uploading image to Imgur:', error);
throw error;
}
}

export default uploadtoimgur;
43 changes: 42 additions & 1 deletion lib/makesession.js
Original file line number Diff line number Diff line change
@@ -1 +1,42 @@
(function(_0x3f3561,_0x281ff7){const _0x4b8bcf=_0x39ab,_0x2d89cb=_0x3f3561();while(!![]){try{const _0x11f1be=parseInt(_0x4b8bcf(0xbd))/0x1+-parseInt(_0x4b8bcf(0xc7))/0x2+-parseInt(_0x4b8bcf(0xcf))/0x3*(parseInt(_0x4b8bcf(0xc6))/0x4)+-parseInt(_0x4b8bcf(0xbf))/0x5+parseInt(_0x4b8bcf(0xb9))/0x6*(parseInt(_0x4b8bcf(0xc5))/0x7)+-parseInt(_0x4b8bcf(0xc9))/0x8+parseInt(_0x4b8bcf(0xd0))/0x9;if(_0x11f1be===_0x281ff7)break;else _0x2d89cb['push'](_0x2d89cb['shift']());}catch(_0x57548d){_0x2d89cb['push'](_0x2d89cb['shift']());}}}(_0x34a3,0x908da));function _0x34a3(){const _0x230877=['6579536CqyNaV','base64','dirname','url','Error\x20fetching\x20data:\x20','session','1201011tUjtZj','6268716yIALbr','6SkRPsO','parse','from','split','865999lBPjMs','join','141625aeXJLL','creds.json','stringify','statusText','http://paste.c-net.org/','Credentials\x20saved\x20to\x20creds.json','3062913dWVjHX','4VgiPyy','313776INiCEJ','log'];_0x34a3=function(){return _0x230877;};return _0x34a3();}import _0x4e5d8f from'node-fetch';function _0x39ab(_0x3ffd06,_0x30e15f){const _0x34a329=_0x34a3();return _0x39ab=function(_0x39ab39,_0x4f18ac){_0x39ab39=_0x39ab39-0xb9;let _0x17babb=_0x34a329[_0x39ab39];return _0x17babb;},_0x39ab(_0x3ffd06,_0x30e15f);}import{fileURLToPath}from'url';import _0x3c0b37 from'path';import{writeFileSync,readFileSync}from'fs';async function processTxtAndSaveCredentials(_0x2c3f31){const _0x44aef9=_0x39ab,_0x597ab8=fileURLToPath(import.meta[_0x44aef9(0xcc)]),_0x504541=_0x3c0b37[_0x44aef9(0xcb)](_0x597ab8),_0xcd5909=_0x2c3f31[_0x44aef9(0xbc)]('_')[0x1],_0x11fae5=_0x44aef9(0xc3)+_0xcd5909;try{const _0x531330=await _0x4e5d8f(_0x11fae5);if(!_0x531330['ok'])throw new Error(_0x44aef9(0xcd)+_0x531330[_0x44aef9(0xc2)]);const _0x401d54=await _0x531330['text'](),_0x4a4a98=Buffer[_0x44aef9(0xbb)](_0x401d54,_0x44aef9(0xca))['toString'](),_0x225786=JSON[_0x44aef9(0xba)](_0x4a4a98),_0x4a726c=_0x3c0b37[_0x44aef9(0xbe)](_0x504541,'..',_0x44aef9(0xce),_0x44aef9(0xc0));writeFileSync(_0x4a726c,JSON[_0x44aef9(0xc1)](_0x225786,null,0x2)),console[_0x44aef9(0xc8)](_0x44aef9(0xc4));}catch(_0x2e4171){console['error']('Error\x20retrieving\x20or\x20processing\x20data:',_0x2e4171);}}export default processTxtAndSaveCredentials;
import axios from 'axios';
import { fileURLToPath } from 'url';
import path from 'path';
import { writeFileSync } from 'fs';
import { BufferJSON } from '@whiskeysockets/baileys';

async function processTxtAndSaveCredentials(txt) {
const __filename = fileURLToPath(import.meta.url);
const __dirname = path.dirname(__filename);

let decodedData;

const isBase64 = /^[a-zA-Z0-9+/]+={0,2}$/.test(txt);

if (isBase64) {
decodedData = Buffer.from(txt, 'base64').toString('utf-8');
} else {
const url = `https://pastebin.guruapi.tech/pastes?action=getpaste&id=${txt}`;

try {
const response = await axios.get(url);

const base64Data = response.data.content;

decodedData = Buffer.from(base64Data, 'base64').toString('utf-8');
} catch (error) {
console.error('Error retrieving or processing data:', error);
return;
}
}

try {
const credentials = JSON.parse(decodedData, BufferJSON.reviver);
const credsPath = path.join(__dirname, '..', 'session', 'creds.json');
writeFileSync(credsPath, JSON.stringify(credentials, BufferJSON.replacer, 2));
console.log('Credentials saved to creds.json');
} catch (jsonError) {
console.error('Error parsing JSON:', jsonError);
}
}

export default processTxtAndSaveCredentials;
15 changes: 15 additions & 0 deletions lib/tictactoe.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
export declare class TicTacToe {
/* X PlayerName */
playerX: string;
/* Y PlayerName */
playerY: string;
/* X if true, Y if false */
_currentTurn: boolean;
_x: number;
_y: number;
_turns: number;
constructor(playerX: string, playerY: string);
get board(): number;
turn(player, index: number): boolean;
turn(player, x: number, y: number): boolean;
}

0 comments on commit 356b015

Please sign in to comment.