ashlynn/TBHFileSharingBotPublic · Bot Template
Share files quickly and securely with @TBHFileSharingBot. Send files up to 4 GB and receive instant sharing links for Telegram or direct sharing. With secure encryption, inline mode, and a simple workflow, sharing files from any Telegram chat is fast and effortless.
Utilityfile-sharinginline-modetelegram-linkschannel-storagedocumentsvideos
11 commands0 envUpdated 2d agoCreated Sep 26, 2025
commands/@.js
javascript · 104 lines
1/**#command2name: @3answer: 4keyboard: 5parse_mode: 6aliases: 7allow_only_group: false8need_reply: false9is_web: 010#command**/11 12const BOT_OWNER = 7427294551;13const BOT_CHANNEL = -1003048702871;14const SIA_SECRET = "ahsynsjd189034";15const PUBLIC_BOT = true;16const BOT_USERNAME = "TBHFileSharingBot";17 18function getSalt(length = 16) {19 const chars = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';20 let salt = '';21 for (let i = 0; i < length; i++) {22 salt += chars.charAt(Math.floor(Math.random() * chars.length));23 }24 return salt;25}26 27function getKey(salt, secret, iterations = 1000, keyLength = 32) {28 const key = new Uint8Array(keyLength);29 for (let i = 0; i < keyLength; i++) {30 key[i] = (secret.charCodeAt(i % secret.length) + salt.charCodeAt(i % salt.length)) % 256;31 }32 for (let j = 0; j < iterations; j++) {33 for (let i = 0; i < keyLength; i++) {34 key[i] = (key[i] + secret.charCodeAt(i % secret.length) + salt.charCodeAt(i % salt.length)) % 256;35 }36 }37 return key;38}39 40function baseEncode(input) {41 const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';42 let output = '';43 let buffer = 0;44 let bitsLeft = 0;45 for (let i = 0; i < input.length; i++) {46 buffer = (buffer << 8) | input.charCodeAt(i);47 bitsLeft += 8;48 while (bitsLeft >= 5) {49 output += alphabet[(buffer >> (bitsLeft - 5)) & 31];50 bitsLeft -= 5;51 }52 }53 if (bitsLeft > 0) {54 output += alphabet[(buffer << (5 - bitsLeft)) & 31];55 }56 return output;57}58 59function baseDecode(input) {60 const alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ234567';61 const lookup = {};62 for (let i = 0; i < alphabet.length; i++) {63 lookup[alphabet[i]] = i;64 }65 let buffer = 0;66 let bitsLeft = 0;67 let output = '';68 for (let i = 0; i < input.length; i++) {69 buffer = (buffer << 5) | lookup[input[i]];70 bitsLeft += 5;71 if (bitsLeft >= 8) {72 output += String.fromCharCode((buffer >> (bitsLeft - 8)) & 255);73 bitsLeft -= 8;74 }75 }76 return output;77}78 79function hashText(text) {80 const salt = getSalt();81 const key = getKey(salt, SIA_SECRET);82 const encoded = String(text).split('').map((char, index) => {83 return String.fromCharCode(char.charCodeAt(0) ^ key[index % key.length]);84 }).join('');85 return baseEncode(salt + encoded);86}87 88function deHashText(hashed) {89 const decoded = baseDecode(hashed);90 const salt = decoded.substring(0, 16);91 const encoded = decoded.substring(16);92 const key = getKey(salt, SIA_SECRET);93 const text = encoded.split('').map((char, index) => {94 return String.fromCharCode(char.charCodeAt(0) ^ key[index % key.length]);95 }).join('');96 return text;97}98 99function generateUUID() {100 return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {101 var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8);102 return v.toString(16);103 });104}