├── .gitignore ├── Dockerfile ├── FileGuardian ├── FileGuardianBot │ ├── bot │ │ ├── bot.js │ │ ├── i18n │ │ │ ├── __init__.js │ │ │ ├── ba10.js │ │ │ ├── data.js │ │ │ ├── edtB10.js │ │ │ ├── languages │ │ │ │ ├── arb.json │ │ │ │ ├── eng.json │ │ │ │ ├── frn.json │ │ │ │ ├── hnd.json │ │ │ │ ├── ind.json │ │ │ │ ├── mal.json │ │ │ │ ├── rus.json │ │ │ │ ├── spn.json │ │ │ │ └── uzb.json │ │ │ ├── t9n.js │ │ │ └── utils.js │ │ ├── loader.js │ │ ├── monGo │ │ │ ├── core.js │ │ │ ├── database.js │ │ │ ├── extras.js │ │ │ └── shdulFrmDb.js │ │ └── plugins │ │ │ ├── __init__.js │ │ │ ├── aggregator.js │ │ │ ├── batch.js │ │ │ ├── button.js │ │ │ ├── callBack │ │ │ ├── __init__.js │ │ │ ├── askCapBut.js │ │ │ ├── batchCB.js │ │ │ ├── close.js │ │ │ ├── editDuration.js │ │ │ ├── editLang.js │ │ │ ├── editSettings.js │ │ │ ├── getDuration.js │ │ │ ├── getLang.js │ │ │ ├── getSettings.js │ │ │ ├── help.js │ │ │ └── refresh.js │ │ │ ├── callbBack.js │ │ │ ├── caption.js │ │ │ ├── cryptoG │ │ │ ├── __init__.js │ │ │ ├── decrypt.js │ │ │ └── encrypt.js │ │ │ ├── generate.js │ │ │ ├── helpers │ │ │ ├── __init__.js │ │ │ ├── edit.js │ │ │ ├── forceSub.js │ │ │ ├── forward.js │ │ │ ├── limitHandler.js │ │ │ └── reply.js │ │ │ ├── inline.js │ │ │ ├── localDB │ │ │ ├── __init__.js │ │ │ ├── _model.json │ │ │ ├── batchData.js │ │ │ ├── generData.js │ │ │ └── request.js │ │ │ ├── request.js │ │ │ ├── scheduler │ │ │ ├── __init__.js │ │ │ ├── deleteMsg.js │ │ │ ├── scheduleAfter.js │ │ │ └── scheduleAt.js │ │ │ ├── start.js │ │ │ ├── statistics.js │ │ │ ├── token │ │ │ ├── check_activity.js │ │ │ ├── enter_data.js │ │ │ ├── shortenLink.js │ │ │ └── user_activity.js │ │ │ └── util │ │ │ ├── acceptUser.js │ │ │ ├── checkDecCode.js │ │ │ ├── decHandler.js │ │ │ └── setPassword.js │ ├── config.js │ ├── index.js │ └── logger.js └── webServer │ ├── index.js │ └── template │ ├── about │ ├── index.html │ └── styles.css │ ├── donate │ ├── index.html │ └── styles.css │ ├── home │ ├── index.html │ └── styles.css │ └── source │ ├── index.html │ └── styles.css ├── LICENSE ├── README.md ├── heroku.yml ├── package-lock.json └── package.json /.gitignore: -------------------------------------------------------------------------------- 1 | # Ignore the node_modules directory 2 | node_modules/ 3 | 4 | # Ignore all files with extensions .pdf, .mp3, .mp4 5 | *.pdf 6 | *.mp3 7 | *.mp4 8 | 9 | # Ignore .log files 10 | *.log 11 | 12 | # Ignore the .env file 13 | .env -------------------------------------------------------------------------------- /Dockerfile: -------------------------------------------------------------------------------- 1 | # Use an official Node.js runtime as the base image 2 | FROM node:21-alpine3.17 3 | 4 | # Create and set the working directory in the container 5 | WORKDIR /FileGuardianBot 6 | 7 | # Copy the rest of your project files to the container 8 | COPY . . 9 | 10 | # Install all node packages 11 | RUN npm install 12 | 13 | # Command to start your Node.js application 14 | CMD ["node", "FileGuardian/FileGuardianBot"] 15 | -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/i18n/__init__.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | /** 5 | * i18n (Internationalization) Structure: 6 | * 7 | * This directory organizes language files for various locales. 8 | * 9 | * Folders: 10 | * languages: 11 | * - Each language has its own folder containing JSON 12 | * files with translations. 13 | * 14 | * Files: 15 | * - data.js: 16 | * - Stores default values for users and supported 17 | * languages as a dictionary. 18 | * - utils.js: 19 | * - Provides utilities to determine a user's language, 20 | * (e.g: "eng") based on user settings. 21 | * -ba10.js: 22 | * - helps to create batton (i mean fun..) 23 | * - convert dict to button 24 | * - t9n.js: 25 | * - translation (athilum funn ann udashiche..) 26 | * - helps to translate text, button 27 | */ 28 | -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/i18n/ba10.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | const { Button } = require("telegram/tl/custom/button"); 20 | 21 | const maxClmnForButton = 2; 22 | const elements = ["http://", "https://"] 23 | 24 | /** 25 | * This function converts a dictionary into buttons. Depending on the 26 | * dictionary's values, it determines the type of buttons needed. 27 | * 28 | * @param {object} button - An object containing button values. 29 | * @param {number} [order=maxClmnForButton] - The maximum number of button columns 30 | * (default: 2). 31 | * 32 | * @returns {object} - Returns an object. 33 | */ 34 | 35 | createButton = async function( 36 | { button, order=maxClmnForButton } 37 | ){ 38 | let temp_button = []; 39 | 40 | if(Object.keys(button).length <= 0){ 41 | return temp_button; 42 | }; 43 | 44 | for (const key in button) { 45 | // console.log(key, button[key]); 46 | let type="callback", value=button[key]; 47 | if (elements.some(element => value.startsWith(element))){ 48 | // all links starts with http, https are treated as url 49 | type="url"; value=value; 50 | } else if (value.startsWith(":")){ 51 | // startWith (:) will be treated as inline_query 52 | type="query"; value=value.slice(1); 53 | } 54 | 55 | if (type==="url") { 56 | temp_button.push( 57 | Button.url(text=key, url=value) 58 | ) 59 | } else if (type==="callback") { 60 | value=Buffer.from(value.toString()); 61 | temp_button.push( 62 | Button.inline(text=key, data=value===0?undefined:value) 63 | ) 64 | } else if (type==="query"){ 65 | temp_button.push( 66 | Button.switchInline(text=key, query=value, samePeer=true) 67 | ) 68 | } 69 | }; 70 | 71 | let keyboard = []; 72 | 73 | if (order === maxClmnForButton) { 74 | for (let i = 0; i < temp_button.length; i += maxClmnForButton) { 75 | keyboard.push(temp_button.slice(i, i + maxClmnForButton)); 76 | } 77 | } else { 78 | let newOrder = order.toString().split("").map(Number); 79 | let buttonIterator = temp_button[Symbol.iterator](); 80 | 81 | keyboard = newOrder.map(elem => { 82 | let subArray = []; 83 | 84 | for (let i = 0; i < elem; i++) { 85 | subArray.push(buttonIterator.next().value); 86 | } 87 | 88 | return subArray; 89 | }); 90 | } 91 | 92 | return keyboard ? keyboard : null; 93 | } 94 | 95 | module.exports = { 96 | maxClmnForButton, createButton 97 | } 98 | 99 | /** 100 | * 101 | * @license 102 | * FileShareBot is open-source software distributed under the MIT License. 103 | * Please see the LICENSE: file for more details. 104 | * 105 | * @repository 106 | * You can find the source code of this bot and contribute on GitHub: 107 | * https://github.com/nabilanavab/filesharebot 108 | * 109 | * @author 110 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 111 | * bug reports, or collaboration. 112 | * 113 | * Contact: https://telegram.me/nabilanavab 114 | * 115 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/i18n/data.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | // Here lie the default values – like a safety net for the overly 20 | // adventurous @nabilanavab. They may seem useless, but who knows 21 | // when they'll come to the rescue in your coding adventures! 🚀 22 | 23 | const userLang = { 24 | // 531733867: "eng", 25 | } 26 | 27 | const enabledLang = { 28 | eng: ["EN", "🏴󠁧󠁢󠁥󠁮󠁧󠁿"], 29 | hnd: ["HN", "🇮🇳"], 30 | mal: ["ML", "🇮🇳"], 31 | fr: ["FR", "🇫🇷"], 32 | spa: ["SPA", "🇪🇸"], 33 | ind: ["IND", "🇮🇩"], 34 | uz: ["UZ", "🇺🇿"], 35 | rus: ["RUS", "🇷🇺"], 36 | ara: ["ARA", "🇸🇦"] 37 | } 38 | 39 | module.exports = { 40 | userLang, enabledLang 41 | } 42 | 43 | /** 44 | * 45 | * @license 46 | * FileShareBot is open-source software distributed under the MIT License. 47 | * Please see the LICENSE: file for more details. 48 | * 49 | * @repository 50 | * You can find the source code of this bot and contribute on GitHub: 51 | * https://github.com/nabilanavab/filesharebot 52 | * 53 | * @author 54 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 55 | * bug reports, or collaboration. 56 | * 57 | * Contact: https://telegram.me/nabilanavab 58 | * 59 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/i18n/edtB10.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | const util = require('util'); 20 | 21 | /** 22 | * 23 | * Edits a dictionary based on provided conditions. 24 | * front : user INterface 25 | * value : if you pass any single value then {} will be replaced by the value in key[value] 26 | * 27 | * @param {object} inDict - Input dictionary. 28 | * @param {any} [value=false] - Value used for formatting dictionary values. 29 | * @param {boolean} [front=false] - Flag indicating whether to change cb in UI. 30 | * @returns {object} - Edited dictionary. 31 | * 32 | */ 33 | 34 | async function editDict({ inDict, value = false, front = false }) { 35 | try { 36 | let outDict = {}; 37 | 38 | if (front) { 39 | // Changes cb in UI 40 | for (const [i, j] of Object.entries(inDict)) { 41 | try{ 42 | const modifiedKey = i.replace('%s', front); 43 | outDict[modifiedKey] = j; 44 | } catch (error){ 45 | outDict[i] = j; 46 | } 47 | } 48 | inDict = outDict; 49 | } 50 | 51 | if (value && !Array.isArray(value)) { 52 | // Changes cb.data 53 | for (const [i, j] of Object.entries(inDict)) { 54 | // outDict[i] = util.format(j, value); 55 | outDict[i] = j.replace('%s', value); 56 | } 57 | } else if (Array.isArray(value)) { 58 | const valueLength = value.length; 59 | 60 | for (let [index, [i, j]] of Object.entries(Object.entries(inDict))) { 61 | index = parseInt(index); 62 | if (index < valueLength) { 63 | outDict[i] = util.format(j, value[index]); 64 | } else { 65 | outDict[i] = j; 66 | } 67 | } 68 | } 69 | return outDict; 70 | 71 | } catch ( error ) { 72 | 73 | return inDict; 74 | 75 | } 76 | } 77 | 78 | module.exports = editDict; 79 | 80 | /** 81 | * 82 | * @license 83 | * FileShareBot is open-source software distributed under the MIT License. 84 | * Please see the LICENSE: file for more details. 85 | * 86 | * @repository 87 | * You can find the source code of this bot and contribute on GitHub: 88 | * https://github.com/nabilanavab/filesharebot 89 | * 90 | * @author 91 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 92 | * bug reports, or collaboration. 93 | * 94 | * Contact: https://telegram.me/nabilanavab 95 | * 96 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/i18n/languages/arb.json: -------------------------------------------------------------------------------- 1 | { 2 | "force" : { 3 | "message" : "🚨 Attention: Increased demand has led to a mandatory subscription for access management..\n\n🔗 Use the below '🪐 JOIN CHANNEL 🪐' button & once you are in use '♻️ REFRESH ♻️'!", 4 | "button" : { 5 | "🪐 JOIN CHANNEL 🪐" : "%s", 6 | "♻️ REFRESH ♻️" : "%s" 7 | }, 8 | "fool": "Click the button above and join the chat to proceed! 😎" 9 | }, 10 | "timeLimit" : { 11 | "message" : "`⚠️ You are sending messages too frequently.`\n`Please wait for %s seconds. ⌛🤐`", 12 | "button" : { 13 | "🔄 Try Again: %s seconds Over! 🔄✨" : "generate" 14 | } 15 | }, 16 | "help" : { 17 | "0" : { 18 | "message" : "👋 Welcome to the FileShare Bot! 📁\n\nWith FileShare Bot, you can easily share and manage files, documents, and more. Whether you want to send a document, a photo, or any other file, our bot has got you covered. You can also add password protection for extra security.\n\nGet started, by simply sending a file you want to share\n\npowered by: @ilovepdf_bot ❤️", 19 | "button" : { 20 | "🌍 LANGUAGE 🌍" : "~lang", 21 | "📚 HELP 📚" : "-help|1", 22 | "🌟 SOURCE CODE 🌟" : "https://github.com/nabilanavab", 23 | "🔊 CHANNEL 🔊" : "https://telegram.dog/ilovepdf_bot", 24 | "🤠 ADMIN 🤠" : "https://github.com/nabilanavab", 25 | "⚙️ SETTINGS ⚙️" : "!set" 26 | } 27 | }, 28 | "1" : { 29 | "message" : "🤖 Discover DataGuard - Your Ultimate Privacy Shield! 🔒\n\nTired of your data going public? Look no further! DataGuard is your solution to safeguarding information. Generate unique links for your text, files, gifs, stickers, and more! Worried about unauthorized access? Add an extra layer with personal passwords – clients will need it to unlock the treasure. This bot is simpler than you think! Just forward anything you want to protect, and witness the magic unfold.\n\nYour privacy, your control. 🔐✨", 30 | "button" : { 31 | "🔙 BacK" : "-help|0", 32 | "NexT ➡️" : "-help|2" 33 | } 34 | }, 35 | "2" : { 36 | "message" : "🤖 Introducing FIleShareBot - Your File Batch Wizard! 📦\n\nEver wished to combine multiple files into one neat package? Now you can with the `/batch` command! Just send it in my private chat, then forward the first file from any channel and the last message of the batch from the same channel. Voila! I'll weave them into a single file, generating a unique link for your convenience. If it's a private channel, ensure I'm an administrator for the magic to unfold.\n\nSimplify your sharing, one batch at a time! 🌐✨", 37 | "button" : { 38 | "🔙 BacK" : "-help|1", 39 | "NexT ➡️" : "-help|0" 40 | } 41 | } 42 | }, 43 | "settings" : { 44 | "message" : "⚙️ SETTINGS: \n\n🔐 SET PASSWORD: Enhance additional security by setting a password for your data. This can be applied to all formats, including text, stickers, and more.\n\n🚫 CAN'T FORWARD: Restrict the forwarding of messages to maintain privacy and control the flow of information in your bot.\n\n📸NO CAPTIONS: Customize media sharing by removing captions from files, providing a cleaner and more streamlined user experience.\n\n👤 WITHOUT QUOTES: Tailor your bot's appearance by removing author information from messages, offering a sleek and minimalist interface.\n\n🚷 ACCESS CLOSED: Customize access to features based on user roles or conditions, allowing you to control and limit certain functionalities.\n\n🗑️ AUTO-ERASE: Enable the auto-erase function to seamlessly remove messages, enhancing data control and privacy within your bot.", 45 | "button" : { 46 | "SET PASSWORD" : ":", 47 | "CANT FORWARD" : "!noforwards", 48 | "NO CAPTIONS" : "!dropMediaCaptions", 49 | "WITHOUT QUOTES" : "!dropAuthor", 50 | "CANT ACCESS" : "!isAccesable", 51 | "AUTO-ERASE" : "$duration", 52 | "🔙 BacK" : "-help|0" 53 | }, 54 | "errorLink" : "⚠️ Showing some error!\n\nPlease check the link again. 🚫🌐", 55 | "noAccess" : "🚫 Temporarily Admin Disabled This File 📂\n\nContact the link creator or try again later. 🔄📞", 56 | "_noAccess": "🚫 Temporarily Admin Disabled This File 📂", 57 | "noAccessBtn" : { "♻️ Try Again ♻️" : "%s" }, 58 | "setPassword" : "🔒 Set Password As:", 59 | "bigPassword" : "⛔ Too Big Password..", 60 | "samePassword" : "🔑 Current Password..", 61 | "passUpdated" : "🔒 Password Updated...\n\nClick the button below to find out! 🤫👇", 62 | "passworDlt" : "🚫 Delete Password..", 63 | "enterPass" : "✍️ Now Enter Password..", 64 | "closeCB" : { "🚶‍♀️ Close 🚶‍♀️" : "close"}, 65 | "passUpdCB" : { "VIEW PASSWORD" : "%s", "🚶‍♀️ Close 🚶‍♀️" : "close" }, 66 | "askPassword" : "This file is secure with a password 🔒.\n\nUse the button below if you have the password to access it. 👇🔑", 67 | "askPswdButon" : { "😎 i know the password 😎" : ":get %s " }, 68 | "messageDeleted" : "Unfortunately, something went wrong. 🤷‍♂️🚫\n\n" 69 | }, 70 | "lang" : { 71 | "select" : "Now, select a language depending on your choice: 🌐🗣️", 72 | "back" : { "🔙 BacK" : "-help|0" }, 73 | "already" : "Already, you are using this Language 🙇🏻" 74 | }, 75 | "batch" : { 76 | "new" : "Use '📢 Batch From Channel 📢' to group a set of messages from a channel. Simply send the first and last message, and it will batch the first 100 messages if the number of messages between the first and last exceeds 100.\n\nOn the other hand, '👤 Batch My Message 👤' lets you batch individual messages you send one by one, with a maximum limit of 10 messages", 77 | "newButton" : { "📢 Batch From Channel 📢" : "@batchChannel", "👤 Batch My Message 👤" : "@batchMessage", "✖️ Close ✖️" : "close"}, 78 | "inProgress" : "A batch job is currently in progress... ⌛🔄", 79 | "sendFisrtMsg" : "Now forward me the first message of the batch file from a public channel\n\nor grant me admin access in the channel and forward. 🔄📤", 80 | "sendLastMsg" : "Now send me the last message to get batched. 📤\n\nNB: Both messages must be from the same channel. 🔄>", 81 | "lastMsgError" : "Send me the last message to be forwarded. 📬\n\nNB:\n- It must be from the same channel.\n- This message must be after the first message. 🔄", 82 | "sendMessage" : "Send me some messages to get batched. 📤\n\n/batch: to batch current data\nCurrent data in Queue 🔄: ", "forwarded" : "📬 Total Messages Frowarded : ", 83 | "forwardIt" : "Ooh, I'm waiting for a forward message from some public channel\n\nor a channel where I am an admin. ⏳📤", 84 | "cancel" : { "🙂 Cancel 🙂" : "@cancelBatch"}, "canceled" : { "🙃 Canceled 🙃" : "waste"}, 85 | "procCancel" : "All queues are cleared,\n\nthe current process is canceled. 🙃", 86 | "adminReq" : "Bot must be an admin in the channel; otherwise, it can't access the files. 🤖🚫" 87 | }, 88 | "generate" : { 89 | "privLink" : "Good news! Your protected link is ready for sharing.. 🌐🔒\n\nNB: Always remember, only the one who knows the password can access this data 🔑\n\n", 90 | "publLink" : "Good news! Your public link is ready for sharing.🌐🔗\n\nNB: Always remember this is a public link anyone can use this link to fetch data 🚫🔒\n\n", 91 | "button" : { 92 | "📂 VIEW FILE 📂" : "%s", 93 | "📎 SHARE URL 📎" : "https://t.me/share/url?url=%s" 94 | } 95 | }, 96 | "duration" : { 97 | "message" : "Now, select a time duration for the message.\n\nIt will delete the message after the specified time. ⏰🚫", 98 | "button" : { "Dont Erase" : "$delete", "10 sec" : "$10", "30 sec" : "$30", 99 | "1 min" : "$60", "10 min" : "$600", "15 min" : "$900", 100 | "30 min" : "$1800", "1 hr" : "$3600", "3 hr" : "$10800", 101 | "6 hr" : "$21600", "12 hr" : "$43200", "1 day" : "$86400", "🔙 BacK" : "!set" } 102 | } 103 | } -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/i18n/languages/frn.json: -------------------------------------------------------------------------------- 1 | { 2 | "force" : { 3 | "message" : "🚨 Attention: Increased demand has led to a mandatory subscription for access management..\n\n🔗 Use the below '🪐 JOIN CHANNEL 🪐' button & once you are in use '♻️ REFRESH ♻️'!", 4 | "button" : { 5 | "🪐 JOIN CHANNEL 🪐" : "%s", 6 | "♻️ REFRESH ♻️" : "%s" 7 | }, 8 | "fool": "Click the button above and join the chat to proceed! 😎" 9 | }, 10 | "timeLimit" : { 11 | "message" : "`⚠️ You are sending messages too frequently.`\n`Please wait for %s seconds. ⌛🤐`", 12 | "button" : { 13 | "🔄 Try Again: %s seconds Over! 🔄✨" : "generate" 14 | } 15 | }, 16 | "help" : { 17 | "0" : { 18 | "message" : "👋 Welcome to the FileShare Bot! 📁\n\nWith FileShare Bot, you can easily share and manage files, documents, and more. Whether you want to send a document, a photo, or any other file, our bot has got you covered. You can also add password protection for extra security.\n\nGet started, by simply sending a file you want to share\n\npowered by: @ilovepdf_bot ❤️", 19 | "button" : { 20 | "🌍 LANGUAGE 🌍" : "~lang", 21 | "📚 HELP 📚" : "-help|1", 22 | "🌟 SOURCE CODE 🌟" : "https://github.com/nabilanavab", 23 | "🔊 CHANNEL 🔊" : "https://telegram.dog/ilovepdf_bot", 24 | "🤠 ADMIN 🤠" : "https://github.com/nabilanavab", 25 | "⚙️ SETTINGS ⚙️" : "!set" 26 | } 27 | }, 28 | "1" : { 29 | "message" : "🤖 Discover DataGuard - Your Ultimate Privacy Shield! 🔒\n\nTired of your data going public? Look no further! DataGuard is your solution to safeguarding information. Generate unique links for your text, files, gifs, stickers, and more! Worried about unauthorized access? Add an extra layer with personal passwords – clients will need it to unlock the treasure. This bot is simpler than you think! Just forward anything you want to protect, and witness the magic unfold.\n\nYour privacy, your control. 🔐✨", 30 | "button" : { 31 | "🔙 BacK" : "-help|0", 32 | "NexT ➡️" : "-help|2" 33 | } 34 | }, 35 | "2" : { 36 | "message" : "🤖 Introducing FIleShareBot - Your File Batch Wizard! 📦\n\nEver wished to combine multiple files into one neat package? Now you can with the `/batch` command! Just send it in my private chat, then forward the first file from any channel and the last message of the batch from the same channel. Voila! I'll weave them into a single file, generating a unique link for your convenience. If it's a private channel, ensure I'm an administrator for the magic to unfold.\n\nSimplify your sharing, one batch at a time! 🌐✨", 37 | "button" : { 38 | "🔙 BacK" : "-help|1", 39 | "NexT ➡️" : "-help|0" 40 | } 41 | } 42 | }, 43 | "settings" : { 44 | "message" : "⚙️ SETTINGS: \n\n🔐 SET PASSWORD: Enhance additional security by setting a password for your data. This can be applied to all formats, including text, stickers, and more.\n\n🚫 CAN'T FORWARD: Restrict the forwarding of messages to maintain privacy and control the flow of information in your bot.\n\n📸NO CAPTIONS: Customize media sharing by removing captions from files, providing a cleaner and more streamlined user experience.\n\n👤 WITHOUT QUOTES: Tailor your bot's appearance by removing author information from messages, offering a sleek and minimalist interface.\n\n🚷 ACCESS CLOSED: Customize access to features based on user roles or conditions, allowing you to control and limit certain functionalities.\n\n🗑️ AUTO-ERASE: Enable the auto-erase function to seamlessly remove messages, enhancing data control and privacy within your bot.", 45 | "button" : { 46 | "SET PASSWORD" : ":", 47 | "CANT FORWARD" : "!noforwards", 48 | "NO CAPTIONS" : "!dropMediaCaptions", 49 | "WITHOUT QUOTES" : "!dropAuthor", 50 | "CANT ACCESS" : "!isAccesable", 51 | "AUTO-ERASE" : "$duration", 52 | "🔙 BacK" : "-help|0" 53 | }, 54 | "errorLink" : "⚠️ Showing some error!\n\nPlease check the link again. 🚫🌐", 55 | "noAccess" : "🚫 Temporarily Admin Disabled This File 📂\n\nContact the link creator or try again later. 🔄📞", 56 | "_noAccess": "🚫 Temporarily Admin Disabled This File 📂", 57 | "noAccessBtn" : { "♻️ Try Again ♻️" : "%s" }, 58 | "setPassword" : "🔒 Set Password As:", 59 | "bigPassword" : "⛔ Too Big Password..", 60 | "samePassword" : "🔑 Current Password..", 61 | "passUpdated" : "🔒 Password Updated...\n\nClick the button below to find out! 🤫👇", 62 | "passworDlt" : "🚫 Delete Password..", 63 | "enterPass" : "✍️ Now Enter Password..", 64 | "closeCB" : { "🚶‍♀️ Close 🚶‍♀️" : "close"}, 65 | "passUpdCB" : { "VIEW PASSWORD" : "%s", "🚶‍♀️ Close 🚶‍♀️" : "close" }, 66 | "askPassword" : "This file is secure with a password 🔒.\n\nUse the button below if you have the password to access it. 👇🔑", 67 | "askPswdButon" : { "😎 i know the password 😎" : ":get %s " }, 68 | "messageDeleted" : "Unfortunately, something went wrong. 🤷‍♂️🚫\n\n" 69 | }, 70 | "lang" : { 71 | "select" : "Now, select a language depending on your choice: 🌐🗣️", 72 | "back" : { "🔙 BacK" : "-help|0" }, 73 | "already" : "Already, you are using this Language 🙇🏻" 74 | }, 75 | "batch" : { 76 | "new" : "Use '📢 Batch From Channel 📢' to group a set of messages from a channel. Simply send the first and last message, and it will batch the first 100 messages if the number of messages between the first and last exceeds 100.\n\nOn the other hand, '👤 Batch My Message 👤' lets you batch individual messages you send one by one, with a maximum limit of 10 messages", 77 | "newButton" : { "📢 Batch From Channel 📢" : "@batchChannel", "👤 Batch My Message 👤" : "@batchMessage", "✖️ Close ✖️" : "close"}, 78 | "inProgress" : "A batch job is currently in progress... ⌛🔄", 79 | "sendFisrtMsg" : "Now forward me the first message of the batch file from a public channel\n\nor grant me admin access in the channel and forward. 🔄📤", 80 | "sendLastMsg" : "Now send me the last message to get batched. 📤\n\nNB: Both messages must be from the same channel. 🔄>", 81 | "lastMsgError" : "Send me the last message to be forwarded. 📬\n\nNB:\n- It must be from the same channel.\n- This message must be after the first message. 🔄", 82 | "sendMessage" : "Send me some messages to get batched. 📤\n\n/batch: to batch current data\nCurrent data in Queue 🔄: ", "forwarded" : "📬 Total Messages Frowarded : ", 83 | "forwardIt" : "Ooh, I'm waiting for a forward message from some public channel\n\nor a channel where I am an admin. ⏳📤", 84 | "cancel" : { "🙂 Cancel 🙂" : "@cancelBatch"}, "canceled" : { "🙃 Canceled 🙃" : "waste"}, 85 | "procCancel" : "All queues are cleared,\n\nthe current process is canceled. 🙃", 86 | "adminReq" : "Bot must be an admin in the channel; otherwise, it can't access the files. 🤖🚫" 87 | }, 88 | "generate" : { 89 | "privLink" : "Good news! Your protected link is ready for sharing.. 🌐🔒\n\nNB: Always remember, only the one who knows the password can access this data 🔑\n\n", 90 | "publLink" : "Good news! Your public link is ready for sharing.🌐🔗\n\nNB: Always remember this is a public link anyone can use this link to fetch data 🚫🔒\n\n", 91 | "button" : { 92 | "📂 VIEW FILE 📂" : "%s", 93 | "📎 SHARE URL 📎" : "https://t.me/share/url?url=%s" 94 | } 95 | }, 96 | "duration" : { 97 | "message" : "Now, select a time duration for the message.\n\nIt will delete the message after the specified time. ⏰🚫", 98 | "button" : { "Dont Erase" : "$delete", "10 sec" : "$10", "30 sec" : "$30", 99 | "1 min" : "$60", "10 min" : "$600", "15 min" : "$900", 100 | "30 min" : "$1800", "1 hr" : "$3600", "3 hr" : "$10800", 101 | "6 hr" : "$21600", "12 hr" : "$43200", "1 day" : "$86400", "🔙 BacK" : "!set" } 102 | } 103 | } -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/i18n/languages/hnd.json: -------------------------------------------------------------------------------- 1 | { 2 | "force" : { 3 | "message" : "🚨 Attention: Increased demand has led to a mandatory subscription for access management..\n\n🔗 Use the below '🪐 JOIN CHANNEL 🪐' button & once you are in use '♻️ REFRESH ♻️'!", 4 | "button" : { 5 | "🪐 JOIN CHANNEL 🪐" : "%s", 6 | "♻️ REFRESH ♻️" : "%s" 7 | }, 8 | "fool": "Click the button above and join the chat to proceed! 😎" 9 | }, 10 | "timeLimit" : { 11 | "message" : "`⚠️ You are sending messages too frequently.`\n`Please wait for %s seconds. ⌛🤐`", 12 | "button" : { 13 | "🔄 Try Again: %s seconds Over! 🔄✨" : "generate" 14 | } 15 | }, 16 | "help" : { 17 | "0" : { 18 | "message" : "👋 Welcome to the FileShare Bot! 📁\n\nWith FileShare Bot, you can easily share and manage files, documents, and more. Whether you want to send a document, a photo, or any other file, our bot has got you covered. You can also add password protection for extra security.\n\nGet started, by simply sending a file you want to share\n\npowered by: @ilovepdf_bot ❤️", 19 | "button" : { 20 | "🌍 LANGUAGE 🌍" : "~lang", 21 | "📚 HELP 📚" : "-help|1", 22 | "🌟 SOURCE CODE 🌟" : "https://github.com/nabilanavab", 23 | "🔊 CHANNEL 🔊" : "https://telegram.dog/ilovepdf_bot", 24 | "🤠 ADMIN 🤠" : "https://github.com/nabilanavab", 25 | "⚙️ SETTINGS ⚙️" : "!set" 26 | } 27 | }, 28 | "1" : { 29 | "message" : "🤖 Discover DataGuard - Your Ultimate Privacy Shield! 🔒\n\nTired of your data going public? Look no further! DataGuard is your solution to safeguarding information. Generate unique links for your text, files, gifs, stickers, and more! Worried about unauthorized access? Add an extra layer with personal passwords – clients will need it to unlock the treasure. This bot is simpler than you think! Just forward anything you want to protect, and witness the magic unfold.\n\nYour privacy, your control. 🔐✨", 30 | "button" : { 31 | "🔙 BacK" : "-help|0", 32 | "NexT ➡️" : "-help|2" 33 | } 34 | }, 35 | "2" : { 36 | "message" : "🤖 Introducing FIleShareBot - Your File Batch Wizard! 📦\n\nEver wished to combine multiple files into one neat package? Now you can with the `/batch` command! Just send it in my private chat, then forward the first file from any channel and the last message of the batch from the same channel. Voila! I'll weave them into a single file, generating a unique link for your convenience. If it's a private channel, ensure I'm an administrator for the magic to unfold.\n\nSimplify your sharing, one batch at a time! 🌐✨", 37 | "button" : { 38 | "🔙 BacK" : "-help|1", 39 | "NexT ➡️" : "-help|0" 40 | } 41 | } 42 | }, 43 | "settings" : { 44 | "message" : "⚙️ SETTINGS: \n\n🔐 SET PASSWORD: Enhance additional security by setting a password for your data. This can be applied to all formats, including text, stickers, and more.\n\n🚫 CAN'T FORWARD: Restrict the forwarding of messages to maintain privacy and control the flow of information in your bot.\n\n📸NO CAPTIONS: Customize media sharing by removing captions from files, providing a cleaner and more streamlined user experience.\n\n👤 WITHOUT QUOTES: Tailor your bot's appearance by removing author information from messages, offering a sleek and minimalist interface.\n\n🚷 ACCESS CLOSED: Customize access to features based on user roles or conditions, allowing you to control and limit certain functionalities.\n\n🗑️ AUTO-ERASE: Enable the auto-erase function to seamlessly remove messages, enhancing data control and privacy within your bot.", 45 | "button" : { 46 | "SET PASSWORD" : ":", 47 | "CANT FORWARD" : "!noforwards", 48 | "NO CAPTIONS" : "!dropMediaCaptions", 49 | "WITHOUT QUOTES" : "!dropAuthor", 50 | "CANT ACCESS" : "!isAccesable", 51 | "AUTO-ERASE" : "$duration", 52 | "🔙 BacK" : "-help|0" 53 | }, 54 | "errorLink" : "⚠️ Showing some error!\n\nPlease check the link again. 🚫🌐", 55 | "noAccess" : "🚫 Temporarily Admin Disabled This File 📂\n\nContact the link creator or try again later. 🔄📞", 56 | "_noAccess": "🚫 Temporarily Admin Disabled This File 📂", 57 | "noAccessBtn" : { "♻️ Try Again ♻️" : "%s" }, 58 | "setPassword" : "🔒 Set Password As:", 59 | "bigPassword" : "⛔ Too Big Password..", 60 | "samePassword" : "🔑 Current Password..", 61 | "passUpdated" : "🔒 Password Updated...\n\nClick the button below to find out! 🤫👇", 62 | "passworDlt" : "🚫 Delete Password..", 63 | "enterPass" : "✍️ Now Enter Password..", 64 | "closeCB" : { "🚶‍♀️ Close 🚶‍♀️" : "close"}, 65 | "passUpdCB" : { "VIEW PASSWORD" : "%s", "🚶‍♀️ Close 🚶‍♀️" : "close" }, 66 | "askPassword" : "This file is secure with a password 🔒.\n\nUse the button below if you have the password to access it. 👇🔑", 67 | "askPswdButon" : { "😎 i know the password 😎" : ":get %s " }, 68 | "messageDeleted" : "Unfortunately, something went wrong. 🤷‍♂️🚫\n\n" 69 | }, 70 | "lang" : { 71 | "select" : "Now, select a language depending on your choice: 🌐🗣️", 72 | "back" : { "🔙 BacK" : "-help|0" }, 73 | "already" : "Already, you are using this Language 🙇🏻" 74 | }, 75 | "batch" : { 76 | "new" : "Use '📢 Batch From Channel 📢' to group a set of messages from a channel. Simply send the first and last message, and it will batch the first 100 messages if the number of messages between the first and last exceeds 100.\n\nOn the other hand, '👤 Batch My Message 👤' lets you batch individual messages you send one by one, with a maximum limit of 10 messages", 77 | "newButton" : { "📢 Batch From Channel 📢" : "@batchChannel", "👤 Batch My Message 👤" : "@batchMessage", "✖️ Close ✖️" : "close"}, 78 | "inProgress" : "A batch job is currently in progress... ⌛🔄", 79 | "sendFisrtMsg" : "Now forward me the first message of the batch file from a public channel\n\nor grant me admin access in the channel and forward. 🔄📤", 80 | "sendLastMsg" : "Now send me the last message to get batched. 📤\n\nNB: Both messages must be from the same channel. 🔄>", 81 | "lastMsgError" : "Send me the last message to be forwarded. 📬\n\nNB:\n- It must be from the same channel.\n- This message must be after the first message. 🔄", 82 | "sendMessage" : "Send me some messages to get batched. 📤\n\n/batch: to batch current data\nCurrent data in Queue 🔄: ", "forwarded" : "📬 Total Messages Frowarded : ", 83 | "forwardIt" : "Ooh, I'm waiting for a forward message from some public channel\n\nor a channel where I am an admin. ⏳📤", 84 | "cancel" : { "🙂 Cancel 🙂" : "@cancelBatch"}, "canceled" : { "🙃 Canceled 🙃" : "waste"}, 85 | "procCancel" : "All queues are cleared,\n\nthe current process is canceled. 🙃", 86 | "adminReq" : "Bot must be an admin in the channel; otherwise, it can't access the files. 🤖🚫" 87 | }, 88 | "generate" : { 89 | "privLink" : "Good news! Your protected link is ready for sharing.. 🌐🔒\n\nNB: Always remember, only the one who knows the password can access this data 🔑\n\n", 90 | "publLink" : "Good news! Your public link is ready for sharing.🌐🔗\n\nNB: Always remember this is a public link anyone can use this link to fetch data 🚫🔒\n\n", 91 | "button" : { 92 | "📂 VIEW FILE 📂" : "%s", 93 | "📎 SHARE URL 📎" : "https://t.me/share/url?url=%s" 94 | } 95 | }, 96 | "duration" : { 97 | "message" : "Now, select a time duration for the message.\n\nIt will delete the message after the specified time. ⏰🚫", 98 | "button" : { "Dont Erase" : "$delete", "10 sec" : "$10", "30 sec" : "$30", 99 | "1 min" : "$60", "10 min" : "$600", "15 min" : "$900", 100 | "30 min" : "$1800", "1 hr" : "$3600", "3 hr" : "$10800", 101 | "6 hr" : "$21600", "12 hr" : "$43200", "1 day" : "$86400", "🔙 BacK" : "!set" } 102 | } 103 | } -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/i18n/languages/ind.json: -------------------------------------------------------------------------------- 1 | { 2 | "force" : { 3 | "message" : "🚨 Attention: Increased demand has led to a mandatory subscription for access management..\n\n🔗 Use the below '🪐 JOIN CHANNEL 🪐' button & once you are in use '♻️ REFRESH ♻️'!", 4 | "button" : { 5 | "🪐 JOIN CHANNEL 🪐" : "%s", 6 | "♻️ REFRESH ♻️" : "%s" 7 | }, 8 | "fool": "Click the button above and join the chat to proceed! 😎" 9 | }, 10 | "timeLimit" : { 11 | "message" : "`⚠️ You are sending messages too frequently.`\n`Please wait for %s seconds. ⌛🤐`", 12 | "button" : { 13 | "🔄 Try Again: %s seconds Over! 🔄✨" : "generate" 14 | } 15 | }, 16 | "help" : { 17 | "0" : { 18 | "message" : "👋 Welcome to the FileShare Bot! 📁\n\nWith FileShare Bot, you can easily share and manage files, documents, and more. Whether you want to send a document, a photo, or any other file, our bot has got you covered. You can also add password protection for extra security.\n\nGet started, by simply sending a file you want to share\n\npowered by: @ilovepdf_bot ❤️", 19 | "button" : { 20 | "🌍 LANGUAGE 🌍" : "~lang", 21 | "📚 HELP 📚" : "-help|1", 22 | "🌟 SOURCE CODE 🌟" : "https://github.com/nabilanavab", 23 | "🔊 CHANNEL 🔊" : "https://telegram.dog/ilovepdf_bot", 24 | "🤠 ADMIN 🤠" : "https://github.com/nabilanavab", 25 | "⚙️ SETTINGS ⚙️" : "!set" 26 | } 27 | }, 28 | "1" : { 29 | "message" : "🤖 Discover DataGuard - Your Ultimate Privacy Shield! 🔒\n\nTired of your data going public? Look no further! DataGuard is your solution to safeguarding information. Generate unique links for your text, files, gifs, stickers, and more! Worried about unauthorized access? Add an extra layer with personal passwords – clients will need it to unlock the treasure. This bot is simpler than you think! Just forward anything you want to protect, and witness the magic unfold.\n\nYour privacy, your control. 🔐✨", 30 | "button" : { 31 | "🔙 BacK" : "-help|0", 32 | "NexT ➡️" : "-help|2" 33 | } 34 | }, 35 | "2" : { 36 | "message" : "🤖 Introducing FIleShareBot - Your File Batch Wizard! 📦\n\nEver wished to combine multiple files into one neat package? Now you can with the `/batch` command! Just send it in my private chat, then forward the first file from any channel and the last message of the batch from the same channel. Voila! I'll weave them into a single file, generating a unique link for your convenience. If it's a private channel, ensure I'm an administrator for the magic to unfold.\n\nSimplify your sharing, one batch at a time! 🌐✨", 37 | "button" : { 38 | "🔙 BacK" : "-help|1", 39 | "NexT ➡️" : "-help|0" 40 | } 41 | } 42 | }, 43 | "settings" : { 44 | "message" : "⚙️ SETTINGS: \n\n🔐 SET PASSWORD: Enhance additional security by setting a password for your data. This can be applied to all formats, including text, stickers, and more.\n\n🚫 CAN'T FORWARD: Restrict the forwarding of messages to maintain privacy and control the flow of information in your bot.\n\n📸NO CAPTIONS: Customize media sharing by removing captions from files, providing a cleaner and more streamlined user experience.\n\n👤 WITHOUT QUOTES: Tailor your bot's appearance by removing author information from messages, offering a sleek and minimalist interface.\n\n🚷 ACCESS CLOSED: Customize access to features based on user roles or conditions, allowing you to control and limit certain functionalities.\n\n🗑️ AUTO-ERASE: Enable the auto-erase function to seamlessly remove messages, enhancing data control and privacy within your bot.", 45 | "button" : { 46 | "SET PASSWORD" : ":", 47 | "CANT FORWARD" : "!noforwards", 48 | "NO CAPTIONS" : "!dropMediaCaptions", 49 | "WITHOUT QUOTES" : "!dropAuthor", 50 | "CANT ACCESS" : "!isAccesable", 51 | "AUTO-ERASE" : "$duration", 52 | "🔙 BacK" : "-help|0" 53 | }, 54 | "errorLink" : "⚠️ Showing some error!\n\nPlease check the link again. 🚫🌐", 55 | "noAccess" : "🚫 Temporarily Admin Disabled This File 📂\n\nContact the link creator or try again later. 🔄📞", 56 | "_noAccess": "🚫 Temporarily Admin Disabled This File 📂", 57 | "noAccessBtn" : { "♻️ Try Again ♻️" : "%s" }, 58 | "setPassword" : "🔒 Set Password As:", 59 | "bigPassword" : "⛔ Too Big Password..", 60 | "samePassword" : "🔑 Current Password..", 61 | "passUpdated" : "🔒 Password Updated...\n\nClick the button below to find out! 🤫👇", 62 | "passworDlt" : "🚫 Delete Password..", 63 | "enterPass" : "✍️ Now Enter Password..", 64 | "closeCB" : { "🚶‍♀️ Close 🚶‍♀️" : "close"}, 65 | "passUpdCB" : { "VIEW PASSWORD" : "%s", "🚶‍♀️ Close 🚶‍♀️" : "close" }, 66 | "askPassword" : "This file is secure with a password 🔒.\n\nUse the button below if you have the password to access it. 👇🔑", 67 | "askPswdButon" : { "😎 i know the password 😎" : ":get %s " }, 68 | "messageDeleted" : "Unfortunately, something went wrong. 🤷‍♂️🚫\n\n" 69 | }, 70 | "lang" : { 71 | "select" : "Now, select a language depending on your choice: 🌐🗣️", 72 | "back" : { "🔙 BacK" : "-help|0" }, 73 | "already" : "Already, you are using this Language 🙇🏻" 74 | }, 75 | "batch" : { 76 | "new" : "Use '📢 Batch From Channel 📢' to group a set of messages from a channel. Simply send the first and last message, and it will batch the first 100 messages if the number of messages between the first and last exceeds 100.\n\nOn the other hand, '👤 Batch My Message 👤' lets you batch individual messages you send one by one, with a maximum limit of 10 messages", 77 | "newButton" : { "📢 Batch From Channel 📢" : "@batchChannel", "👤 Batch My Message 👤" : "@batchMessage", "✖️ Close ✖️" : "close"}, 78 | "inProgress" : "A batch job is currently in progress... ⌛🔄", 79 | "sendFisrtMsg" : "Now forward me the first message of the batch file from a public channel\n\nor grant me admin access in the channel and forward. 🔄📤", 80 | "sendLastMsg" : "Now send me the last message to get batched. 📤\n\nNB: Both messages must be from the same channel. 🔄>", 81 | "lastMsgError" : "Send me the last message to be forwarded. 📬\n\nNB:\n- It must be from the same channel.\n- This message must be after the first message. 🔄", 82 | "sendMessage" : "Send me some messages to get batched. 📤\n\n/batch: to batch current data\nCurrent data in Queue 🔄: ", "forwarded" : "📬 Total Messages Frowarded : ", 83 | "forwardIt" : "Ooh, I'm waiting for a forward message from some public channel\n\nor a channel where I am an admin. ⏳📤", 84 | "cancel" : { "🙂 Cancel 🙂" : "@cancelBatch"}, "canceled" : { "🙃 Canceled 🙃" : "waste"}, 85 | "procCancel" : "All queues are cleared,\n\nthe current process is canceled. 🙃", 86 | "adminReq" : "Bot must be an admin in the channel; otherwise, it can't access the files. 🤖🚫" 87 | }, 88 | "generate" : { 89 | "privLink" : "Good news! Your protected link is ready for sharing.. 🌐🔒\n\nNB: Always remember, only the one who knows the password can access this data 🔑\n\n", 90 | "publLink" : "Good news! Your public link is ready for sharing.🌐🔗\n\nNB: Always remember this is a public link anyone can use this link to fetch data 🚫🔒\n\n", 91 | "button" : { 92 | "📂 VIEW FILE 📂" : "%s", 93 | "📎 SHARE URL 📎" : "https://t.me/share/url?url=%s" 94 | } 95 | }, 96 | "duration" : { 97 | "message" : "Now, select a time duration for the message.\n\nIt will delete the message after the specified time. ⏰🚫", 98 | "button" : { "Dont Erase" : "$delete", "10 sec" : "$10", "30 sec" : "$30", 99 | "1 min" : "$60", "10 min" : "$600", "15 min" : "$900", 100 | "30 min" : "$1800", "1 hr" : "$3600", "3 hr" : "$10800", 101 | "6 hr" : "$21600", "12 hr" : "$43200", "1 day" : "$86400", "🔙 BacK" : "!set" } 102 | } 103 | } -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/i18n/languages/rus.json: -------------------------------------------------------------------------------- 1 | { 2 | "force" : { 3 | "message" : "🚨 Attention: Increased demand has led to a mandatory subscription for access management..\n\n🔗 Use the below '🪐 JOIN CHANNEL 🪐' button & once you are in use '♻️ REFRESH ♻️'!", 4 | "button" : { 5 | "🪐 JOIN CHANNEL 🪐" : "%s", 6 | "♻️ REFRESH ♻️" : "%s" 7 | }, 8 | "fool": "Click the button above and join the chat to proceed! 😎" 9 | }, 10 | "timeLimit" : { 11 | "message" : "`⚠️ You are sending messages too frequently.`\n`Please wait for %s seconds. ⌛🤐`", 12 | "button" : { 13 | "🔄 Try Again: %s seconds Over! 🔄✨" : "generate" 14 | } 15 | }, 16 | "help" : { 17 | "0" : { 18 | "message" : "👋 Welcome to the FileShare Bot! 📁\n\nWith FileShare Bot, you can easily share and manage files, documents, and more. Whether you want to send a document, a photo, or any other file, our bot has got you covered. You can also add password protection for extra security.\n\nGet started, by simply sending a file you want to share\n\npowered by: @ilovepdf_bot ❤️", 19 | "button" : { 20 | "🌍 LANGUAGE 🌍" : "~lang", 21 | "📚 HELP 📚" : "-help|1", 22 | "🌟 SOURCE CODE 🌟" : "https://github.com/nabilanavab", 23 | "🔊 CHANNEL 🔊" : "https://telegram.dog/ilovepdf_bot", 24 | "🤠 ADMIN 🤠" : "https://github.com/nabilanavab", 25 | "⚙️ SETTINGS ⚙️" : "!set" 26 | } 27 | }, 28 | "1" : { 29 | "message" : "🤖 Discover DataGuard - Your Ultimate Privacy Shield! 🔒\n\nTired of your data going public? Look no further! DataGuard is your solution to safeguarding information. Generate unique links for your text, files, gifs, stickers, and more! Worried about unauthorized access? Add an extra layer with personal passwords – clients will need it to unlock the treasure. This bot is simpler than you think! Just forward anything you want to protect, and witness the magic unfold.\n\nYour privacy, your control. 🔐✨", 30 | "button" : { 31 | "🔙 BacK" : "-help|0", 32 | "NexT ➡️" : "-help|2" 33 | } 34 | }, 35 | "2" : { 36 | "message" : "🤖 Introducing FIleShareBot - Your File Batch Wizard! 📦\n\nEver wished to combine multiple files into one neat package? Now you can with the `/batch` command! Just send it in my private chat, then forward the first file from any channel and the last message of the batch from the same channel. Voila! I'll weave them into a single file, generating a unique link for your convenience. If it's a private channel, ensure I'm an administrator for the magic to unfold.\n\nSimplify your sharing, one batch at a time! 🌐✨", 37 | "button" : { 38 | "🔙 BacK" : "-help|1", 39 | "NexT ➡️" : "-help|0" 40 | } 41 | } 42 | }, 43 | "settings" : { 44 | "message" : "⚙️ SETTINGS: \n\n🔐 SET PASSWORD: Enhance additional security by setting a password for your data. This can be applied to all formats, including text, stickers, and more.\n\n🚫 CAN'T FORWARD: Restrict the forwarding of messages to maintain privacy and control the flow of information in your bot.\n\n📸NO CAPTIONS: Customize media sharing by removing captions from files, providing a cleaner and more streamlined user experience.\n\n👤 WITHOUT QUOTES: Tailor your bot's appearance by removing author information from messages, offering a sleek and minimalist interface.\n\n🚷 ACCESS CLOSED: Customize access to features based on user roles or conditions, allowing you to control and limit certain functionalities.\n\n🗑️ AUTO-ERASE: Enable the auto-erase function to seamlessly remove messages, enhancing data control and privacy within your bot.", 45 | "button" : { 46 | "SET PASSWORD" : ":", 47 | "CANT FORWARD" : "!noforwards", 48 | "NO CAPTIONS" : "!dropMediaCaptions", 49 | "WITHOUT QUOTES" : "!dropAuthor", 50 | "CANT ACCESS" : "!isAccesable", 51 | "AUTO-ERASE" : "$duration", 52 | "🔙 BacK" : "-help|0" 53 | }, 54 | "errorLink" : "⚠️ Showing some error!\n\nPlease check the link again. 🚫🌐", 55 | "noAccess" : "🚫 Temporarily Admin Disabled This File 📂\n\nContact the link creator or try again later. 🔄📞", 56 | "_noAccess": "🚫 Temporarily Admin Disabled This File 📂", 57 | "noAccessBtn" : { "♻️ Try Again ♻️" : "%s" }, 58 | "setPassword" : "🔒 Set Password As:", 59 | "bigPassword" : "⛔ Too Big Password..", 60 | "samePassword" : "🔑 Current Password..", 61 | "passUpdated" : "🔒 Password Updated...\n\nClick the button below to find out! 🤫👇", 62 | "passworDlt" : "🚫 Delete Password..", 63 | "enterPass" : "✍️ Now Enter Password..", 64 | "closeCB" : { "🚶‍♀️ Close 🚶‍♀️" : "close"}, 65 | "passUpdCB" : { "VIEW PASSWORD" : "%s", "🚶‍♀️ Close 🚶‍♀️" : "close" }, 66 | "askPassword" : "This file is secure with a password 🔒.\n\nUse the button below if you have the password to access it. 👇🔑", 67 | "askPswdButon" : { "😎 i know the password 😎" : ":get %s " }, 68 | "messageDeleted" : "Unfortunately, something went wrong. 🤷‍♂️🚫\n\n" 69 | }, 70 | "lang" : { 71 | "select" : "Now, select a language depending on your choice: 🌐🗣️", 72 | "back" : { "🔙 BacK" : "-help|0" }, 73 | "already" : "Already, you are using this Language 🙇🏻" 74 | }, 75 | "batch" : { 76 | "new" : "Use '📢 Batch From Channel 📢' to group a set of messages from a channel. Simply send the first and last message, and it will batch the first 100 messages if the number of messages between the first and last exceeds 100.\n\nOn the other hand, '👤 Batch My Message 👤' lets you batch individual messages you send one by one, with a maximum limit of 10 messages", 77 | "newButton" : { "📢 Batch From Channel 📢" : "@batchChannel", "👤 Batch My Message 👤" : "@batchMessage", "✖️ Close ✖️" : "close"}, 78 | "inProgress" : "A batch job is currently in progress... ⌛🔄", 79 | "sendFisrtMsg" : "Now forward me the first message of the batch file from a public channel\n\nor grant me admin access in the channel and forward. 🔄📤", 80 | "sendLastMsg" : "Now send me the last message to get batched. 📤\n\nNB: Both messages must be from the same channel. 🔄>", 81 | "lastMsgError" : "Send me the last message to be forwarded. 📬\n\nNB:\n- It must be from the same channel.\n- This message must be after the first message. 🔄", 82 | "sendMessage" : "Send me some messages to get batched. 📤\n\n/batch: to batch current data\nCurrent data in Queue 🔄: ", "forwarded" : "📬 Total Messages Frowarded : ", 83 | "forwardIt" : "Ooh, I'm waiting for a forward message from some public channel\n\nor a channel where I am an admin. ⏳📤", 84 | "cancel" : { "🙂 Cancel 🙂" : "@cancelBatch"}, "canceled" : { "🙃 Canceled 🙃" : "waste"}, 85 | "procCancel" : "All queues are cleared,\n\nthe current process is canceled. 🙃", 86 | "adminReq" : "Bot must be an admin in the channel; otherwise, it can't access the files. 🤖🚫" 87 | }, 88 | "generate" : { 89 | "privLink" : "Good news! Your protected link is ready for sharing.. 🌐🔒\n\nNB: Always remember, only the one who knows the password can access this data 🔑\n\n", 90 | "publLink" : "Good news! Your public link is ready for sharing.🌐🔗\n\nNB: Always remember this is a public link anyone can use this link to fetch data 🚫🔒\n\n", 91 | "button" : { 92 | "📂 VIEW FILE 📂" : "%s", 93 | "📎 SHARE URL 📎" : "https://t.me/share/url?url=%s" 94 | } 95 | }, 96 | "duration" : { 97 | "message" : "Now, select a time duration for the message.\n\nIt will delete the message after the specified time. ⏰🚫", 98 | "button" : { "Dont Erase" : "$delete", "10 sec" : "$10", "30 sec" : "$30", 99 | "1 min" : "$60", "10 min" : "$600", "15 min" : "$900", 100 | "30 min" : "$1800", "1 hr" : "$3600", "3 hr" : "$10800", 101 | "6 hr" : "$21600", "12 hr" : "$43200", "1 day" : "$86400", "🔙 BacK" : "!set" } 102 | } 103 | } -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/i18n/t9n.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | const fs = require('fs'); 20 | const path = require('path'); 21 | const logger = require("../../logger"); 22 | const button_trans = require("./ba10"); 23 | const { createButton } = require("../i18n/ba10") 24 | 25 | const langFolder = path.join(__dirname, 'languages'); 26 | const localeData = {}; 27 | 28 | try { 29 | // Read all files in the directory 30 | const files = fs.readdirSync(langFolder); 31 | 32 | // Filter files to include only JSON files 33 | const jsonFiles = files.filter( 34 | file => path.extname(file).toLowerCase() === '.json' 35 | ); 36 | 37 | jsonFiles.forEach(file => { 38 | const languageCode = path.basename(file, '.json'); 39 | const filePath = path.join(langFolder, file); 40 | 41 | try { 42 | localeData[languageCode] = require(filePath); 43 | // const data = fs.readFileSync(filePath, 'utf8'); 44 | // const jsonData = JSON.parse(data); 45 | // localeData[languageCode] = jsonData; 46 | } catch (parseError) { 47 | logger.log( 48 | 'error', `Error parsing JSON from ${file}: ${parseError.message}` 49 | ) 50 | } 51 | }); 52 | 53 | } catch (readDirError) { 54 | logger.error("error", `Error reading folder: ${readDirError.message}`); 55 | process.exit(1); 56 | } 57 | 58 | /** 59 | * This function Helps to prevent flood wait errors for all the messages. 60 | * 61 | * @param {number} chatId - users chat_id 62 | * @param {string} message - message to user 63 | * @param {boolean} asString - return as string else button will be buttons 64 | * @param {number} order - max no.of columns in butoon 65 | * @param {number} langCode 66 | * 67 | * @returns {Array} - return translated text, or button 68 | * 69 | * @throws {Error} 70 | * 71 | * @example 72 | * translate(chatID, message, button) 73 | */ 74 | 75 | translate = async function({ 76 | text=null, button=null, langCode=null, 77 | asString=false, order=button_trans.maxClmnForButton 78 | }) { 79 | let rtnText, rtnButton = null; 80 | langMsg = localeData[langCode] ?? localeData["eng"] ; 81 | 82 | if (text) { 83 | try { 84 | let keys = text.split('.'); 85 | rtnText = langMsg; 86 | keys.forEach(key => { 87 | if (rtnText && rtnText[key]) { 88 | rtnText = rtnText[key]; 89 | } else { 90 | rtnText = undefined; 91 | } 92 | }) 93 | } catch (error) { 94 | logger.log("error", `❌❌ can't find ${text} : ${error}`); 95 | rtnText = localeData["eng"]; 96 | keys.forEach(key => { 97 | if (rtnText && rtnText[key]) { 98 | rtnText = rtnText[key]; 99 | } else { 100 | rtnText = undefined; 101 | } 102 | }) 103 | } 104 | } 105 | if (button){ 106 | try { 107 | let keys = button.split('.'); 108 | rtnButton = langMsg; 109 | keys.forEach(key => { 110 | if (rtnButton && rtnButton[key]) { 111 | rtnButton = rtnButton[key]; 112 | } else { 113 | rtnButton = undefined; 114 | } 115 | }) 116 | } catch (error) { 117 | logger.log("error", `❌❌ can't find ${button} : ${error}`); 118 | rtnButton = localeData["eng"]; 119 | keys.forEach(key => { 120 | if (rtnButton && rtnButton[key]) { rtnButton = rtnButton[key]; 121 | } else { rtnButton = undefined; } 122 | }) 123 | } 124 | } 125 | if (asString) { 126 | return { 127 | text: rtnText, button: rtnButton 128 | }; 129 | } 130 | 131 | try { 132 | rtnButton = button ? await createButton( 133 | { button: rtnButton, order: order } 134 | ) : rtnButton; 135 | } catch (error) { 136 | logger.log("error", `🚫 ${__dirname}: ${error}`); 137 | } 138 | 139 | return { 140 | text: rtnText, button: rtnButton 141 | }; 142 | } 143 | 144 | module.exports = translate; 145 | 146 | /** 147 | * 148 | * @license 149 | * FileShareBot is open-source software distributed under the MIT License. 150 | * Please see the LICENSE: file for more details. 151 | * 152 | * @repository 153 | * You can find the source code of this bot and contribute on GitHub: 154 | * https://github.com/nabilanavab/filesharebot 155 | * 156 | * @author 157 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 158 | * bug reports, or collaboration. 159 | * 160 | * Contact: https://telegram.me/nabilanavab 161 | * 162 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/i18n/utils.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | const config = require("../../config") 20 | const fs = require('fs'); 21 | const path = require('path'); 22 | const logger = require("../../logger"); 23 | const { userLang, enabledLang } = require("./data"); 24 | 25 | let supportedLang = [] 26 | const langFolder = path.join(__dirname, 'languages'); 27 | 28 | fs.readdir(langFolder, (err, files) => { 29 | // supportedLang: save all langs name in languages folder 30 | // eg: supportedLang = ["eng", "mal", "hnd","arb"] 31 | 32 | if (err) { 33 | logger.log('error', `Error reading folder: ${err}`); 34 | process.exit(1); 35 | } 36 | 37 | if (!config.LANG_INFO.MULTIPLE_LANG){ 38 | supportedLang.push(config.LANG_INFO.DEFAULT_LANG); 39 | return supportedLang; 40 | } else { 41 | supportedLang = files.map((fileName) => { 42 | // Get the language code from the file name 43 | const langCode = fileName.slice(0, -5); // Remove the last 5 characters (".json") 44 | // Filter only supported languages 45 | return enabledLang[langCode] !== undefined ? langCode : null; 46 | }).filter( 47 | (langCode) => langCode !== null 48 | ); 49 | } 50 | }); 51 | 52 | 53 | getLang = async function(userID){ 54 | 55 | // try to get lang code from data.useLang (default : default_lang_code) 56 | var user_lang = userLang[userID] === undefined ? 57 | config.LANG_INFO.DEFAULT_LANG : userLang[userID]; 58 | 59 | if (enabledLang.hasOwnProperty(user_lang)){ 60 | return user_lang; 61 | } else { 62 | return config.LANG_INFO.DEFAULT_LANG; 63 | } 64 | } 65 | 66 | module.exports = getLang; 67 | 68 | /** 69 | * 70 | * @license 71 | * FileShareBot is open-source software distributed under the MIT License. 72 | * Please see the LICENSE: file for more details. 73 | * 74 | * @repository 75 | * You can find the source code of this bot and contribute on GitHub: 76 | * https://github.com/nabilanavab/filesharebot 77 | * 78 | * @author 79 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 80 | * bug reports, or collaboration. 81 | * 82 | * Contact: https://telegram.me/nabilanavab 83 | * 84 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/loader.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | const fs = require('fs'); 20 | const path = require('path'); 21 | 22 | 23 | const walkSync = (dir, filelist = [], exclude = []) => { 24 | const files = fs.readdirSync(dir); 25 | 26 | files.forEach((file) => { 27 | const filePath = path.join(dir, file); 28 | const isDirectory = fs.statSync(filePath).isDirectory(); 29 | 30 | if (exclude.includes(file)) { 31 | // Exclude specified files or folders 32 | return; 33 | } 34 | 35 | isDirectory 36 | ? walkSync(filePath, filelist, exclude) 37 | : filelist.push(filePath); 38 | }); 39 | 40 | return filelist; 41 | }; 42 | 43 | 44 | const excludeList = [ 45 | 'localDB', 'excludeFile.js', 'cryptoG', 'callBack', 46 | 'helpers', 'util', "__init__.js", "scheduler", 'token' 47 | ]; 48 | const moduleLoader = async (client) => { 49 | const root = path.join(__dirname, 'plugins'); 50 | const filesToLoad = walkSync(root, [], excludeList); 51 | 52 | for (const modulePath of filesToLoad) { 53 | try { 54 | let loadedModule = require(modulePath); 55 | await loadedModule(client); 56 | } catch (error) { 57 | console.error(`-> Some Error when importing from ${modulePath}`); 58 | console.error("-> An error occurred:", error.message); 59 | console.error("-> Stack trace:", error.stack); 60 | 61 | const indexToRemove = filesToLoad.indexOf(modulePath); 62 | 63 | if (indexToRemove !== -1) { 64 | filesToLoad.splice(indexToRemove, 1); 65 | } 66 | } 67 | } 68 | 69 | const loadedFileNames = filesToLoad.map((file) => path.basename(file)); 70 | console.log("loaded: " + loadedFileNames.join(', ')); 71 | // Print completely loaded files [below code will print complete path] 72 | // console.log("loaded: " + filesToLoad.map((file) => file.split('/').pop()).join(', ')); 73 | }; 74 | 75 | 76 | module.exports = moduleLoader; 77 | 78 | /** 79 | * 80 | * @license 81 | * FileShareBot is open-source software distributed under the MIT License. 82 | * Please see the LICENSE: file for more details. 83 | * 84 | * @repository 85 | * You can find the source code of this bot and contribute on GitHub: 86 | * https://github.com/nabilanavab/filesharebot 87 | * 88 | * @author 89 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 90 | * bug reports, or collaboration. 91 | * 92 | * Contact: https://telegram.me/nabilanavab 93 | * 94 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/monGo/core.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | // This file contains basic or mandatory functions 20 | const { LANG_INFO } = require("../../config") 21 | const database = require("./database") 22 | const moment = require('moment'); 23 | 24 | class coreDb { 25 | async isUserExist({ userID, elseAdd = false }) { 26 | let user = await database.client.db(database.databaseName).collection( 27 | database.userCollection).findOne({ userID: parseInt(userID) }); 28 | 29 | if (!elseAdd) { 30 | return user; 31 | // use return !!user to send bool 32 | } else if (!user) { 33 | let document = { 34 | userID: userID, 35 | join_date: moment(new Date()).format('DD:MMM:YYYY') 36 | }; 37 | 38 | if (elseAdd.lang && elseAdd.lang !== LANG_INFO.DEFAULT_LANG) { 39 | document.lang = elseAdd.lang; 40 | } 41 | if (elseAdd.requested) { 42 | document.requested = elseAdd.requested; 43 | } 44 | 45 | let newUser = await database.client.db(database.databaseName).collection( 46 | database.userCollection).insertOne(document); 47 | 48 | return "newUser"; 49 | } 50 | } 51 | } 52 | 53 | const coreDbFunctions = new coreDb(); 54 | module.exports = { coreDbFunctions }; 55 | 56 | /** 57 | * 58 | * @license 59 | * FileShareBot is open-source software distributed under the MIT License. 60 | * Please see the LICENSE: file for more details. 61 | * 62 | * @repository 63 | * You can find the source code of this bot and contribute on GitHub: 64 | * https://github.com/nabilanavab/filesharebot 65 | * 66 | * @author 67 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 68 | * bug reports, or collaboration. 69 | * 70 | * Contact: https://telegram.me/nabilanavab 71 | * 72 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/monGo/database.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | const { MongoClient, ServerApiVersion } = require('mongodb'); 20 | const { DATABASE } = require("../../config"); 21 | const logger = require('../../logger'); 22 | const { userLang } = require("../i18n/data"); 23 | const { generateInfo } = require("../plugins/localDB/generData"); 24 | const REQUESTED_USERS = require("../plugins/localDB/request"); 25 | 26 | // uri : "mongodb+srv://:@?retryWrites=true&w=majority"; 27 | 28 | class Database { 29 | constructor(uri, databaseName) { 30 | this.client = new MongoClient( 31 | uri, { 32 | serverApi: { 33 | version: ServerApiVersion.v1, 34 | strict: true, 35 | deprecationErrors: true, 36 | }, 37 | } 38 | ); 39 | this.databaseName = databaseName; 40 | this.userCollection = 'users'; 41 | this.chatCollection = 'chat'; 42 | this.scheduler = 'scheduler'; 43 | } 44 | 45 | async connect() { 46 | try { 47 | await this.client.connect(); 48 | 49 | let result = await this.client.db(this.databaseName) 50 | .collection(this.userCollection) 51 | .find({ userID: { $exists: true } }) 52 | .toArray(); 53 | 54 | result.forEach(user => { 55 | let userId = user.userID; 56 | 57 | if (!generateInfo[userId]){ 58 | generateInfo[userId] = {}; 59 | } 60 | 61 | Object.keys(user).forEach(key => { 62 | if ( key !== 'join_date' && key !== '_id' && key !== 'userID' ) { 63 | if (key === 'requested'){ 64 | REQUESTED_USERS.push(BigInt(userId)); 65 | } else if (key === 'lang'){ 66 | userLang[userId] = user[key]; 67 | } else { 68 | generateInfo[userId][key] = user[key]; 69 | } 70 | } 71 | }); 72 | }); 73 | 74 | logger.log('info', 'Database connected perfectly..') 75 | 76 | } catch (error) { 77 | logger.log('error', `Error during Database Connection: ${error}`); 78 | 79 | // You might want to throw the error to handle it elsewhere. 80 | throw error; 81 | } 82 | } 83 | } 84 | 85 | 86 | if (DATABASE.MONGODB_URI) { 87 | const database = new Database(DATABASE.MONGODB_URI, OWNER); 88 | (async () => { 89 | try { 90 | await database.connect(); 91 | } catch (error) { 92 | DATABASE.MONGODB_URI = null; 93 | } 94 | })(); 95 | 96 | module.exports = database; 97 | } 98 | 99 | /** 100 | * 101 | * @license 102 | * FileShareBot is open-source software distributed under the MIT License. 103 | * Please see the LICENSE: file for more details. 104 | * 105 | * @repository 106 | * You can find the source code of this bot and contribute on GitHub: 107 | * https://github.com/nabilanavab/filesharebot 108 | * 109 | * @author 110 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 111 | * bug reports, or collaboration. 112 | * 113 | * Contact: https://telegram.me/nabilanavab 114 | * 115 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/monGo/extras.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | // features that are not crucial for the core functionality 20 | const { LANG_INFO } = require("../../config"); 21 | const database = require("./database"); 22 | const { userLang, enabledLang } = require("../i18n/data"); 23 | const { generateInfo } = require("../plugins/localDB/generData"); 24 | 25 | 26 | class extrasDb { 27 | async changeLang({ userID, lang = LANG_INFO.DEFAULT_LANG }) { 28 | userID = Number(userID); 29 | 30 | if (!enabledLang.hasOwnProperty(lang)) 31 | return true; 32 | 33 | let updateData 34 | if (lang === LANG_INFO.DEFAULT_LANG && !userLang[userID]) { 35 | updateData = true; 36 | } else if (lang === LANG_INFO.DEFAULT_LANG && userLang[userID]) { 37 | delete userLang[userID]; 38 | updateData = await database.client.db(database.databaseName).collection( 39 | database.userCollection).updateOne( 40 | { userID: Number(userID) }, { $unset : { ['lang'] : 1 } } 41 | ); 42 | } else if (userLang[userID] === lang) { 43 | return true; 44 | } else if (lang !== LANG_INFO.DEFAULT_LANG && !userLang[userID]) { 45 | userLang[userID] = lang; 46 | updateData = await database.client.db(database.databaseName).collection( 47 | database.userCollection).updateOne( 48 | { userID: Number(userID) }, { $set : { ['lang'] : lang } } 49 | ); 50 | } 51 | return updateData; 52 | } 53 | 54 | async changeData({ userID, key, value=false, deleteIt=false }) { 55 | // [impo] please dont use deleteIt it delete user completely 56 | let updateData; 57 | 58 | // Not all attributes will be added to all users 59 | // False values will not be added to prevent unwanted wastage of memory 60 | if ( deleteIt || !value ){ 61 | if (deleteIt) delete generateInfo[userID]; 62 | else delete generateInfo[userID][key]; 63 | updateData = await database.client.db(database.databaseName).collection( 64 | database.userCollection).updateOne( 65 | { userID: Number(userID) }, { $unset : { [key] : 1 } } 66 | ); 67 | } else { 68 | generateInfo[userID][key] = value; 69 | updateData = await database.client.db(database.databaseName).collection( 70 | database.userCollection).updateOne( 71 | { userID: Number(userID) }, { $set : { [key] : value } } 72 | ); 73 | } 74 | } 75 | } 76 | 77 | const extrasDbFunctions = new extrasDb(); 78 | module.exports = { extrasDbFunctions }; 79 | 80 | /** 81 | * 82 | * @license 83 | * FileShareBot is open-source software distributed under the MIT License. 84 | * Please see the LICENSE: file for more details. 85 | * 86 | * @repository 87 | * You can find the source code of this bot and contribute on GitHub: 88 | * https://github.com/nabilanavab/filesharebot 89 | * 90 | * @author 91 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 92 | * bug reports, or collaboration. 93 | * 94 | * Contact: https://telegram.me/nabilanavab 95 | * 96 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/monGo/shdulFrmDb.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | const database = require("./database"); 20 | const scheduleAt = require("../plugins/scheduler/scheduleAt"); 21 | 22 | async function scheduleDB( client ) { 23 | try { 24 | let result = await database.client 25 | .db(database.databaseName) 26 | .collection(database.scheduler) 27 | .find({ targetTime: { $exists: true } }) 28 | .toArray(); 29 | 30 | for ( const time of result ){ 31 | await scheduleAt({ 32 | targetTime: time.targetTime, // time at which its get deleted 33 | client: client, // bot instance 34 | messageID: time.messageID, // id of message to be deleted 35 | chatID: time.chatID, // chat id where the message exists 36 | }) 37 | } 38 | } catch ( error ) { 39 | console.log(error) 40 | } 41 | } 42 | 43 | module.exports = scheduleDB; 44 | 45 | 46 | /** 47 | * 48 | * @license 49 | * FileShareBot is open-source software distributed under the MIT License. 50 | * Please see the LICENSE: file for more details. 51 | * 52 | * @repository 53 | * You can find the source code of this bot and contribute on GitHub: 54 | * https://github.com/nabilanavab/filesharebot 55 | * 56 | * @author 57 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 58 | * bug reports, or collaboration. 59 | * 60 | * Contact: https://telegram.me/nabilanavab 61 | * 62 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/__init__.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | /** 4 | * 5 | * @description 6 | * Directory Purpose: 7 | * 8 | * This script/files in this folder, each representing a module for 9 | * handling updates from the Telegram bot, such as new messages or callback queries. 10 | * 11 | * Each module is expect a function that takes a 'client' object as its 12 | * argument. The 'client' represents the Telegram bot, and each module may perform 13 | * specific actions in response to incoming updates and Function returns `0` to indicate 14 | * a successful execution or expected completion of the task. 15 | * 16 | * Note: It's important to handle error cases appropriately and return values other than 0 17 | * to indicate specific failure conditions. This helps the calling code to differentiate 18 | * between successful and unsuccessful outcomes, allowing for effective error handling. 19 | * 20 | * The purpose of this script is to dynamically handle a variety of messages 21 | * and queries without requiring manual registration of each module. 22 | * 23 | */ 24 | -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/batch.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | // Import necessary modules 20 | let logger = require("../../logger"); 21 | const getLang = require("../../bot/i18n/utils"); 22 | const translate = require("../../bot/i18n/t9n"); 23 | const errors = require("telegram/errors"); 24 | const { isBatchUser } = require("./localDB/batchData"); 25 | const { forceSub } = require("./helpers/forceSub"); 26 | const REQUESTED_USERS = require("./localDB/request"); 27 | const { limitHandler } = require("./helpers/limitHandler"); 28 | const { BOT_ADMIN } = require("../../config"); 29 | 30 | 31 | /** 32 | * Adds an event handler to process batch-related messages (in a private chat). 33 | * 34 | * @param {TelegramBot} client - The Telegram bot instance. 35 | * @returns {Promise} - A Promise that resolves to 0 after processing the batch-related message. 36 | * @throws {Error} - Throws an error if an exception occurs during the message processing, including FloodWaitError. 37 | */ 38 | 39 | module.exports = async function (client) { 40 | client.addEventHandler(async (update) => { 41 | if ( 42 | update?.message?.peerId?.className === 'PeerUser' && 43 | !update?.message?.out && 44 | update?.message?.message?.toLowerCase()?.startsWith("/batch") 45 | ) { 46 | try { 47 | // Retrieve the user's language from the local database 48 | let lang_code = await getLang(update.message.chatId); 49 | 50 | if ( 51 | BOT_ADMIN.ADMIN_ONLY && 52 | !BOT_ADMIN.adminUserIds.includes(Number(update.message.chatId)) 53 | ){ 54 | let translated = await translate({ 55 | text: "onlyAdmin.message", 56 | button: "onlyAdmin.button", 57 | langCode: lang_code 58 | }); 59 | await client.sendMessage( 60 | update.message.chatId, { 61 | message : translated.text, 62 | replyTo : update.message.id, 63 | buttons: client.buildReplyMarkup( 64 | translated.button 65 | ), 66 | parseMode: "html" 67 | } 68 | ); 69 | return 70 | } 71 | 72 | if (isBatchUser(update.message.chatId)){ 73 | // if userin isBatchUser means send request or joined chat 74 | } else if ( REQUESTED_USERS.includes(update.message.chatId.value) ){ 75 | await limitHandler({ 76 | client: client, 77 | userId: update.message.chatId.value, 78 | replyTo:update.message.replyTo 79 | }) 80 | } else { 81 | // Check for force subscription & time limit 82 | await forceSub({ 83 | client: client, 84 | update: update 85 | }) 86 | } 87 | 88 | let translated = await translate({ 89 | text: "batch.new", 90 | button: "batch.newButton", 91 | langCode: lang_code, 92 | order: 21 93 | }); 94 | await client.sendMessage( 95 | update.message.chatId, { 96 | message: translated.text, 97 | buttons: translated.button, 98 | parseMode: "html" 99 | } 100 | ); 101 | await client.deleteMessages( 102 | update.message.chatId, 103 | [update.message.id], 104 | {} 105 | ) 106 | 107 | return 0; 108 | } catch (error) { 109 | // Handle errors, including flood errors 110 | if (error instanceof errors.FloodWaitError) { 111 | logger.log('error', `${file_name}: ${update.message.chatId} : ${error}`); 112 | setTimeout( 113 | module.exports(client), 114 | error.seconds 115 | ) 116 | } else { 117 | logger.log('error', `${file_name}\batch.js ${update.message.chatId} : ${error}`); 118 | } 119 | } 120 | } 121 | }); 122 | } 123 | 124 | /** 125 | * 126 | * @license 127 | * FileShareBot is open-source software distributed under the MIT License. 128 | * Please see the LICENSE: file for more details. 129 | * 130 | * @repository 131 | * You can find the source code of this bot and contribute on GitHub: 132 | * https://github.com/nabilanavab/filesharebot 133 | * 134 | * @author 135 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 136 | * bug reports, or collaboration. 137 | * 138 | * Contact: https://telegram.me/nabilanavab 139 | * 140 | */ 141 | -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/callBack/__init__.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | /** 4 | * 5 | * @description 6 | * Directory Purpose: 7 | * Scripts in this folder handle callbacks separately, and they are invoked from 8 | * the 'plugins/callback' folder. 9 | * 10 | */ 11 | -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/callBack/askCapBut.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | const logger = require("../../../logger"); 20 | 21 | /** 22 | * Handles callback queries related to the help command. 23 | * @param {object} options - Options object. 24 | * @param {object} options.client - The Telegram Bot API client. 25 | * @param {object} options.update - The Telegram update object. 26 | * @returns {Promise<*>} - A Promise that resolves with the edited message or 27 | * false if there's an error. 28 | */ 29 | 30 | async function captButton({ client, update }) { 31 | try { 32 | // Decode callback data from base64 33 | let cbData = Buffer.from(update.data, 'base64').toString('utf8'); 34 | 35 | // Extract the new page from callback data 36 | let cbMessage = cbData.replace("+", "") 37 | 38 | // Get the user's language code 39 | let langCode = await getLang(update.userId); 40 | 41 | // Translate message and buttons based on the new page 42 | let translated = await translate({ 43 | text: `capButton.${cbMessage}`, 44 | button: `settings.closeCB`, 45 | langCode: langCode 46 | }); 47 | 48 | await client.sendMessage( 49 | update.userId, { 50 | message: translated.text, 51 | buttons: client.buildReplyMarkup( 52 | translated.button 53 | ), 54 | parseMode: "html" 55 | } 56 | ); 57 | 58 | } catch (error) { 59 | logger.log(`${file_name}: ${update.userId} : ${error}`); 60 | return false; 61 | } 62 | } 63 | 64 | module.exports = captButton; 65 | 66 | /** 67 | * 68 | * @license 69 | * FileShareBot is open-source software distributed under the MIT License. 70 | * Please see the LICENSE: file for more details. 71 | * 72 | * @repository 73 | * You can find the source code of this bot and contribute on GitHub: 74 | * https://github.com/nabilanavab/filesharebot 75 | * 76 | * @author 77 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 78 | * bug reports, or collaboration. 79 | * 80 | * Contact: https://telegram.me/nabilanavab 81 | * 82 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/callBack/batchCB.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | const { batchDB, isBatchUser, deleteBatchUser } = require("../localDB/batchData"); 20 | const logger = require("../../../logger"); 21 | const { Api } = require("telegram"); 22 | 23 | /** 24 | * Handles callback queries related to batch functions 25 | * @param {object} options - Options object. 26 | * @param {object} options.client - The Telegram Bot API client. 27 | * @param {object} options.update - The Telegram update object. 28 | * @returns {Promise<*>} - A Promise that resolves with the edited message or 29 | * false if there's an error. 30 | */ 31 | 32 | async function batchManager({ client, update }) { 33 | try { 34 | // Decode callback data from base64 35 | let cbData = Buffer.from(update.data).toString('utf8'); 36 | // Get the user's language code 37 | let langCode = await getLang(update.userId); 38 | 39 | if ( cbData === "@cancelBatch" ){ 40 | deleteBatchUser('id', update.userId.value); 41 | 42 | const translated = await translate({ 43 | text: "batch.procCancel", 44 | button: "batch.canceled", 45 | langCode: langCode 46 | }) 47 | return await client.editMessage( 48 | update.userId, { 49 | message: update.msgId, 50 | text: translated.text, 51 | buttons: client.buildReplyMarkup(translated.button), 52 | parseMode: "html", 53 | } 54 | ); 55 | } 56 | 57 | if (isBatchUser(update.userId.value)){ 58 | const translated = await translate({ 59 | text: "batch.inProgress", 60 | langCode: langCode 61 | }) 62 | 63 | return await client.invoke( 64 | new Api.messages.SetBotCallbackAnswer({ 65 | alert: true, 66 | queryId: BigInt(update.queryId.value), 67 | message: translated.text, 68 | // url: 'random string here', 69 | }) 70 | ); 71 | } else { 72 | const translated = await translate({ 73 | text : cbData === "@batchChannel" ? 74 | "batch.sendFisrtMsg" : "batch.sendMessage", 75 | button: "batch.cancel", 76 | langCode: langCode 77 | }) 78 | 79 | batchDB.push({ 80 | "id" : update.userId.value, 81 | "userData" : [], 82 | "type" : cbData === "@batchChannel" ? "@batchChannel" : "@batchMessage", 83 | "forwardFrom" : cbData === "@batchChannel" ? null : "id" 84 | }); 85 | 86 | await client.sendMessage( 87 | update.userId, { 88 | message: translated.text, 89 | buttons: translated.button 90 | } 91 | ) 92 | return await client.invoke( 93 | new Api.messages.SetBotCallbackAnswer({ 94 | alert: true, 95 | queryId: BigInt(update.queryId.value), 96 | message: "", 97 | // url: 'random string here', 98 | }) 99 | ); 100 | } 101 | } catch (error) { 102 | logger.log('error', `${file_name}\batchCB: ${update.userId} : ${error}`); 103 | return false 104 | } 105 | } 106 | 107 | 108 | module.exports = batchManager; 109 | 110 | /** 111 | * 112 | * @license 113 | * FileShareBot is open-source software distributed under the MIT License. 114 | * Please see the LICENSE: file for more details. 115 | * 116 | * @repository 117 | * You can find the source code of this bot and contribute on GitHub: 118 | * https://github.com/nabilanavab/filesharebot 119 | * 120 | * @author 121 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 122 | * bug reports, or collaboration. 123 | * 124 | * Contact: https://telegram.me/nabilanavab 125 | * 126 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/callBack/close.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | const logger = require("../../../logger"); 20 | const { Api } = require('telegram'); 21 | 22 | /** 23 | * Handles callback queries related to closing a message. 24 | * @param {object} options - Options object. 25 | * @param {object} options.client - The Telegram Bot API client. 26 | * @param {object} options.update - The Telegram update object. 27 | * @returns {Promise<*>} - A Promise that resolves with the result of deleting the message or false if there's an error. 28 | */ 29 | 30 | async function closeCbMessage({ client, update }) { 31 | try { 32 | // Delete the original message 33 | return await client.deleteMessages( 34 | update.userId, [update.msgId], {} 35 | ); 36 | 37 | } catch (error) { 38 | logger.log('error', `${file_name}: ${update.userId} : ${error}`); 39 | return false; // Return false in case of an error 40 | } 41 | } 42 | 43 | 44 | module.exports = closeCbMessage; 45 | 46 | /** 47 | * 48 | * @license 49 | * FileShareBot is open-source software distributed under the MIT License. 50 | * Please see the LICENSE: file for more details. 51 | * 52 | * @repository 53 | * You can find the source code of this bot and contribute on GitHub: 54 | * https://github.com/nabilanavab/filesharebot 55 | * 56 | * @author 57 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 58 | * bug reports, or collaboration. 59 | * 60 | * Contact: https://telegram.me/nabilanavab 61 | * 62 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/callBack/editDuration.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | const logger = require("../../../logger"); 20 | const { generateInfo } = require("../localDB/generData"); 21 | const { extrasDbFunctions } = require("../../monGo/extras"); 22 | const askDuration = require("./getDuration"); 23 | const { DATABASE } = require("../../../config"); 24 | const { Api } = require('telegram'); 25 | 26 | /** 27 | * Handles callback queries related to the message Duration setting. 28 | * @param {object} options - Options object. 29 | * @param {object} options.client - The Telegram Bot API client. 30 | * @param {object} options.update - The Telegram update object. 31 | * @returns {Promise<*>} - A Promise that resolves with the edited message or 32 | * false if there's an error. 33 | */ 34 | 35 | async function setDuration({ client, update }) { 36 | try { 37 | // Decode callback data from base64 38 | let cbData = Buffer.from(update.data).toString('utf8'); 39 | // Get the user's language code 40 | let langCode = await getLang(update.userId); 41 | 42 | // callBack will be like "~lang|{code}" 43 | let newTime = cbData.replace("$", ""); 44 | 45 | if ( newTime === "duration|Done" ){ 46 | 47 | const translated = await translate({text: `duration.already`, langCode: langCode}); 48 | return await client.invoke( 49 | new Api.messages.SetBotCallbackAnswer({ 50 | alert: true, 51 | queryId: BigInt(update.queryId.value), 52 | message: translated.text, 53 | // url: 'random string here', 54 | }) 55 | ); 56 | 57 | } else if ( newTime === "delete" ){ 58 | 59 | if (generateInfo[update.userId] && 60 | generateInfo[update.userId]['duration'] !== undefined) 61 | delete generateInfo[update.userId]['duration']; 62 | 63 | if (DATABASE.MONGODB_URI) 64 | await extrasDbFunctions.changeData({ 65 | userID: update.userId, 66 | key: 'duration' 67 | }); 68 | 69 | } else { 70 | if (!generateInfo[update.userId]) 71 | generateInfo[update.userId] = {} 72 | 73 | if (generateInfo[update.userId]['duration'] != newTime) 74 | generateInfo[update.userId]['duration'] = newTime; 75 | 76 | if (DATABASE.MONGODB_URI) 77 | await extrasDbFunctions.changeData({ 78 | userID: update.userId, key: 'duration', value: newTime 79 | }); 80 | } 81 | 82 | return await askDuration( 83 | { client: client, update: update} 84 | ); 85 | 86 | } catch (error) { 87 | logger.log('error', `${file_name}: ${update.userId} : ${error}`); 88 | return false; 89 | } 90 | } 91 | 92 | module.exports = setDuration; 93 | 94 | /** 95 | * 96 | * @license 97 | * FileShareBot is open-source software distributed under the MIT License. 98 | * Please see the LICENSE: file for more details. 99 | * 100 | * @repository 101 | * You can find the source code of this bot and contribute on GitHub: 102 | * https://github.com/nabilanavab/filesharebot 103 | * 104 | * @author 105 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 106 | * bug reports, or collaboration. 107 | * 108 | * Contact: https://telegram.me/nabilanavab 109 | * 110 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/callBack/editLang.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | const logger = require("../../../logger"); 20 | const { enabledLang } = require("../../i18n/data"); 21 | const { extrasDbFunctions } = require("../../monGo/extras"); 22 | const askLang = require("./getLang"); 23 | const { DATABASE } = require("../../../config"); 24 | const { Api } = require('telegram'); 25 | 26 | /** 27 | * Handles callback queries related to the language setting. 28 | * @param {object} options - Options object. 29 | * @param {object} options.client - The Telegram Bot API client. 30 | * @param {object} options.update - The Telegram update object. 31 | * @returns {Promise<*>} - A Promise that resolves with the edited message or 32 | * false if there's an error. 33 | */ 34 | 35 | async function setLang({ client, update }) { 36 | try { 37 | // Decode callback data from base64 38 | let cbData = Buffer.from(update.data).toString('utf8'); 39 | // Get the user's language code 40 | let langCode = await getLang(update.userId); 41 | 42 | // callBack will be like "~lang|{code}" 43 | let newLang = cbData.split("|")[1]; 44 | 45 | if ( newLang === "Done" ){ 46 | 47 | const translated = await translate({text: `lang.already`, langCode: langCode}); 48 | return await client.invoke( 49 | new Api.messages.SetBotCallbackAnswer({ 50 | alert: true, 51 | queryId: BigInt(update.queryId.value), 52 | message: translated.text, 53 | // url: 'random string here', 54 | }) 55 | ); 56 | 57 | } else { 58 | 59 | if (DATABASE.MONGODB_URI && enabledLang.hasOwnProperty(newLang)){ 60 | await extrasDbFunctions.changeLang({ 61 | userID: update.userId, 62 | lang: newLang 63 | }) 64 | } 65 | 66 | await askLang( 67 | { client: client, update: update} 68 | ); 69 | } 70 | 71 | } catch (error) { 72 | logger.log('error', `${file_name}: ${update.userId} : ${error}`); 73 | return false; 74 | } 75 | } 76 | 77 | module.exports = setLang; 78 | 79 | /** 80 | * 81 | * @license 82 | * FileShareBot is open-source software distributed under the MIT License. 83 | * Please see the LICENSE: file for more details. 84 | * 85 | * @repository 86 | * You can find the source code of this bot and contribute on GitHub: 87 | * https://github.com/nabilanavab/filesharebot 88 | * 89 | * @author 90 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 91 | * bug reports, or collaboration. 92 | * 93 | * Contact: https://telegram.me/nabilanavab 94 | * 95 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/callBack/editSettings.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | const logger = require("../../../logger"); 20 | const { generateInfo } = require("../localDB/generData"); 21 | const { extrasDbFunctions } = require("../../monGo/extras"); 22 | const settingsCbHandler = require("./getSettings"); 23 | const { DATABASE } = require("../../../config"); 24 | 25 | /** 26 | * Handles callback queries related to the setting. 27 | * @param {object} options - Options object. 28 | * @param {object} options.client - The Telegram Bot API client. 29 | * @param {object} options.update - The Telegram update object. 30 | * @returns {Promise<*>} - A Promise that resolves with the edited message or 31 | * false if there's an error. 32 | */ 33 | 34 | async function changeSettings({ client, update }) { 35 | try { 36 | // Decode callback data from base64 37 | let cbData = Buffer.from(update.data).toString('utf8'); 38 | 39 | // Extract currentStatus either true or false [bool] 40 | // eg cb data will be like [!noForward|true] 41 | // first line extrack new Value and 2nd line remove ! from the front 42 | let currentStatus = (cbData.split("|")[1] === "true"); 43 | let updateProcess = cbData.split("|")[0].slice(1); 44 | 45 | // dropAuthor By defaylt it will be true 46 | if (updateProcess === "dropAuthor") 47 | currentStatus = !currentStatus; 48 | 49 | if (currentStatus){ 50 | if (generateInfo[update.userId] && 51 | generateInfo[update.userId][updateProcess] !== undefined) { 52 | delete generateInfo[update.userId][String(updateProcess)]; 53 | }; 54 | if (DATABASE.MONGODB_URI) 55 | await extrasDbFunctions.changeData({ 56 | userID: update.userId, 57 | key: updateProcess 58 | }); 59 | } else { 60 | if (!generateInfo[update.userId]){ 61 | generateInfo[update.userId] = {} 62 | }; 63 | if (generateInfo[update.userId][String(updateProcess)] != !currentStatus) { 64 | generateInfo[update.userId][updateProcess] = !currentStatus; 65 | }; 66 | if (DATABASE.MONGODB_URI) 67 | await extrasDbFunctions.changeData({ 68 | userID: update.userId, 69 | key: updateProcess, 70 | value: !currentStatus 71 | }); 72 | }; 73 | 74 | await settingsCbHandler( 75 | { client: client, update: update} 76 | ); 77 | 78 | } catch (error) { 79 | logger.log('error', `${file_name}: ${update.userId} : ${error}`); 80 | return false; 81 | } 82 | } 83 | 84 | module.exports = changeSettings; 85 | 86 | /** 87 | * 88 | * @license 89 | * FileShareBot is open-source software distributed under the MIT License. 90 | * Please see the LICENSE: file for more details. 91 | * 92 | * @repository 93 | * You can find the source code of this bot and contribute on GitHub: 94 | * https://github.com/nabilanavab/filesharebot 95 | * 96 | * @author 97 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 98 | * bug reports, or collaboration. 99 | * 100 | * Contact: https://telegram.me/nabilanavab 101 | * 102 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/callBack/getDuration.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | const logger = require("../../../logger"); 20 | const { generateInfo } = require("../localDB/generData"); 21 | const translate = require("../../i18n/t9n"); 22 | const { createButton } = require("../../i18n/ba10"); 23 | 24 | /** 25 | * Handles callback queries for changing message delete Duration 26 | * @param {object} options - Options object. 27 | * @param {object} options.client - The Telegram Bot API client. 28 | * @param {object} options.update - The Telegram update object. 29 | * @returns {Promise<*>} - A Promise that resolves with the edited message or 30 | * false if there's an error. 31 | */ 32 | 33 | async function askDuration({ client, update }) { 34 | try { 35 | // Get the user's language code 36 | let langCode = await getLang(update.userId); 37 | 38 | let translated = await translate({ 39 | text: `duration.message`, 40 | button: `duration.button`, 41 | langCode: langCode, 42 | asString: true 43 | }) 44 | 45 | let langDict = {}, index = 0; 46 | 47 | // Check if user's preferred duration is set in generateInfo 48 | const currentDuration = generateInfo[update.userId]?.duration; 49 | 50 | // Iterate through translated.button using duration as the variable name 51 | for (let durationKey in translated.button) { 52 | const durationNames = translated.button[durationKey].replace("$", ""); 53 | 54 | if (index === 0 && !currentDuration) { 55 | 56 | langDict[`🟢 ${durationKey} 🟢`] = `$${durationNames}`; 57 | 58 | } else { 59 | 60 | // Check if the current duration key is the user's preferred duration 61 | const isUserDuration = currentDuration === durationNames; 62 | 63 | // Use tick emoji for the second value of the key if it's the user's preferred duration 64 | const key = isUserDuration ? `🟢 ${durationKey} 🟢` : `${durationKey}`; 65 | 66 | if (durationNames != "!set") langDict[key] = `$${durationNames}`; 67 | else langDict[key] = durationNames; 68 | 69 | } 70 | 71 | index++; 72 | } 73 | 74 | newButton = await createButton({ 75 | button: langDict, 76 | order: 33331 77 | }) 78 | 79 | return await client.editMessage( 80 | update.userId, { 81 | message: update.msgId, 82 | text: translated.text, 83 | buttons: client.buildReplyMarkup(newButton), 84 | parseMode: "html", 85 | } 86 | ); 87 | 88 | } catch (error){ 89 | logger.log('error', `${file_name}: ${update.userId} : ${error}`); 90 | return false; 91 | } 92 | } 93 | 94 | module.exports = askDuration; 95 | 96 | /** 97 | * 98 | * @license 99 | * FileShareBot is open-source software distributed under the MIT License. 100 | * Please see the LICENSE: file for more details. 101 | * 102 | * @repository 103 | * You can find the source code of this bot and contribute on GitHub: 104 | * https://github.com/nabilanavab/filesharebot 105 | * 106 | * @author 107 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 108 | * bug reports, or collaboration. 109 | * 110 | * Contact: https://telegram.me/nabilanavab 111 | * 112 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/callBack/getLang.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | const logger = require("../../../logger"); 20 | const { enabledLang } = require("../../i18n/data"); 21 | const translate = require("../../i18n/t9n"); 22 | const { createButton } = require("../../i18n/ba10"); 23 | const { LANG_INFO } = require("../../../config") 24 | 25 | /** 26 | * Handles callback queries for changing Language 27 | * @param {object} options - Options object. 28 | * @param {object} options.client - The Telegram Bot API client. 29 | * @param {object} options.update - The Telegram update object. 30 | * @returns {Promise<*>} - A Promise that resolves with the edited message or 31 | * false if there's an error. 32 | */ 33 | 34 | const maxClmnForButton = 3; 35 | 36 | async function askLang({ client, update }) { 37 | try { 38 | console.log(LANG_INFO.MULTIPLE_LANG) 39 | if (!LANG_INFO.MULTIPLE_LANG){ 40 | return 41 | } 42 | 43 | // Get the user's language code 44 | let langCode = await getLang(update.userId); 45 | 46 | let translated = await translate({ 47 | text: `lang.select`, 48 | button: `lang.back`, 49 | langCode: langCode, 50 | asString: true 51 | }) 52 | 53 | let langDict = {}; 54 | 55 | const numElements = Object.keys(enabledLang).length; 56 | 57 | for (let langKey in enabledLang) { 58 | const langNames = enabledLang[langKey]; 59 | 60 | // Check if the current language key is the user's language 61 | const isUserLang = langKey === langCode; 62 | 63 | // Use tick emoji for the second value of the key if it's the user's language 64 | const key = isUserLang ? `🟢 ${langNames[0]} | ${langNames[1]} 🟢` : `${langNames[0]} | ${langNames[1]}`; 65 | langKey = isUserLang ? `~lang|Done` : `~lang|${langKey}`; 66 | 67 | // Add the key-value pair to the dictionary 68 | langDict[key] = langKey; 69 | } 70 | 71 | langDict = { ...langDict, ...translated.button }; 72 | 73 | // Create a number based on the variable maxLen 74 | let order = Array(Math.floor(numElements / maxClmnForButton) + 1).fill(0); 75 | order = order.map( 76 | (_, i, arr) => i === arr.length - 1 ? 77 | Math.floor(numElements % maxClmnForButton) : maxClmnForButton 78 | ); 79 | 80 | // we need to add one back button also 81 | order = Number(order.join('') + '1'); 82 | 83 | newButton = await createButton({ 84 | button: langDict, 85 | order: order 86 | }) 87 | 88 | return await client.editMessage( 89 | update.userId, { 90 | message: update.msgId, 91 | text: translated.text, 92 | buttons: client.buildReplyMarkup(newButton), 93 | parseMode: "html", 94 | } 95 | ); 96 | 97 | } catch (error){ 98 | logger.log('error', `${file_name}: ${update.userId} : ${error}`); 99 | return false; 100 | } 101 | } 102 | 103 | module.exports = askLang; 104 | 105 | /** 106 | * 107 | * @license 108 | * FileShareBot is open-source software distributed under the MIT License. 109 | * Please see the LICENSE: file for more details. 110 | * 111 | * @repository 112 | * You can find the source code of this bot and contribute on GitHub: 113 | * https://github.com/nabilanavab/filesharebot 114 | * 115 | * @author 116 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 117 | * bug reports, or collaboration. 118 | * 119 | * Contact: https://telegram.me/nabilanavab 120 | * 121 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/callBack/getSettings.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | /** 4 | * 5 | * This code snippet is part of the FileShareBot by @nabilanavab. 6 | * It is intended for educational and non-commercial use. 7 | * The project was developed for personal enjoyment and experimentation. 8 | * If you encounter any bugs or issues, we encourage you to contribute by 9 | * making a pull request. [ All contributions are highly appreciated ] 10 | * 11 | * @version 1.0.0 12 | * @author NabilANavab 13 | * @copyright 2023 ©️ nabilanavab 14 | * 15 | */ 16 | 17 | const file_name = __dirname + __filename 18 | const author = "@nabilanavab" 19 | 20 | const logger = require("../../../logger"); 21 | const { generateInfo } = require("../localDB/generData"); 22 | const translate = require("../../i18n/t9n"); 23 | const { createButton } = require("../../i18n/ba10"); 24 | 25 | /** 26 | * Handles callback queries related to the help command. 27 | * @param {object} options - Options object. 28 | * @param {object} options.client - The Telegram Bot API client. 29 | * @param {object} options.update - The Telegram update object. 30 | * @returns {Promise<*>} - A Promise that resolves with the edited message or 31 | * false if there's an error. 32 | */ 33 | 34 | async function settingsCbHandler({ client, update }) { 35 | try { 36 | // Get the user's language code 37 | let langCode = await getLang(update.userId); 38 | 39 | let translated = await translate({ 40 | text: `settings.message`, 41 | button: `settings.button`, 42 | langCode: langCode, 43 | asString: true, 44 | order: 2211 45 | }); 46 | 47 | let newButton = {}; 48 | if (!generateInfo[update.userId]){ 49 | generateInfo[update.userId] = {} 50 | }; 51 | 52 | for (let [key, value] of Object.entries(translated.button)) { 53 | if (value.startsWith(":")){ 54 | // inline message [set password button] 55 | let replacementValue = generateInfo[update.userId]['setPassword']; 56 | 57 | let replacementKey = (replacementValue !== undefined) 58 | ? "🔐 " + key : "🔓 " + key; 59 | 60 | if (replacementValue) value = `:${replacementValue}` 61 | 62 | newButton[replacementKey] = value; 63 | 64 | } else if (value.startsWith("$")){ 65 | // callBack Button for setting file duration 66 | let replacementValue = generateInfo[update.userId]['duration']; 67 | 68 | let replacementKey = (replacementValue === undefined) 69 | ? "🗑️ " + key + " 🗑️" : `🗑️ ` + key + `: ${replacementValue} sec`; 70 | 71 | if (replacementValue) value = `$${replacementValue}` 72 | 73 | newButton[replacementKey] = value; 74 | 75 | } else if (value.startsWith("+")){ 76 | let modifiedValue = value.replace("+", ""); 77 | replacementValue = generateInfo[update.userId][modifiedValue] 78 | 79 | let replacementKey = replacementValue 80 | ? "✅ " + key + " ✅" 81 | : "☑️ " + key + " ☑️"; 82 | 83 | newButton[replacementKey] = value; 84 | } 85 | else { 86 | // callback with true false value 87 | "!{name} : corresponts to generateInfo[user][name]" 88 | let modifiedValue = value.replace("!", ""); 89 | 90 | if ( value === "!dropAuthor" ) 91 | replacementValue = !generateInfo[update.userId][modifiedValue] 92 | else 93 | replacementValue = generateInfo[update.userId][modifiedValue] 94 | 95 | let replacementKey = (!value.startsWith("!")) 96 | ? key : ( replacementValue == true ) 97 | ? "✅ " + key + " ✅" 98 | : "☑️ " + key + " ☑️"; 99 | 100 | if (replacementValue) value = `${value}|true` 101 | else value = `${value}|false` 102 | 103 | newButton[replacementKey] = value; 104 | } 105 | } 106 | 107 | newButton = await createButton({ 108 | button: newButton, 109 | order: 22221 110 | }) 111 | return await client.editMessage( 112 | update.userId, { 113 | message: update.msgId, 114 | text: translated.text, 115 | buttons: client.buildReplyMarkup(newButton), 116 | parseMode: "html", 117 | } 118 | ); 119 | 120 | } catch (error) { 121 | logger.log('error', `${file_name}: ${update.userId} : ${error}`); 122 | return false; 123 | } 124 | } 125 | 126 | module.exports = settingsCbHandler; 127 | 128 | /** 129 | * 130 | * @license 131 | * FileShareBot is open-source software distributed under the MIT License. 132 | * Please see the LICENSE: file for more details. 133 | * 134 | * @repository 135 | * You can find the source code of this bot and contribute on GitHub: 136 | * https://github.com/nabilanavab/filesharebot 137 | * 138 | * @author 139 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 140 | * bug reports, or collaboration. 141 | * 142 | * Contact: https://telegram.me/nabilanavab 143 | * 144 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/callBack/help.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | const logger = require("../../../logger"); 20 | 21 | /** 22 | * Handles callback queries related to the help command. 23 | * @param {object} options - Options object. 24 | * @param {object} options.client - The Telegram Bot API client. 25 | * @param {object} options.update - The Telegram update object. 26 | * @returns {Promise<*>} - A Promise that resolves with the edited message or 27 | * false if there's an error. 28 | */ 29 | 30 | async function helpCbHandler({ client, update }) { 31 | try { 32 | // Decode callback data from base64 33 | let cbData = Buffer.from(update.data, 'base64').toString('utf8'); 34 | 35 | // Extract the new page from callback data 36 | let newPage = cbData.split("|")[1]; 37 | 38 | // Get the user's language code 39 | let langCode = await getLang(update.userId); 40 | 41 | // Translate message and buttons based on the new page 42 | let translated = await translate({ 43 | text: `help.${newPage}.message`, 44 | button: `help.${newPage}.button`, 45 | langCode: langCode, 46 | order: newPage==0 ? 2121 : 2 47 | }); 48 | 49 | // Edit the original message with the translated text and buttons 50 | return await client.editMessage( 51 | update.userId, { 52 | message: update.msgId, 53 | text: translated.text, 54 | buttons: client.buildReplyMarkup(translated.button), 55 | parseMode: "html", 56 | } 57 | ); 58 | 59 | } catch (error) { 60 | logger.log(`${file_name}: ${update.userId} : ${error}`); 61 | return false; 62 | } 63 | } 64 | 65 | module.exports = helpCbHandler; 66 | 67 | /** 68 | * 69 | * @license 70 | * FileShareBot is open-source software distributed under the MIT License. 71 | * Please see the LICENSE: file for more details. 72 | * 73 | * @repository 74 | * You can find the source code of this bot and contribute on GitHub: 75 | * https://github.com/nabilanavab/filesharebot 76 | * 77 | * @author 78 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 79 | * bug reports, or collaboration. 80 | * 81 | * Contact: https://telegram.me/nabilanavab 82 | * 83 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/callBack/refresh.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | const config = require("../../../config"); 20 | const { Api } = require("telegram"); 21 | const REQUESTED_USERS = require("../localDB/request"); 22 | 23 | /** 24 | * Handles callback queries related to the refresh join button. 25 | * @param {object} options - Options object. 26 | * @param {object} options.client - The Telegram Bot API client. 27 | * @param {object} options.update - The Telegram update object. 28 | * @returns {Promise<*>} - A Promise that resolves with the edited message or 29 | * false if there's an error. 30 | */ 31 | 32 | async function refreshPage({ client, update }) { 33 | 34 | // Get the user's language code 35 | let langCode = await getLang(update.userId); 36 | 37 | try { 38 | if ( !REQUESTED_USERS.includes(BigInt(update.userId)) ){ 39 | const result = await client.invoke( 40 | new Api.channels.GetParticipant({ 41 | channel: config.CHANNEL_INFO.FORCE_SUB, 42 | participant: update.userId 43 | }) 44 | ); 45 | 46 | if (result.kicked) 47 | throw "userBanned" 48 | } 49 | 50 | // Translate message and buttons based on the new page 51 | let translated = await translate({ 52 | text: 'help.0.message', 53 | button: 'help.0.button', 54 | langCode: langCode, 55 | order: 2121 56 | }); 57 | 58 | // Edit the original message with the translated text and buttons 59 | return await client.editMessage( 60 | update.userId, { 61 | message: update.msgId, 62 | text: translated.text, 63 | buttons: client.buildReplyMarkup(translated.button), 64 | parseMode: "html", 65 | } 66 | ); 67 | 68 | } catch (error) { 69 | const translated = await translate({text: `force.fool`, langCode: langCode}); 70 | return await client.invoke( 71 | new Api.messages.SetBotCallbackAnswer({ 72 | alert: true, 73 | queryId: BigInt(update.queryId.value), 74 | message: translated.text, 75 | // url: 'random string here', 76 | }) 77 | ); 78 | } 79 | } 80 | 81 | module.exports = refreshPage; 82 | 83 | /** 84 | * 85 | * @license 86 | * FileShareBot is open-source software distributed under the MIT License. 87 | * Please see the LICENSE: file for more details. 88 | * 89 | * @repository 90 | * You can find the source code of this bot and contribute on GitHub: 91 | * https://github.com/nabilanavab/filesharebot 92 | * 93 | * @author 94 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 95 | * bug reports, or collaboration. 96 | * 97 | * Contact: https://telegram.me/nabilanavab 98 | * 99 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/callbBack.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | let logger = require("../../logger"); 20 | const settingsCbHandler = require("./callBack/getSettings") 21 | const helpCbHandler = require("./callBack/help"); 22 | const closeCbMessage = require("./callBack/close"); 23 | const changeSettings = require("./callBack/editSettings"); 24 | const setLang = require("./callBack/editLang"); 25 | const askLang = require("./callBack/getLang"); 26 | const setDuration = require("./callBack/editDuration"); 27 | const askDuration = require("./callBack/getDuration"); 28 | const refreshPage = require("./callBack/refresh"); 29 | const batchManager = require("./callBack/batchCB"); 30 | const captButton = require("./callBack/askCapBut"); 31 | 32 | /** 33 | * Event handler to process callback queries from the bot's inline keyboard. 34 | * 35 | * @param {TelegramBot} client - The Telegram bot instance. 36 | * @returns {Promise} - A Promise that resolves when the callback query processing is completed. 37 | */ 38 | 39 | module.exports = async function(client){ 40 | client.addEventHandler(async (update) => { 41 | if ( 42 | update && 43 | update.className == "UpdateBotCallbackQuery" 44 | ){ 45 | try { 46 | let data = Buffer.from(update.data).toString('utf8'); 47 | 48 | if (data === 'close') { 49 | return closeCbMessage({ client: client, update: update }); 50 | } 51 | else if (data === "!set") { 52 | return settingsCbHandler({ client: client, update: update }); 53 | } 54 | else if (data.startsWith("!")) { 55 | return changeSettings({ client: client, update: update }); 56 | } 57 | else if (data.startsWith("-")) { 58 | return helpCbHandler({ client: client, update: update }); 59 | } 60 | else if (data === "~lang") { 61 | return askLang({ client: client, update: update }); 62 | } 63 | else if (data.startsWith("~")) { 64 | return setLang({ client: client, update: update }); 65 | } 66 | else if (data === "$duration") { 67 | return askDuration({ client: client, update: update}); 68 | } 69 | else if (data.startsWith("$")) { 70 | return setDuration({ client: client, update: update }); 71 | } 72 | else if (data === "=refresh") { 73 | return refreshPage({ client: client, update: update }); 74 | } 75 | else if (data.startsWith("@")){ 76 | return batchManager({ client: client, update: update }); 77 | } 78 | else if (data.startsWith("+")){ 79 | return captButton({ client: client, update: update }); 80 | } 81 | } catch (error) { 82 | logger.log(`${file_name}: ${update.userId} : ${error}`); 83 | return false; 84 | } 85 | } 86 | } 87 | )} 88 | 89 | /** 90 | * 91 | * @license 92 | * FileShareBot is open-source software distributed under the MIT License. 93 | * Please see the LICENSE: file for more details. 94 | * 95 | * @repository 96 | * You can find the source code of this bot and contribute on GitHub: 97 | * https://github.com/nabilanavab/filesharebot 98 | * 99 | * @author 100 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 101 | * bug reports, or collaboration. 102 | * 103 | * Contact: https://telegram.me/nabilanavab 104 | * 105 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/caption.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | const { extrasDbFunctions } = require("../monGo/extras"); 20 | const { DATABASE } = require("../../config"); 21 | const { generateInfo } = require("./localDB/generData"); 22 | const logger = require("../../logger"); 23 | 24 | /** 25 | * Asynchronous function to handle the addition of captions based on specific Telegram commands. 26 | * @param {TelegramClient} client - The Telegram client instance. 27 | * @returns {Promise} - A promise that resolves once the caption is added or an error occurs. 28 | */ 29 | 30 | async function addCaption(client) { 31 | client.addEventHandler(async (update) => { 32 | if ( 33 | update?.message?.peerId?.className === 'PeerUser' && 34 | !update?.message?.out && 35 | update?.message?.message?.startsWith("/add_caption") 36 | ) { 37 | try { 38 | // Retrieve the user's language from the local database 39 | let lang_code = await getLang(update.message.chatId); 40 | 41 | let caption = update.message.message.replace('/add_caption ', '').substring(0, 100); 42 | 43 | if (caption !== "/add_caption"){ 44 | if ( DATABASE.MONGODB_URI ) { 45 | await extrasDbFunctions.changeData({ 46 | userID: update.message.chatId, 47 | key: "caption", 48 | value: caption 49 | }) 50 | } 51 | 52 | generateInfo[update.message.chatId]['caption'] = caption; 53 | 54 | translated = await translate({ 55 | text: "capButton.addedCap", 56 | button: "settings.closeCB", 57 | langCode: lang_code 58 | }) 59 | 60 | return await client.sendMessage( 61 | update.message.chatId, { 62 | message: translated.text + caption, 63 | buttons: translated.button, 64 | replyTo: update.message 65 | } 66 | ) 67 | } else { 68 | translated = await translate({ 69 | text: "capButton.checkSyntax", 70 | button: "settings.closeCB", 71 | langCode: lang_code 72 | }) 73 | return await client.sendMessage( 74 | update.message.chatId, { 75 | message: translated.text, 76 | buttons: translated.button, 77 | replyTo: update.message 78 | } 79 | ) 80 | } 81 | } catch (error) { 82 | logger.log('error', `${file_name} : ${update.message.chatId} : ${error}`); 83 | } 84 | } 85 | }) 86 | } 87 | 88 | 89 | /** 90 | * Asynchronous function to handle the deletion of captions based on specific Telegram commands. 91 | * @param {TelegramClient} client - The Telegram client instance. 92 | * @returns {Promise} - A promise that resolves once the caption is deleted or an error occurs. 93 | */ 94 | 95 | async function deleteCaption(client) { 96 | client.addEventHandler(async (update) => { 97 | if ( 98 | update?.message?.peerId?.className === 'PeerUser' && 99 | !update?.message?.out && 100 | update?.message?.message?.startsWith("/delete_caption") 101 | ) { 102 | try { 103 | // Retrieve the user's language from the local database 104 | let lang_code = await getLang(update.message.chatId); 105 | 106 | if (generateInfo?.[update.message.chatId]?.['caption']){ 107 | generateInfo[update.message.chatId]['caption'] = false; 108 | 109 | if ( DATABASE.MONGODB_URI ) { 110 | await extrasDbFunctions.changeData({ 111 | userID: update.message.chatId, 112 | key: "caption", 113 | deleteIt: true 114 | }) 115 | } 116 | } 117 | 118 | translated = await translate({ 119 | text: "capButton.deletedCap", 120 | button: "settings.closeCB", 121 | langCode: lang_code 122 | }) 123 | return await client.sendMessage( 124 | update.message.chatId, { 125 | message: translated.text, 126 | buttons: translated.button, 127 | replyTo: update.message 128 | } 129 | ) 130 | } catch (error) { 131 | logger.log('error', `${file_name} : ${update.message.chatId} : ${error}`); 132 | } 133 | } 134 | }) 135 | } 136 | 137 | 138 | /** 139 | * Function to set up event handlers for adding, and deleting captions. 140 | * @param {TelegramClient} client - The Telegram client instance. 141 | * @returns {Promise} - A promise that resolves once all event handlers are set up or an error occurs. 142 | */ 143 | 144 | async function captButton(client) { 145 | await addCaption(client); 146 | await deleteCaption(client); 147 | } 148 | 149 | module.exports = captButton; 150 | 151 | 152 | /** 153 | * 154 | * @license 155 | * FileShareBot is open-source software distributed under the MIT License. 156 | * Please see the LICENSE: file for more details. 157 | * 158 | * @repository 159 | * You can find the source code of this bot and contribute on GitHub: 160 | * https://github.com/nabilanavab/filesharebot 161 | * 162 | * @author 163 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 164 | * bug reports, or collaboration. 165 | * 166 | * Contact: https://telegram.me/nabilanavab 167 | **/ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/cryptoG/__init__.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | /** 4 | * 5 | * @description 6 | * Directory Purpose: 7 | * - This directory contains files dedicated to encryption and decryption operations. 8 | * - Files within this directory may include cryptographic keys, algorithms, or configurations necessary for secure data handling. 9 | * - Encryption and decryption functionalities for the application are implemented using the resources stored here. 10 | * 11 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/cryptoG/decrypt.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | const crypto = require("crypto"); 20 | const logger = require("../../../logger"); 21 | const algorithm = "aes-192-cbc"; 22 | const fixedIV = Buffer.from('7860786078607860'); 23 | const { generateInfo } = require("../localDB/generData"); 24 | 25 | 26 | /** 27 | * Helps to Decrypt aes-192-cbc string to Text 28 | * 29 | * @param {string} text The first number 30 | * @returns {string} The sum of a and b 31 | * 32 | * @example 33 | * decrypt(text) 34 | **/ 35 | 36 | async function decrypt({ code, userID }){ 37 | try { 38 | let key 39 | if ( generateInfo[userID] && generateInfo[userID]['addPassword'] ){ 40 | key = generateInfo[userID]['addPassword']; 41 | } else { 42 | key = OWNER; 43 | } 44 | key = crypto.scryptSync(key, 'nabilanavab', 24); 45 | let decipher = crypto.createDecipheriv(algorithm, key, fixedIV); 46 | let decrypted = decipher.update(code, 'hex', 'utf8') + decipher.final('utf8'); 47 | return decrypted; 48 | } catch (error) { 49 | logger.log('error', `${file_name}: ${userID} : ${error}`); 50 | throw "error in code"; 51 | } 52 | } 53 | 54 | // var decipher = crypto.createDecipher(algorithm, secretKey); 55 | // var decrypted = decipher.update(encrypted, 'hex', 'utf8') + decipher.final('utf8'); 56 | // console.log('Decrypted:', decrypted); 57 | 58 | module.exports = decrypt 59 | 60 | /** 61 | * 62 | * @license 63 | * FileShareBot is open-source software distributed under the MIT License. 64 | * Please see the LICENSE: file for more details. 65 | * 66 | * @repository 67 | * You can find the source code of this bot and contribute on GitHub: 68 | * https://github.com/nabilanavab/filesharebot 69 | * 70 | * @author 71 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 72 | * bug reports, or collaboration. 73 | * 74 | * Contact: https://telegram.me/nabilanavab 75 | * 76 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/cryptoG/encrypt.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | const crypto = require("crypto"); 20 | const logger = require("../../../logger"); 21 | const algorithm = "aes-192-cbc"; 22 | const fixedIV = Buffer.from('7860786078607860'); 23 | const { generateInfo } = require("../localDB/generData") 24 | 25 | 26 | /** 27 | * Helps to Encrypt Text to aes-192-cbc string 28 | * 29 | * @param {string} text The first number 30 | * @returns {string} The sum of a and b 31 | * 32 | * @example 33 | * encrypt(text) 34 | */ 35 | 36 | async function encrypt({ text, userID }) { 37 | try { 38 | 39 | let key 40 | if ( generateInfo[userID] && generateInfo[userID]['addPassword'] ){ 41 | key = generateInfo[userID]['addPassword']; 42 | } else { 43 | key = OWNER; 44 | } 45 | key = crypto.scryptSync(key, 'nabilanavab', 24); 46 | let cipher = crypto.createCipheriv(algorithm, key, fixedIV); 47 | let encrypted = cipher.update(text, 'utf8', 'hex') + cipher.final('hex'); 48 | return encrypted; 49 | 50 | } catch (error) { 51 | // Handle errors 52 | logger.log('error', `${file_name}: ${userID} : ${error}`); 53 | return false 54 | } 55 | } 56 | 57 | // let cipher = crypto.createCipher(algorithm, secretKey); 58 | // let encrypted = cipher.update('45678', 'utf-8', 'hex'); 59 | // encrypted += cipher.final('hex'); 60 | // console.log('Encrypted:', encrypted); 61 | 62 | module.exports = encrypt; 63 | 64 | /** 65 | * 66 | * @license 67 | * FileShareBot is open-source software distributed under the MIT License. 68 | * Please see the LICENSE: file for more details. 69 | * 70 | * @repository 71 | * You can find the source code of this bot and contribute on GitHub: 72 | * https://github.com/nabilanavab/filesharebot 73 | * 74 | * @author 75 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 76 | * bug reports, or collaboration. 77 | * 78 | * Contact: https://telegram.me/nabilanavab 79 | * 80 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/helpers/__init__.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | /** 4 | * 5 | * @description 6 | * Directory Purpose: 7 | * - This folder contains essential functionalities aimed at preventing flood bans 8 | * during various operations. 9 | * - It includes modules and scripts designed to manage rate limits and ensure smooth 10 | * processing during tasks like forwarding, editing, local file creation, etc. 11 | * - These measures are implemented to avoid triggering flood detection mechanisms 12 | * that could lead to temporary restrictions or bans. 13 | * 14 | */ 15 | -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/helpers/edit.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | // This snippet helps to edit user messages, primarily aimed at addressing the flood issue. 20 | 21 | const logger = require("../../../logger"); 22 | const { FloodWaitError, 23 | EditMessage } = require("telegram/errors/RPCErrorList"); 24 | 25 | /** 26 | * Asynchronous function to send edited reply messages to a log channel. 27 | * 28 | * @param {Object} params - Parameters object containing client, editedText, and messageId. 29 | * @param {object} params.client - The messaging client. 30 | * @param {string} params.editedText - The edited text of the reply message. 31 | * @param {number} params.messageId - The ID of the original message being replied to. 32 | * @returns {Object} - A Promise that resolves once the edited reply message is sent. 33 | */ 34 | 35 | async function editReply({ client, chatId, editedText, editedBtn, messageId}) { 36 | // Edit and send the reply message to the log channel 37 | try { 38 | let editedMsg = await client.editMessage( 39 | chatId, 40 | { 41 | message: messageId, 42 | text: editedText, 43 | buttons: client.buildReplyMarkup( 44 | editedBtn 45 | ), 46 | parseMode: "html" 47 | } 48 | ); 49 | return editedMsg; 50 | } catch ( error ) { 51 | // Handle flood error 52 | if (error instanceof FloodWaitError) { 53 | await sleep(error.seconds); 54 | // Retry editing and sending the reply after waiting for the flood interval 55 | return editReply({ client, editedText, messageId }); 56 | // } else if (error instanceof EditMessage){ 57 | // return editReply({ client, editedText, messageId }); 58 | } else { 59 | logger.log('error', `${file_name}: ${chatId} : ${error}`); 60 | return null; 61 | } 62 | } 63 | } 64 | 65 | module.exports = { editReply }; 66 | 67 | /** 68 | * 69 | * @license 70 | * FileShareBot is open-source software distributed under the MIT License. 71 | * Please see the LICENSE: file for more details. 72 | * 73 | * @repository 74 | * You can find the source code of this bot and contribute on GitHub: 75 | * https://github.com/nabilanavab/filesharebot 76 | * 77 | * @author 78 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 79 | * bug reports, or collaboration. 80 | * 81 | * Contact: https://telegram.me/nabilanavab 82 | * 83 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/helpers/forceSub.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | const logger = require("../../../logger"); 20 | const config = require("../../../config"); 21 | const { Api } = require('telegram'); 22 | const getLang = require("../../../bot/i18n/utils"); 23 | const translate = require("../../../bot/i18n/t9n"); 24 | const editDict = require("../../../bot/i18n/edtB10"); 25 | const { limitHandler, timeLimitError } = require("./limitHandler"); 26 | 27 | 28 | // Define a custom error class that extends the built-in Error class 29 | class userNotJoined extends Error { 30 | constructor(message, code) { 31 | // Call the constructor of the parent class (Error) 32 | super(message); 33 | 34 | // Set the name of the error for identification 35 | this.name = 'userNotJoined'; 36 | } 37 | } 38 | 39 | /** 40 | * Handles the force subscription logic based on the provided configuration. 41 | * @param {Object} params - Parameters for the force subscription logic. 42 | * @param {Object} params.client - The Gram.js Client 43 | * @param {Object} params.update - Object containing information about new message instance. 44 | * @returns {Promise} - A promise that resolves with the result of the force subscription operation. 45 | * @throws {timeLimitError} - Thrown if a time limit error occurs during the operation. 46 | * @throws {userNotJoined} - Thrown if the user is not joined and a force subscription is attempted. 47 | */ 48 | 49 | const forceSub = async ({ client, update, checkLimit=false, haveCode=false }) => { 50 | try{ 51 | // Check if force subscription and request URL are both disabled 52 | if (!config.CHANNEL_INFO.FORCE_SUB){ 53 | // Time limit checking 54 | if (checkLimit){ 55 | await limitHandler({ 56 | client: client, 57 | userId: update.message.chatId.value, 58 | replyTo: update.message.id 59 | }) 60 | } 61 | return true; 62 | } 63 | 64 | // If force subscription is enabled, attempt to get participant information 65 | if (config.CHANNEL_INFO.FORCE_SUB) { 66 | const result = await client.invoke( 67 | new Api.channels.GetParticipant({ 68 | channel: config.CHANNEL_INFO.FORCE_SUB, 69 | participant: update.message.chatId.value 70 | }) 71 | ); 72 | 73 | // Time limit checking 74 | if (checkLimit){ 75 | await limitHandler({ 76 | client: client, 77 | userId: update.message.chatId.value 78 | }) 79 | } 80 | 81 | return result; 82 | } 83 | 84 | } catch (error) { 85 | 86 | if (error instanceof timeLimitError) { 87 | throw error; 88 | } else { 89 | let lang_code = await getLang(update.message.chatId); 90 | let translated = await translate({ 91 | text: 'force.message', 92 | button: 'force.button', 93 | langCode: lang_code, 94 | asString: true 95 | }); 96 | 97 | let newButton = await editDict({ 98 | inDict : translated.button, 99 | value : [ 100 | config.CHANNEL_INFO.FORCE_URL, 101 | haveCode.length > 8 ? 102 | `https://telegram.dog/${botInfo.username}?start=${haveCode}` : "=refresh" 103 | ] 104 | }) 105 | newButton = await createButton({ 106 | button : newButton, 107 | order : '11' 108 | }) 109 | 110 | await client.sendMessage(update.message.chatId, { 111 | message: translated.text, 112 | buttons: client.buildReplyMarkup( 113 | newButton 114 | ), 115 | replyTo: update.message.id 116 | }); 117 | 118 | logger.log('error', `${file_name}: ${update.message.chatId.value} : ${error}`); 119 | throw new userNotJoined("USER_NOT_JOINED") 120 | } 121 | } 122 | }; 123 | 124 | module.exports = { forceSub }; 125 | 126 | /** 127 | * 128 | * @license 129 | * FileShareBot is open-source software distributed under the MIT License. 130 | * Please see the LICENSE: file for more details. 131 | * 132 | * @repository 133 | * You can find the source code of this bot and contribute on GitHub: 134 | * https://github.com/nabilanavab/filesharebot 135 | * 136 | * @author 137 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 138 | * bug reports, or collaboration. 139 | * 140 | * Contact: https://telegram.me/nabilanavab 141 | * 142 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/helpers/limitHandler.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * @date December 12, 2023 14 | * @description : This file contains functions for handling user requests with a 15 | * rate-limiting mechanism. 16 | */ 17 | 18 | const file_name = __dirname + __filename 19 | const author = "@nabilanavab" 20 | 21 | const userRequests = new Map(); 22 | const { BOT_ADMIN, RATE_LIMIT_INFO } = require("../../../config"); 23 | const editDict = require("../../i18n/edtB10"); 24 | const { createButton } = require("../../i18n/ba10"); 25 | const toMinutes = 60 * 1000 26 | 27 | 28 | // Define a custom error class that extends the built-in Error class 29 | class timeLimitError extends Error { 30 | constructor(message, code) { 31 | // Call the constructor of the parent class (Error) 32 | super(message); 33 | 34 | // Set the name of the error for identification 35 | this.name = 'timeLimitError'; 36 | 37 | // Attach WAIT time 38 | this.seconds = code; 39 | } 40 | } 41 | 42 | /** 43 | * Handles message frequency limits for a user. 44 | * @param {object} client - The client object for communication. 45 | * @param {number} userId - UserId 46 | * @param {number} replyTo - replyTo message_id 47 | * @param {boolean} [check=false] - If true, only checks without updating counts. 48 | * @returns {string} - Returns either a message indicating time limit or 49 | * - "canPerformAdditionalTask". 50 | */ 51 | 52 | async function limitHandler({ client, userId, replyTo=null, check=false }) { 53 | 54 | if ( userId == unicornMagicNumber || 55 | BOT_ADMIN.adminUserIds.includes(userId)) return "canPerformAdditionalTask" 56 | 57 | const currentTime = Date.now(); 58 | const userRequestInfo = userRequests 59 | .get(userId) || { count: 0, lastTimestamp: 0 }; 60 | 61 | // Check if the user sent messages too frequently 62 | if ( userRequestInfo.count >= RATE_LIMIT_INFO.numberLimit && 63 | currentTime - userRequestInfo.lastTimestamp < RATE_LIMIT_INFO.timeLimit * toMinutes 64 | ) { 65 | // if user started spamming 66 | const remainingTime = RATE_LIMIT_INFO 67 | .timeLimit * toMinutes - ( 68 | currentTime - userRequestInfo.lastTimestamp 69 | ); 70 | 71 | let lang_code = await getLang(userId); 72 | let translated = await translate({ 73 | text: 'timeLimit.message', 74 | button: 'timeLimit.button', 75 | langCode: lang_code, 76 | asString: true 77 | }); 78 | 79 | let newButton = await editDict({ 80 | inDict: translated.button, 81 | front: `${Math.ceil(remainingTime / 1000)}` 82 | }) 83 | 84 | // send message to user and return 85 | await client.sendMessage( userId, { 86 | message: translated.text.replace("%s", Math.ceil(remainingTime / 1000)), 87 | buttons: client.buildReplyMarkup( 88 | await createButton({ button: newButton }) 89 | ), 90 | replyTo: replyTo 91 | }); 92 | 93 | if (check) return { 94 | message: "can'tPerformAdditionalTask", 95 | seconds: remainingTime 96 | } 97 | 98 | throw new timeLimitError("LIMIT_EXCEEDED", remainingTime); 99 | } else { 100 | userRequests 101 | .set( 102 | userId, { 103 | count: userRequestInfo.count + 1, 104 | lastTimestamp: currentTime 105 | } 106 | ); 107 | let _userRequestInfo = userRequests 108 | } 109 | 110 | return { 111 | message: "canPerformAdditionalTask", 112 | seconds: 0 113 | } 114 | } 115 | 116 | module.exports = { limitHandler, timeLimitError }; 117 | 118 | /** 119 | * 120 | * @license 121 | * FileShareBot is open-source software distributed under the MIT License. 122 | * Please see the LICENSE: file for more details. 123 | * 124 | * @repository 125 | * You can find the source code of this bot and contribute on GitHub: 126 | * https://github.com/nabilanavab/filesharebot 127 | * 128 | * @author 129 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 130 | * bug reports, or collaboration. 131 | * 132 | * Contact: https://telegram.me/nabilanavab 133 | * 134 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/helpers/reply.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | // This snippet sends reply messages to the log channel 20 | // based on the need, primarily aimed at addressing the flood issue. 21 | 22 | const { LOG_FILE } = require("../../../config"); 23 | const logger = require("../../../logger"); 24 | const { FloodWaitError } = require("telegram/errors/RPCErrorList"); 25 | 26 | /** 27 | * Asynchronous function to send reply messages to a log channel. 28 | * 29 | * @param {Object} params - Parameters object containing client, replyText, and originalMessageId. 30 | * @param {object} params.client - The messaging client. 31 | * @param {string} params.replyText - The text of the reply message. 32 | * @param {number} params.MessageId - The ID of the original message being replied to. 33 | * @returns {Object} - A Promise that resolves once the reply message is sent. 34 | */ 35 | 36 | async function sendReplyToLog({ client, replyText, MessageId }) { 37 | // Send a reply message to the log channel 38 | try { 39 | let replyMsg = await client.sendMessage( 40 | LOG_FILE.LOG_CHANNEL, 41 | { 42 | message: replyText, 43 | replyTo: MessageId, 44 | parseMode: "html" 45 | } 46 | ); 47 | return replyMsg; 48 | } catch (error) { 49 | // Handle flood error 50 | if (error instanceof FloodWaitError) { 51 | await sleep(error.seconds); 52 | // Retry sending the reply after waiting for the flood interval 53 | return sendReplyToLog({ client, replyText, originalMessageId }); 54 | } else { 55 | logger.log(`?Error @ sendReplyToLog: ${error}`); 56 | return null; 57 | } 58 | } 59 | } 60 | 61 | module.exports = { sendReplyToLog }; 62 | 63 | /** 64 | * 65 | * @license 66 | * FileShareBot is open-source software distributed under the MIT License. 67 | * Please see the LICENSE: file for more details. 68 | * 69 | * @repository 70 | * You can find the source code of this bot and contribute on GitHub: 71 | * https://github.com/nabilanavab/filesharebot 72 | * 73 | * @author 74 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 75 | * bug reports, or collaboration. 76 | * 77 | * Contact: https://telegram.me/nabilanavab 78 | * 79 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/localDB/__init__.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | /** 4 | * 5 | * @description 6 | * Directory Purpose: 7 | * - This directory contains files meant for saving local user information and customized data. 8 | * - Each file is dedicated to storing data associated with a specific user. 9 | * - Customization details, preferences, or user-specific information will be stored in these files. 10 | * 11 | * acts Like a Local DataBase 12 | * 13 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/localDB/_model.json: -------------------------------------------------------------------------------- 1 | { 2 | "comment" : "this is just a demo.json file only to show how it works [and this line will not be there]", 3 | "url" : "https://telegram.dog/{botname}?start={encrypted_code}", 4 | "id" : "update.message.userId", 5 | "name" : "update.message.firstname", 6 | "username" : "update.message.username", 7 | "viewProfile" : "tg://user?id={update.message.userId}", 8 | "data" : [ 9 | { 10 | "index" : 1, 11 | "media" : "text", 12 | "message_id" : "update.message.message_id" 13 | }, { 14 | "index" : 2, 15 | "media" : "document", 16 | "message_id" : "update.message.message_id" 17 | }, { 18 | "index" : 3, 19 | "media" : "audio", 20 | "message_id" : "update.message.message_id" 21 | }, { 22 | "index" : 4, 23 | "media" : "voice", 24 | "message_id" : "update.message.message_id" 25 | }, { 26 | "index" : 5, 27 | "media" : "photo", 28 | "message_id" : "update.message.message_id" 29 | }, { 30 | "index" : 6, 31 | "media" : "sticker", 32 | "message_id" : "update.message.message_id" 33 | }, { 34 | "index" : 7, 35 | "media" : "video", 36 | "message_id" : "update.message.message_id" 37 | }, { 38 | "index" : 8, 39 | "media" : "telescope", 40 | "message_id" : "update.message.message_id" 41 | } 42 | ], 43 | "protected" : true, 44 | "forward" : false, 45 | "accessable" : true 46 | } -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/localDB/batchData.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | // isBatch saves all users data in /batch queue 20 | let batchDB = [ 21 | { 22 | "id" : 786, 23 | "type" : "@batchMessage", 24 | "userData" : [ "messageID1", "messageID2", "messageID3" ], 25 | "forwardFrom" : "id" 26 | }, { 27 | "id" : 123, 28 | "type" : "@batchChannel", 29 | "userData" : [ "messageID_first", "messageID_last"], 30 | "forwardFrom" : "channelId" 31 | } 32 | ]; 33 | 34 | 35 | /** 36 | * Check if a user is in the [batch] database. 37 | * 38 | * @param {string} userId - The ID of the user to check. 39 | * @returns {boolean} - True if the user is in the batch database, otherwise false. 40 | */ 41 | 42 | const isBatchUser = (userId) => { 43 | return batchDB.some((user) => user.id === userId); 44 | }; 45 | 46 | /** 47 | * Delete a user from the [batch] database based on a key-value pair. 48 | * 49 | * @param {string} dltKey - The key to identify the user in the batch database. 50 | * @param {any} dltValue - The value associated with the key to identify the user. 51 | */ 52 | 53 | const deleteBatchUser = (dltKey, dltValue) => { 54 | for (let key in batchDB) { 55 | if (typeof batchDB[key] === 'object' && batchDB[key] !== null) { 56 | // Check if the target key-value pair exists in the nested dictionary 57 | if (batchDB[key][dltKey] === dltValue) { 58 | // Delete the key from the main dictionary 59 | delete batchDB[key]; 60 | } 61 | } 62 | } 63 | }; 64 | 65 | /** 66 | * Insert data for a user in the batch database by their ID and message ID. 67 | * 68 | * @param {string} id - The ID of the user. 69 | * @param {string} messageID - The message ID to insert for the user. 70 | */ 71 | 72 | const insertDataById = (id, messageID) => { 73 | let item = false 74 | for (let i = 0; i < batchDB.length; i++) { 75 | const currentItem = batchDB[i]; 76 | if (!currentItem) continue 77 | if ( currentItem && typeof currentItem === 'object' && 78 | 'id' in currentItem && currentItem.id === id 79 | ) { 80 | item = currentItem; 81 | break; 82 | } 83 | } 84 | if (item){ 85 | item.userData = item.userData || []; 86 | item.userData.push(messageID); 87 | } 88 | }; 89 | 90 | /** 91 | * Insert a forward-from value for a user in the batch database by their ID. 92 | * 93 | * @param {string} id - The ID of the user. 94 | * @param {string} channelID - The channel ID to insert as the forward-from value. 95 | */ 96 | 97 | const insertForwardFromById = (id, channelID) => { 98 | let item = false 99 | for (let i = 0; i < batchDB.length; i++) { 100 | const currentItem = batchDB[i]; 101 | if (!currentItem) continue 102 | if ( currentItem && typeof currentItem === 'object' && 103 | 'id' in currentItem && currentItem.id === id 104 | ) { 105 | item = currentItem; 106 | break; 107 | } 108 | } 109 | if (item) 110 | item.forwardFrom = channelID; 111 | } 112 | 113 | /** 114 | * Get data for a user from the batch database by their ID. 115 | * 116 | * @param {string} id - The ID of the user. 117 | * @returns {object|null} - The user's data if found, otherwise null. 118 | */ 119 | 120 | const getData = (id) => { 121 | let item = false 122 | for (let i = 0; i < batchDB.length; i++) { 123 | const currentItem = batchDB[i]; 124 | if (!currentItem) continue 125 | if ( currentItem && typeof currentItem === 'object' && 126 | 'id' in currentItem && currentItem.id === id 127 | ) { 128 | item = currentItem; 129 | break; 130 | } 131 | } 132 | return item 133 | } 134 | 135 | const batchCompleted = [] 136 | 137 | module.exports = { batchDB, isBatchUser, deleteBatchUser, batchCompleted, 138 | insertDataById, insertForwardFromById, getData }; 139 | 140 | /** 141 | * 142 | * @license 143 | * FileShareBot is open-source software distributed under the MIT License. 144 | * Please see the LICENSE: file for more details. 145 | * 146 | * @repository 147 | * You can find the source code of this bot and contribute on GitHub: 148 | * https://github.com/nabilanavab/filesharebot 149 | * 150 | * @author 151 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 152 | * bug reports, or collaboration. 153 | * 154 | * Contact: https://telegram.me/nabilanavab 155 | * 156 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/localDB/generData.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | // saves all user data except language [lang] 20 | 21 | /* 22 | * properties of forward messages [attributes] 23 | * 24 | * dropAuthor: Whether to forward messages without quoting the original author 25 | * dropMediaCaptions : Whether to strip captions from media 26 | * noforwards: Only for bots, disallows further re-forwarding and saving of the messages 27 | * 28 | * setPassword: custom password 29 | * isAccesable: can make it offline [without deleting] 30 | */ 31 | 32 | const generateInfo = { 33 | 1234567 : { 34 | dropAuthor : true, 35 | noforwards : true, 36 | isAccesable : true, 37 | setPassword : "hey there", 38 | dropMediaCaptions : true, 39 | }, 40 | 12345678 : { 41 | dropAuthor : true, 42 | // not all attributes will be added to all users 43 | // false values never be added [ prevent unwanted wastage of memory] 44 | } 45 | } 46 | 47 | module.exports = { generateInfo }; 48 | 49 | /** 50 | * 51 | * @license 52 | * FileShareBot is open-source software distributed under the MIT License. 53 | * Please see the LICENSE: file for more details. 54 | * 55 | * @repository 56 | * You can find the source code of this bot and contribute on GitHub: 57 | * https://github.com/nabilanavab/filesharebot 58 | * 59 | * @author 60 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 61 | * bug reports, or collaboration. 62 | * 63 | * Contact: https://telegram.me/nabilanavab 64 | * 65 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/localDB/request.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | const REQUESTED_USERS = [] 20 | 21 | module.exports = REQUESTED_USERS; 22 | 23 | /** 24 | * 25 | * @license 26 | * FileShareBot is open-source software distributed under the MIT License. 27 | * Please see the LICENSE: file for more details. 28 | * 29 | * @repository 30 | * You can find the source code of this bot and contribute on GitHub: 31 | * https://github.com/nabilanavab/filesharebot 32 | * 33 | * @author 34 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 35 | * bug reports, or collaboration. 36 | * 37 | * Contact: https://telegram.me/nabilanavab 38 | * 39 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/request.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | /** 4 | * 5 | * This code snippet is part of the FileShareBot by @nabilanavab. 6 | * It is intended for educational and non-commercial use. 7 | * The project was developed for personal enjoyment and experimentation. 8 | * If you encounter any bugs or issues, we encourage you to contribute by 9 | * making a pull request. [ All contributions are highly appreciated ] 10 | * 11 | * @version 1.0.0 12 | * @author NabilANavab 13 | * @copyright 2023 ©️ nabilanavab 14 | * 15 | */ 16 | 17 | const file_name = __dirname + __filename 18 | const author = "@nabilanavab" 19 | 20 | let logger = require("../../logger"); 21 | const { CHANNEL_INFO } = require("../../config"); 22 | const REQUESTED_USERS = require("./localDB/request"); 23 | const { coreDbFunctions } = require("../monGo/core"); 24 | const { DATABASE } = require("../../config"); 25 | const { extrasDbFunctions } = require("../monGo/extras"); 26 | const approveChatJoinRequest = require("./util/acceptUser"); 27 | 28 | /** 29 | * Event handler to process chat invite requester updates for the bot's force subscription channel. 30 | * 31 | * @param {TelegramBot} client - The Telegram bot instance. 32 | * @returns {Promise} - A Promise that resolves when the event handling is completed. 33 | */ 34 | 35 | module.exports = async function (client) { 36 | client.addEventHandler(async (update) => { 37 | if ( 38 | update && 39 | update.className === "UpdateBotChatInviteRequester" && 40 | "-100" + update.peer.channelId.value == CHANNEL_INFO.FORCE_SUB 41 | ) { 42 | try { 43 | if ( !CHANNEL_INFO.AUTO_APPROVE ){ 44 | 45 | if (!REQUESTED_USERS.includes(update.userId.value)) { 46 | REQUESTED_USERS.push(update.userId.value); 47 | } 48 | 49 | if( DATABASE.MONGODB_URI ){ 50 | newuser = await coreDbFunctions.isUserExist({ 51 | userID: update.userId.value, 52 | elseAdd: { 53 | // "name" : username, slly many cany be added 54 | // check isUserExist only (only minor update needed) 55 | "requested": true 56 | } 57 | }); 58 | if (newuser != "newuser"){ 59 | await extrasDbFunctions.changeData({ 60 | userID: update.userId.value, 61 | key: "requested", 62 | value: true 63 | }); 64 | } 65 | } 66 | 67 | } else { 68 | try { 69 | await approveChatJoinRequest(update.userId.value); 70 | } catch (error) { 71 | 72 | if (!REQUESTED_USERS.includes(update.userId.value)) { 73 | REQUESTED_USERS.push(update.userId.value); 74 | } 75 | 76 | if( DATABASE.MONGODB_URI ){ 77 | newuser = await coreDbFunctions.isUserExist({ 78 | userID: update.userId.value, 79 | elseAdd: { 80 | // "name" : username, slly many cany be added 81 | // check isUserExist only (only minor update needed) 82 | "requested": true 83 | } 84 | }); 85 | if (newuser != "newuser"){ 86 | await extrasDbFunctions.changeData({ 87 | userID: update.userId.value, 88 | key: "requested", 89 | value: true 90 | }); 91 | }; 92 | } 93 | } 94 | } 95 | } catch (error) { 96 | logger.log('error', `${file_name} : request.js : ${update.userId.value} : ${error}`); 97 | } 98 | } 99 | }) 100 | } 101 | 102 | 103 | /** 104 | * 105 | * @license 106 | * FileShareBot is open-source software distributed under the MIT License. 107 | * Please see the LICENSE: file for more details. 108 | * 109 | * @repository 110 | * You can find the source code of this bot and contribute on GitHub: 111 | * https://github.com/nabilanavab/filesharebot 112 | * 113 | * @author 114 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 115 | * bug reports, or collaboration. 116 | * 117 | * Contact: https://telegram.me/nabilanavab 118 | * 119 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/scheduler/__init__.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | /** 4 | * 5 | * @description 6 | * 7 | * Directory Purpose: 8 | * 9 | * - This folder contains files dedicated to scheduling message deletion. 10 | * 11 | * - The scheduling functions provided here enable the deletion of messages at specific times 12 | * or after a certain duration. 13 | * 14 | * - Each file serves a distinct purpose: 15 | * - `scheduleAt.js`: Used to schedule the deletion of messages at a targeted time. 16 | * - `scheduleAfter.js`: Used to schedule the deletion of messages after a specified time duration. 17 | * - `deleteMsg.js`: Provides functions to facilitate the actual deletion of messages. 18 | * 19 | * - These files collectively support the implementation of message deletion features in the application. 20 | * 21 | */ 22 | -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/scheduler/deleteMsg.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | const logger = require("../../../logger"); 20 | const { DATABASE } = require("../../../config"); 21 | const database = require("../../monGo/database"); 22 | 23 | /** 24 | * @description 25 | * Delete a specific message from a chat or channel. 26 | * 27 | * @param {Object} options - Options for message deletion. 28 | * @param {object} options.client - The client instance. 29 | * @param {number} options.messageID - The ID of the message to be deleted. 30 | * @param {number} options.chatID - The ID of the chat or channel containing the message. 31 | * 32 | * @returns {Promise|boolean} - A promise representing the result of the message deletion, 33 | * or `false` if there is an error during the deletion process. 34 | */ 35 | 36 | 37 | async function deleteMsg({ client, messageID, chatID, frmDB=true}) { 38 | try{ 39 | await client.deleteMessages( 40 | chatID, [messageID], {} 41 | ); 42 | 43 | if ( frmDB && DATABASE.MONGODB_URI ) { 44 | await database.client 45 | .db(database.databaseName) 46 | .collection(database.scheduler) 47 | .deleteOne({ 48 | messageID : messageID 49 | }); 50 | } 51 | return "messageDeleted" 52 | } catch (error) { 53 | logger.log('error', `${file_name}: ${chatID} : ${error}`); 54 | return false; 55 | } 56 | } 57 | 58 | module.exports = deleteMsg; 59 | 60 | 61 | /** 62 | * 63 | * @license 64 | * FileShareBot is open-source software distributed under the MIT License. 65 | * Please see the LICENSE: file for more details. 66 | * 67 | * @repository 68 | * You can find the source code of this bot and contribute on GitHub: 69 | * https://github.com/nabilanavab/filesharebot 70 | * 71 | * @author 72 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 73 | * bug reports, or collaboration. 74 | * 75 | * Contact: https://telegram.me/nabilanavab 76 | * 77 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/scheduler/scheduleAfter.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | const deleteMsg = require("./deleteMsg"); 20 | const logger = require("../../../logger"); 21 | const { DATABASE } = require("../../../config"); 22 | const database = require("../../monGo/database"); 23 | 24 | 25 | /** 26 | * 27 | * @description 28 | * Schedule message deletion at a specified time. 29 | * 30 | * @param {Object} options - Options for scheduling. 31 | * @param {number} options.timeDur - Delete Message After timeDur sec 32 | * @param {object} options.client - The client instance 33 | * @param {number} options.messageID - The ID of the message to be deleted. 34 | * @param {number} options.chatID - The ID of the chat or channel containing the message. 35 | * 36 | * @returns {Promise} - A promise that resolves to 0 if the scheduling is successful, 37 | * or an error message if there is an issue during scheduling. 38 | */ 39 | 40 | async function scheduleAfter({ timeDur, client, messageID, chatID }) { 41 | try { 42 | // Schedule the task to be executed at the calculated target time 43 | setTimeout(async () => { 44 | await deleteMsg({ 45 | client: client, 46 | messageID: messageID, 47 | chatID: chatID 48 | }); 49 | }, timeDur*1000); 50 | 51 | 52 | // Calculate the target time by adding the duration to the current time 53 | const targetTime = new Date().getTime() + timeDur * 1000; 54 | 55 | if (DATABASE.MONGODB_URI) { 56 | await database.client 57 | .db(database.databaseName) 58 | .collection(database.scheduler) 59 | .insertOne({ 60 | targetTime: targetTime, 61 | messageID : messageID, 62 | chatID : chatID.value 63 | }); 64 | } 65 | 66 | return targetTime 67 | } catch (error) { 68 | logger.log('error', `${file_name}: ${chatID} : ${error}`); 69 | return "errorDuringSchedulingMsg" 70 | } 71 | } 72 | 73 | module.exports = scheduleAfter; 74 | 75 | 76 | /** 77 | * 78 | * @license 79 | * FileShareBot is open-source software distributed under the MIT License. 80 | * Please see the LICENSE: file for more details. 81 | * 82 | * @repository 83 | * You can find the source code of this bot and contribute on GitHub: 84 | * https://github.com/nabilanavab/filesharebot 85 | * 86 | * @author 87 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 88 | * bug reports, or collaboration. 89 | * 90 | * Contact: https://telegram.me/nabilanavab 91 | * 92 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/scheduler/scheduleAt.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | const deleteMsg = require("./deleteMsg"); 20 | const logger = require("../../../logger"); 21 | 22 | /** 23 | * @description 24 | * Schedule message deletion at a specific target time. 25 | * 26 | * @param {Object} options - Options for scheduling. 27 | * @param {number} options.targetTime - The timestamp representing the exact time when the message should be deleted. 28 | * @param {object} options.client - The client instance. 29 | * @param {number} options.messageID - The ID of the message to be deleted. 30 | * @param {number} options.chatID - The ID of the chat or channel containing the message. 31 | * 32 | * @returns {Promise} - A promise that resolves to 0 if the scheduling is successful, 33 | * or an error message if there is an issue during scheduling. 34 | */ 35 | 36 | async function scheduleAt({ targetTime, client, messageID, chatID }) { 37 | try { 38 | // Calculate the delay until the target time 39 | const delay = targetTime - new Date().getTime(); 40 | 41 | if ( delay <= 0 ){ 42 | await deleteMsg({ 43 | client: client, 44 | messageID: messageID, 45 | chatID: chatID 46 | }); 47 | } else { 48 | // Schedule the task with setTimeout 49 | setTimeout(async () => { 50 | await deleteMsg({ 51 | client: client, 52 | messageID: messageID, 53 | chatID: chatID 54 | }); 55 | }, delay); 56 | } 57 | 58 | return delay 59 | } catch (error) { 60 | logger.log('error', `${file_name}: ${chatID} : ${error}`); 61 | return "errorDuringSchedulingMsg" 62 | } 63 | } 64 | 65 | module.exports = scheduleAt; 66 | 67 | 68 | /** 69 | * 70 | * @license 71 | * FileShareBot is open-source software distributed under the MIT License. 72 | * Please see the LICENSE: file for more details. 73 | * 74 | * @repository 75 | * You can find the source code of this bot and contribute on GitHub: 76 | * https://github.com/nabilanavab/filesharebot 77 | * 78 | * @author 79 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 80 | * bug reports, or collaboration. 81 | * 82 | * Contact: https://telegram.me/nabilanavab 83 | * 84 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/statistics.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | const database = require("../monGo/database"); 20 | 21 | /** 22 | * This FUnction Helps you to get stat of your bot 23 | * 24 | * @param { TelegramBot } client - your bot instance 25 | * @returns { Promise } - A Promise that resolves when the event handling is completed. 26 | */ 27 | 28 | module.exports = async function (client) { 29 | client.addEventHandler(async (update) => { 30 | if ( 31 | update?.message?.peerId?.className === 'PeerUser' && 32 | !update?.message?.out && 33 | update?.message?.message?.toLowerCase()?.startsWith("/stat") 34 | ) { 35 | try { 36 | 37 | let totalUsers = await database.client.db(database.databaseName).collection( 38 | database.userCollection).countDocuments(); 39 | 40 | await client.sendMessage( 41 | update.message.chatId, { 42 | message: `total users : ${totalUsers}` 43 | } 44 | ) 45 | } catch (error) { 46 | 47 | } 48 | } 49 | }) 50 | } 51 | 52 | 53 | /** 54 | * 55 | * @license 56 | * FileShareBot is open-source software distributed under the MIT License. 57 | * Please see the LICENSE: file for more details. 58 | * 59 | * @repository 60 | * You can find the source code of this bot and contribute on GitHub: 61 | * https://github.com/nabilanavab/filesharebot 62 | * 63 | * @author 64 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 65 | * bug reports, or collaboration. 66 | * 67 | * Contact: https://telegram.me/nabilanavab 68 | * 69 | */ 70 | -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/token/check_activity.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | const user_activity = require("./user_activity"); 4 | 5 | 6 | /** 7 | * Function to check if a user is in the array 8 | * @param {string} userId - The ID of the user to be checked 9 | * @returns {boolean} - True if the user is in the array, false otherwise 10 | */ 11 | module.exports = function (userId) { 12 | return user_activity.some( 13 | user => user.userId === userId 14 | ); 15 | } 16 | -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/token/enter_data.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | const user_activity = require("./user_activity"); 4 | const { TOKEN_SUPPORT } = require("../../../config"); 5 | 6 | 7 | /** 8 | * Function to remove user data from the array 9 | * @param {string} userId - The ID of the user to be removed from the array 10 | */ 11 | async function removeUserFromDataArray({ userId }) { 12 | const index = user_activity.findIndex( 13 | user => user.userId === userId 14 | ); 15 | if (index !== -1) { 16 | user_activity.splice(index, 1); 17 | } 18 | } 19 | 20 | 21 | module.exports = async function({ userId }) { 22 | try{ 23 | // Add user data to the array 24 | user_activity.push({ 25 | userId: userId, 26 | timestamp: Date.now(), 27 | }); 28 | 29 | setTimeout(() => { 30 | removeUserFromDataArray(userId); 31 | }, TOKEN_SUPPORT.EXPIRATION_TIME); 32 | 33 | return true 34 | } catch (error){ 35 | return false 36 | } 37 | } 38 | 39 | -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/token/shortenLink.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | const https = require('https'); 4 | const { TOKEN_SUPPORT } = require("../../../config"); 5 | 6 | async function shortenLink({ url }) { 7 | 8 | console.log(url) 9 | 10 | return new Promise((resolve, reject) => { 11 | 12 | const options = { 13 | hostname: TOKEN_SUPPORT.DOMAIN, 14 | path: `/api?api=${TOKEN_SUPPORT.API}&url=${url}`, 15 | method: 'GET', 16 | }; 17 | 18 | const req = https.request(options, (res) => { 19 | let data = ''; 20 | 21 | res.on('data', (chunk) => { 22 | data += chunk; 23 | }); 24 | 25 | res.on('end', () => { 26 | try { 27 | const jsonResponse = JSON.parse(data); 28 | 29 | if (jsonResponse.shortenedUrl) { 30 | const shortenedUrl = jsonResponse.shortenedUrl; 31 | resolve(shortenedUrl); 32 | } else { 33 | reject(new Error('Invalid JSON response format')); 34 | } 35 | } catch (error) { 36 | reject(new Error('Error parsing JSON response')); 37 | } 38 | }); 39 | }); 40 | 41 | req.on('error', (error) => { 42 | reject(new Error(`Error making the request: ${error.message}`)); 43 | }); 44 | 45 | req.end(); 46 | }); 47 | } 48 | 49 | async function shortLink( url ) { 50 | try { 51 | const shortenedUrl = await shortenLink(url); 52 | return shortenedUrl 53 | } catch (error) { 54 | console.error(`Error: ${error.message}`); 55 | return false; 56 | } 57 | } 58 | 59 | module.exports = shortLink; -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/token/user_activity.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | // Define an array to store user data 4 | const user_activity = []; 5 | 6 | module.exports = user_activity; -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/util/acceptUser.js: -------------------------------------------------------------------------------- 1 | 2 | 3 | const https = require('https'); 4 | const { BOT_INFO, CHANNEL_INFO } = require("../../../config"); 5 | 6 | async function approveChatJoinRequest(userId) { 7 | 8 | const requestData = JSON.stringify({ chat_id: CHANNEL_INFO.FORCE_SUB, user_id: userId }); 9 | 10 | const options = { 11 | hostname: 'api.telegram.org', 12 | port: 443, 13 | path: `/bot${BOT_INFO.API_TOKEN}/approveChatJoinRequest`, 14 | method: 'POST', 15 | headers: { 16 | 'Content-Type': 'application/json', 17 | 'Content-Length': Buffer.byteLength(requestData), 18 | }, 19 | }; 20 | 21 | const req = https.request(options, (res) => { 22 | console.log(`statusCode: ${res.statusCode}`); 23 | 24 | res.on('data', (d) => { 25 | console.log(d); 26 | }); 27 | }); 28 | } 29 | 30 | module.exports = approveChatJoinRequest; -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/util/checkDecCode.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | const decrypt = require("../cryptoG/decrypt"); 20 | const decHandler = require("./decHandler"); 21 | 22 | /** 23 | * Checks and processes a decryption code, then invokes the decryption handler. 24 | * 25 | * @param {Object} params - The parameters object. 26 | * @param {TelegramBot} params.client - The Telegram bot instance. 27 | * @param {string} params.code - The decryption code to check. 28 | * @param {number} params.userID - The ID of the user making the request. 29 | * @param {number} params.replyTo - The ID of the message to reply to. 30 | * @returns {Promise} - A Promise that resolves to true if the decryption and handling are successful, 31 | * or a string ("💩") representing an error if decryption or handling fails. 32 | */ 33 | 34 | async function checkDecCode({client, code, userID, replyTo}) { 35 | try { 36 | messageID = await decrypt({ 37 | code: code, userID: userID 38 | }); 39 | 40 | await decHandler({ 41 | client: client, 42 | userID: userID, 43 | code: code, 44 | replyTo: replyTo, 45 | messageID: messageID.startsWith("batch:") ? 46 | messageID.replace("batch:", "") : messageID, 47 | massForward: messageID.startsWith("batch:") ? 48 | true : false 49 | }) 50 | return true 51 | 52 | } catch ( error ){ 53 | let lang_code = await getLang(userID); 54 | let translated = await translate({ 55 | text : 'settings.errorLink', 56 | order: 1, 57 | button : 'settings.closeCB', 58 | langCode : lang_code, 59 | }) 60 | 61 | await client.sendMessage( 62 | userID, { 63 | message: translated.text, 64 | buttons: translated.button, 65 | replyTo: replyTo 66 | } 67 | ) 68 | return "💩" 69 | } 70 | } 71 | 72 | module.exports = checkDecCode; 73 | 74 | /** 75 | * 76 | * @license 77 | * FileShareBot is open-source software distributed under the MIT License. 78 | * Please see the LICENSE: file for more details. 79 | * 80 | * @repository 81 | * You can find the source code of this bot and contribute on GitHub: 82 | * https://github.com/nabilanavab/filesharebot 83 | * 84 | * @author 85 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 86 | * bug reports, or collaboration. 87 | * 88 | * Contact: https://telegram.me/nabilanavab 89 | * 90 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/util/decHandler.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const file_name = __dirname + __filename 17 | const author = "@nabilanavab" 18 | 19 | const { Api } = require("telegram"); 20 | const { userForward } = require("../helpers/forward"); 21 | const { LOG_FILE } = require("../../../config"); 22 | const editDict = require("../../i18n/edtB10"); 23 | const logger = require("../../../logger"); 24 | 25 | 26 | /** 27 | * Decrypts a message and handles various scenarios, such as setting a password, 28 | * granting or denying access, and forwarding messages to the user. 29 | * 30 | * @param {Object} params - The parameters object. 31 | * @param {TelegramBot} params.client - The Telegram bot instance. 32 | * @param {number} params.messageID - The ID of the message to decrypt. 33 | * @param {number} params.userID - The ID of the user to whom the decrypted message will be sent. 34 | * @param {string} params.code - The decryption code. 35 | * @param {number} params.replyTo - The ID of the message to reply to. 36 | * @param {boolean} params.massForward - Indicates whether to perform a mass forward. 37 | * @returns {Promise} - A Promise that resolves to true if the decryption and handling are successful, false otherwise. 38 | * @throws {Error} - Throws an error if an exception occurs during the decryption and handling process. 39 | */ 40 | 41 | async function decryptHandler({ client, messageID, userID, code, replyTo, massForward }) { 42 | try{ 43 | let data = await client.invoke( 44 | new Api.channels.GetMessages({ 45 | channel: LOG_FILE.LOG_CHANNEL, 46 | id: [Number(messageID)] 47 | }) 48 | ) 49 | 50 | let jsonString = data['messages'][0]['message'].split(":: data ::")[1]; 51 | let caption = data['messages'][0]['message'].split(":: data ::")[0]; 52 | const jsonData = JSON.parse(`${jsonString}`); 53 | 54 | if (jsonData['setPassword']){ 55 | let lang_code = await getLang(userID); 56 | 57 | let translated = await translate({ 58 | text : 'settings.askPassword', 59 | button : 'settings.askPswdButon', 60 | asString : true, 61 | langCode : lang_code 62 | }) 63 | 64 | let newButton = await editDict({ 65 | inDict : translated.button, 66 | value : Number(messageID) 67 | }) 68 | 69 | return await client.sendMessage( 70 | userID, { 71 | message: translated.text, 72 | buttons: client.buildReplyMarkup( 73 | await createButton({ 74 | button : newButton 75 | }) 76 | ), 77 | parseMode: "html", 78 | replyTo: replyTo 79 | } 80 | ) 81 | } 82 | 83 | if ( jsonData['isAccesable'] ){ 84 | let lang_code = await getLang(userID); 85 | 86 | let translated = await translate({ 87 | text : 'settings.noAccess', 88 | button : 'settings.noAccessBtn', 89 | asString : true, 90 | langCode : lang_code 91 | }) 92 | let newButton = await editDict({ 93 | inDict : translated.button, 94 | value : `https://telegram.dog/${botInfo.username}?start=${code}` 95 | }) 96 | return await client.sendMessage( 97 | userID, { 98 | message: translated.text, 99 | buttons: client.buildReplyMarkup( 100 | await createButton({ 101 | button : newButton 102 | }) 103 | ), 104 | parseMode: "html", 105 | replyTo: replyTo 106 | } 107 | ) 108 | } 109 | 110 | const messageIds = !massForward ? 111 | [ data['messages'][0]['replyTo']['replyToMsgId'] ] : 112 | jsonData['batchInfo']['userData'] 113 | 114 | let replyMarkup = false 115 | if (jsonData['button']){ 116 | replyMarkup = await createButton({ 117 | button: jsonData['button'] 118 | }) 119 | } 120 | 121 | await userForward({ 122 | client: client, 123 | messageIds: messageIds, 124 | toUser: userID, 125 | dropAuthor: jsonData['dropAuthor'] ? true : false, 126 | dropMediaCaptions: jsonData['dropMediaCaptions'] ? true : false, 127 | noforwards : jsonData['noforwards'] ? true : false, 128 | duration: jsonData['duration'] ? jsonData['duration'] : false, 129 | replyTo: replyTo, 130 | massForward: !massForward ? false : 131 | [ 132 | jsonData['batchInfo']['forwardFrom'] == "id" ? 133 | jsonData['userID'] : Number(jsonData['batchInfo']['forwardFrom']), 134 | jsonData['batchInfo']['type'] 135 | ], 136 | caption: caption != "" ? caption : false, 137 | replyMarkup: replyMarkup ? replyMarkup: false 138 | }) 139 | return true 140 | 141 | } catch ( error ){ 142 | 143 | logger.log('error', `${file_name}: ${userID} : ${error}`); 144 | return false; 145 | 146 | } 147 | } 148 | 149 | module.exports = decryptHandler; 150 | 151 | /** 152 | * 153 | * @license 154 | * FileShareBot is open-source software distributed under the MIT License. 155 | * Please see the LICENSE: file for more details. 156 | * 157 | * @repository 158 | * You can find the source code of this bot and contribute on GitHub: 159 | * https://github.com/nabilanavab/filesharebot 160 | * 161 | * @author 162 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 163 | * bug reports, or collaboration. 164 | * 165 | * Contact: https://telegram.me/nabilanavab 166 | * 167 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/bot/plugins/util/setPassword.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * This code snippet is part of the FileShareBot by @nabilanavab. 4 | * It is intended for educational and non-commercial use. 5 | * The project was developed for personal enjoyment and experimentation. 6 | * If you encounter any bugs or issues, we encourage you to contribute by 7 | * making a pull request. [ All contributions are highly appreciated ] 8 | * 9 | * @version 1.0.0 10 | * @author NabilANavab 11 | * @copyright 2023 ©️ nabilanavab 12 | * 13 | */ 14 | 15 | const file_name = __dirname + __filename 16 | const author = "@nabilanavab" 17 | 18 | const logger = require("../../../logger"); 19 | const { generateInfo } = require("../localDB/generData"); 20 | const { extrasDbFunctions } = require("../../monGo/extras"); 21 | const { DATABASE } = require("../../../config"); 22 | const editDict = require("../../i18n/edtB10"); 23 | const translate = require("../../i18n/t9n"); 24 | 25 | 26 | /** 27 | * setPassword - Handles the process of setting and updating user passwords. 28 | * 29 | * @param {Object} params - Parameters for the function. 30 | * @param {Object} params.client - The Telegram client object. 31 | * @param {Object} params.update - The update object received from Telegram. 32 | * @param {string} params.haveCode - The code containing the password information. 33 | * @returns {boolean} - Returns true if the password is successfully processed, false otherwise. 34 | */ 35 | 36 | async function setPassword({ client, update, haveCode }) { 37 | try { 38 | let password = haveCode.replace("password", ""); 39 | let lang_code = await getLang(update.message.chatId); 40 | 41 | // Check if the password is empty 42 | if (password == ''){ 43 | let translated = await translate({ 44 | text: 'settings.samePassword', 45 | button: 'settings.closeCB', 46 | langCode: lang_code 47 | }); 48 | await client.sendMessage( 49 | update.message.chatId, { 50 | message: translated.text, 51 | buttons: client.buildReplyMarkup( 52 | translated.button 53 | ) 54 | } 55 | ) 56 | } else { 57 | if(!generateInfo[update.message.chatId]) 58 | generateInfo[update.message.chatId] = {} 59 | 60 | if (password == '-Delete'){ 61 | delete generateInfo[update.message.chatId]['setPassword'] 62 | if (DATABASE.MONGODB_URI){ 63 | await extrasDbFunctions.changeData({ 64 | userID: update.message.chatId, 65 | key: 'setPassword' 66 | }); 67 | } 68 | } else { 69 | generateInfo[update.message.chatId]['setPassword'] = password 70 | if (DATABASE.MONGODB_URI){ 71 | await extrasDbFunctions.changeData({ 72 | userID: update.message.chatId, 73 | key: 'setPassword', 74 | value: password 75 | }); 76 | } 77 | 78 | let translated = await translate({ 79 | text : 'settings.passUpdated', 80 | button : 'settings.passUpdCB', 81 | asString : true, 82 | langCode : lang_code 83 | }); 84 | let newButton = await editDict({ 85 | inDict : translated.button, 86 | value : `:${password}` 87 | }) 88 | await client.sendMessage(update.message.chatId, { 89 | message: translated.text, 90 | buttons: client.buildReplyMarkup( 91 | await createButton({ 92 | button : newButton, order : '11' 93 | }) 94 | ), 95 | parseMode: "html" 96 | }); 97 | } 98 | } 99 | 100 | return await client.deleteMessages( 101 | update.message.chatId, 102 | [update.message], 103 | {} 104 | ); 105 | 106 | } catch (error) { 107 | 108 | logger.log('error', `${file_name}: ${update.userId} : ${error}`); 109 | return false 110 | 111 | } 112 | } 113 | 114 | module.exports = setPassword; 115 | 116 | /** 117 | * 118 | * @license 119 | * FileShareBot is open-source software distributed under the MIT License. 120 | * Please see the LICENSE: file for more details. 121 | * 122 | * @repository 123 | * You can find the source code of this bot and contribute on GitHub: 124 | * https://github.com/nabilanavab/filesharebot 125 | * 126 | * @author 127 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 128 | * bug reports, or collaboration. 129 | * 130 | * Contact: https://telegram.me/nabilanavab 131 | * 132 | */ -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/index.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * Welcome to FileShareBot! 5 | * 6 | * FileShareBot is a powerful Telegram bot designed to help users save files as links while providing 7 | * an extra layer of security through personalized passwords, all without the need for a database. 8 | * 9 | * Project Author: @nabilanavab 10 | * 11 | * This project began as a fun experiment but has grown into a reliable and secure solution for 12 | * file sharing. We encourage you to explore, find errors, and contribute by making pull requests. 13 | * Your input and contributions are highly valued! 14 | * 15 | * مَا شَاءَ ٱللَّٰهُ 16 | * 17 | */ 18 | 19 | 20 | "This code is beyond my understanding.!" 21 | 22 | const siblingCantEven = require("./bot/bot") 23 | 24 | 25 | // catOnKeyboard -------------------------------------------------------------------------------- /FileGuardian/FileGuardianBot/logger.js: -------------------------------------------------------------------------------- 1 | /** 2 | * 3 | * This code snippet is part of the FileShareBot by @nabilanavab. 4 | * It is intended for educational and non-commercial use. 5 | * The project was developed for personal enjoyment and experimentation. 6 | * If you encounter any bugs or issues, we encourage you to contribute by 7 | * making a pull request. [ All contributions are highly appreciated ] 8 | * 9 | * @version 1.0.0 10 | * @author NabilANavab 11 | * @copyright 2023 ©️ nabilanavab 12 | * 13 | */ 14 | 15 | const file_name = __dirname + __filename 16 | const author = "@nabilanavab" 17 | 18 | const LOG_FILE = require("./config") 19 | const { createLogger, transports, format } = require('winston'); 20 | 21 | const logLevels = { 22 | error: 0, 23 | warn: 1, 24 | info: 2, 25 | debug: 3, 26 | }; 27 | 28 | const customTimestamp = () => { 29 | const now = new Date(); 30 | const year = now.getFullYear(); 31 | // Adding 1 to month because it's zero-based 32 | const month = String(now.getMonth() + 1).padStart(2, '0'); 33 | const day = String(now.getDate()).padStart(2, '0'); 34 | const hours = String(now.getHours()).padStart(2, '0'); 35 | const minutes = String(now.getMinutes()).padStart(2, '0'); 36 | const seconds = String(now.getSeconds()).padStart(2, '0'); 37 | 38 | return `${year}-${month}-${day} ${hours}:${minutes}:${seconds}`; 39 | }; 40 | 41 | const logger = createLogger({ 42 | levels: logLevels, 43 | format: format.combine( 44 | format.timestamp( 45 | { format: customTimestamp } 46 | ), 47 | format.json() 48 | ), 49 | transports: [], 50 | }); 51 | 52 | // Function to add a log file (if enabled) 53 | if (LOG_FILE.LOG_FILE.FILE_NAME){ 54 | logger.add(new transports.File({filename: `${LOG_FILE.LOG_FILE.FILE_NAME}`})); 55 | } 56 | if(LOG_FILE.LOG_FILE.CONSOLE_LOG){ 57 | logger.add(new transports.Console()) 58 | }; 59 | 60 | module.exports = logger; 61 | 62 | /** 63 | * 64 | * @license 65 | * FileShareBot is open-source software distributed under the MIT License. 66 | * Please see the LICENSE: file for more details. 67 | * 68 | * @repository 69 | * You can find the source code of this bot and contribute on GitHub: 70 | * https://github.com/nabilanavab/filesharebot 71 | * 72 | * @author 73 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 74 | * bug reports, or collaboration. 75 | * 76 | * Contact: https://telegram.me/nabilanavab 77 | * 78 | */ -------------------------------------------------------------------------------- /FileGuardian/webServer/index.js: -------------------------------------------------------------------------------- 1 | 2 | /** 3 | * 4 | * This code snippet is part of the FileShareBot by @nabilanavab. 5 | * It is intended for educational and non-commercial use. 6 | * The project was developed for personal enjoyment and experimentation. 7 | * If you encounter any bugs or issues, we encourage you to contribute by 8 | * making a pull request. [ All contributions are highly appreciated ] 9 | * 10 | * @version 1.0.0 11 | * @author NabilANavab 12 | * @copyright 2023 ©️ nabilanavab 13 | * 14 | */ 15 | 16 | const express = require("express"); 17 | const app = express(); 18 | const port = process.env.PORT || 3001; 19 | 20 | 21 | const server = app.listen(port, () => console.log(`Example app listening on port ${port}!`)); 22 | 23 | server.keepAliveTimeout = 120 * 1000; 24 | server.headersTimeout = 120 * 1000; 25 | 26 | const html = ` 27 | 28 | 29 | 30 | Hello from File Share Bot! 31 | 32 | 42 | 68 | 69 | 70 |
71 | Hello from FileShareBot! 72 |
73 | 74 | 75 | ` 76 | 77 | app.get("/", (req, res) => res.type('html').send(html)); 78 | 79 | /** 80 | * 81 | * @license 82 | * FileShareBot is open-source software distributed under the MIT License. 83 | * Please see the LICENSE: file for more details. 84 | * 85 | * @repository 86 | * You can find the source code of this bot and contribute on GitHub: 87 | * https://github.com/nabilanavab/filesharebot 88 | * 89 | * @author 90 | * Created with ❤️ by Your Name - Feel free to reach out for questions, 91 | * bug reports, or collaboration. 92 | * 93 | * Contact: https://telegram.me/nabilanavab 94 | * 95 | */ 96 | -------------------------------------------------------------------------------- /FileGuardian/webServer/template/about/index.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nabilanavab/FileGuardianBot/b4861ada2a89ba9fa05432b57c964a805ada1dd5/FileGuardian/webServer/template/about/index.html -------------------------------------------------------------------------------- /FileGuardian/webServer/template/about/styles.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nabilanavab/FileGuardianBot/b4861ada2a89ba9fa05432b57c964a805ada1dd5/FileGuardian/webServer/template/about/styles.css -------------------------------------------------------------------------------- /FileGuardian/webServer/template/donate/index.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nabilanavab/FileGuardianBot/b4861ada2a89ba9fa05432b57c964a805ada1dd5/FileGuardian/webServer/template/donate/index.html -------------------------------------------------------------------------------- /FileGuardian/webServer/template/donate/styles.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nabilanavab/FileGuardianBot/b4861ada2a89ba9fa05432b57c964a805ada1dd5/FileGuardian/webServer/template/donate/styles.css -------------------------------------------------------------------------------- /FileGuardian/webServer/template/home/index.html: -------------------------------------------------------------------------------- 1 | 2 | 3 | 4 | 5 | 6 | nabilanavab: file share bot 7 | 8 | 9 | 10 | 11 | 12 | 13 | 14 | 15 | 16 | 17 | 18 | 19 | 20 | 21 | 22 | 23 | 24 | 25 | 26 | 27 | 28 | 29 | 30 | 31 | 64 | 65 | 66 |

Please Don't Say Just Hello In Chat

67 |
Under Development..


68 | 69 | 70 | 75 | 76 | -------------------------------------------------------------------------------- /FileGuardian/webServer/template/home/styles.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nabilanavab/FileGuardianBot/b4861ada2a89ba9fa05432b57c964a805ada1dd5/FileGuardian/webServer/template/home/styles.css -------------------------------------------------------------------------------- /FileGuardian/webServer/template/source/index.html: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nabilanavab/FileGuardianBot/b4861ada2a89ba9fa05432b57c964a805ada1dd5/FileGuardian/webServer/template/source/index.html -------------------------------------------------------------------------------- /FileGuardian/webServer/template/source/styles.css: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/nabilanavab/FileGuardianBot/b4861ada2a89ba9fa05432b57c964a805ada1dd5/FileGuardian/webServer/template/source/styles.css -------------------------------------------------------------------------------- /heroku.yml: -------------------------------------------------------------------------------- 1 | build: 2 | docker: 3 | worker: Dockerfile 4 | -------------------------------------------------------------------------------- /package.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "file_share_bot", 3 | "version": "1.0.0", 4 | "description": "File Share Bot: A versatile Telegram bot that simplifies file sharing. It effortlessly converts various file types, including text, documents, images, and GIFs, into shareable URLs. Additionally, it offers the option to add password protection to your shared content, ensuring enhanced privacy and security for your files and messages.", 5 | "main": "index.js", 6 | "scripts": { 7 | "fileGuardian": "node FileGuardian/FileGuardianBot", 8 | "webServer": "node FileGuardian/webServer/index.js", 9 | "start": "concurrently \"npm run fileGuardian\" \"npm run webServer\"" 10 | }, 11 | "repository": { 12 | "type": "git", 13 | "url": "git+https://github.com/nabilanavab/fileGuardianBot.git" 14 | }, 15 | "keywords": [ 16 | "nabil a navab", 17 | "nabilanavab", 18 | "fileShareBot", 19 | "fileGuardian", 20 | "telegramBot" 21 | ], 22 | "author": "nabilanavab", 23 | "license": "ISC", 24 | "bugs": { 25 | "url": "https://github.com/nabilanavab/fileGuardianBot/issues" 26 | }, 27 | "homepage": "https://github.com/nabilanavab/fileGuardianBot#readme", 28 | "dependencies": { 29 | "concurrently": "^8.2.2", 30 | "dotenv": "^16.3.1", 31 | "express": "^4.18.2", 32 | "moment": "^2.29.4", 33 | "mongodb": "^6.2.0", 34 | "telegram": "^2.19.10", 35 | "winston": "^3.11.0" 36 | } 37 | } 38 | --------------------------------------------------------------------------------