diff --git a/README.md b/README.md index 8bc5ef2..0965927 100644 --- a/README.md +++ b/README.md @@ -68,6 +68,12 @@ python3 telegramShellBot.py & (this will run the script in backgrou ![alt tag](/readme_images/image4.png) +## Sending and receiving files +To send files just drag and drop on the chat, or click on send file button (images must be sent this way). +To download files from the computer use "getfile + path" (e.g. getfile /home/user/Desktop/test-file.txt). + +![alt tag](/readme_images/gif2.gif) + ## Version history Check [project releases](https://github.com/EnriqueMoran/remoteTelegramShell/releases) for more info. @@ -80,4 +86,12 @@ Check [project releases](https://github.com/EnriqueMoran/remoteTelegramShell/rel - **v1.0:** (6/21/18) Official release. Critical and minor bug fixed. New forbidden commands added. - **v1.1.2:** (3/8/19) Typo correction, top command added, Telegram API 400 Bad Request error fixed. - **v1.2.0:** (1/25/20) Install and uninstall package infinite loop fixed, config.txt and readme modified. -- **v1.2.1:** (1/26/20) Update and upgrade system infinite loop fixed, config parameters checker added. \ No newline at end of file +- **v1.2.1:** (1/26/20) Update and upgrade system infinite loop fixed, config parameters checker added. +- **v1.3.1:** (6/12/20) File sending and receiving feature added. + + + + +todo: agregar la sharedfolder +hacer que se puedan eliminar usuarios desde telegram, que salga bonito, etc +hacer que el loglimit funcione \ No newline at end of file diff --git a/config.txt b/config.txt index d552214..c74cb4e 100644 --- a/config.txt +++ b/config.txt @@ -5,14 +5,14 @@ # this file and fill the following parameters in order to correctly configure the program. -# File sharing folder - Absolute path to file sharing folder. All files sent through -# drag and drop will be stored there, dont choose a root-protected one. -shareFolder = ./shareFolder +# File sharing folder - Absolute path to file sharing folder (ending in slash). All files +# sent through drag and drop will be stored there, dont choose a root-protected one. +shareFolder = ./shareFolder/ # Version - This parameter is automatically filled. Current version will be shown on /help # option. Please do not modify. -version = v1.3.0 +version = v1.3.1 # TOKEN - This is bot auth token, necessary to connect bot to Telegram device. diff --git a/readme_images/gif2.gif b/readme_images/gif2.gif new file mode 100644 index 0000000..00cdaaf Binary files /dev/null and b/readme_images/gif2.gif differ diff --git a/telegramShellBot.py b/telegramShellBot.py index 205c652..d4a90ab 100644 --- a/telegramShellBot.py +++ b/telegramShellBot.py @@ -115,7 +115,8 @@ def checkConfig(message): if ROOT == "": error = True error_msg += "\n- Root field is empty." - bot.send_message(message.chat.id, error_msg) + if error: + bot.send_message(message.chat.id, error_msg) return error @@ -410,10 +411,10 @@ def run(message): def saveDoc(doc): fileInfo = bot.get_file(doc.document.file_id) downloadedFile = bot.download_file(fileInfo.file_path) - filepath = SHAREFOLDER + '\\' + doc.document.file_name - with open(filepath, 'wb') as newFile: + filePath = SHAREFOLDER + doc.document.file_name + with open(filePath, 'wb') as newFile: newFile.write(downloadedFile) - bot.send_message(message.chat.id,"File received.") + bot.send_message(doc.chat.id,f"File saved as {filePath}") @bot.message_handler(content_types=['photo']) def savePhoto(doc):