How I built a Telegram bot to manage my files privately

If you’ve ever wished for a simple way to store, search, retrieve and manage files — all via a chat interface — you’ll appreciate what this project enables. Meet my_personal_tg_assistant, a lightweight Telegram-bot built with aiogram that turns your Telegram account into your own secure file-storage “assistant”.

What it does

Here are the standout features:

  • Access control: Only a predefined Telegram user ID can interact with the bot — meaning it’s your ‘private assistant’.
  • Auto-storage: You send text, images, videos, documents, and the bot automatically saves them locally in a storage folder.
  • Multi-format support: The bot handles JPG, PNG, WEBP, MP4, AVI, MOV, TXT, and more.
  • Search & retrieve: You can issue commands to search by keyword, fetch stored files, overview your stored items, or delete files.
  • Easy to extend: The README notes that future integration with 3rd-party APIs (for instance, OpenAI) is feasible.

Why this matters

In our daily digital lives we often send ourselves files or rely on cloud storage services — but there are drawbacks: privacy concerns, cost, limited control, dependency on third-party platforms. With this bot you get:

  • Full control: Your files are saved locally (on your server or machine) rather than locked into a commercial cloud with opaque policies.
  • Seamless interaction: Since you already use Telegram, you don’t need to learn a whole new UI — you chat, you store, you search.
  • Flexibility: It’s open source (MIT-licensed) so you can inspect, modify, extend.
  • Simplicity: The core idea is elegant yet practical. A few commands handle a lot of functionality.

Use-cases & ideas for extension

  • Personal file archive: Keep all your random docs/images/videos in one place and access them through Telegram.
  • Private media backup: If you want to store personal photos/videos locally instead of a cloud.
  • Meeting notes & snippets: Send text to the bot and retrieve later via search.
  • Team variants: Extend it so a group of authorized users can access (with more complex permissions).
  • AI integration: Combine with an AI (via OpenAI, etc) to summarise stored files, tag them, analyse them. The README suggests this is “future-ready”.
  • Cloud sync: While the current setup stores locally, you could extend it to sync with cloud storage like S3, Google Drive, etc.

Some thoughts & tips

  • Make sure to secure the server where you run the bot: since it’s accepting files, you want to ensure only authorized use and protect against malicious uploads.
  • Adapt the storage folder path (and maybe add quotas) so you don’t exhaust disk space.
  • Consider logging and monitoring: track how many files, disk usage, etc.
  • For larger scale: add pagination for /overview, or implement a more powerful search (by date, file type, tags).
  • Backup your local_storage periodically (especially if you rely on it).
  • If you plan to run this publicly (beyond personal use), add proper user-management, authentication, maybe encryption.

Final thoughts

In an era of sprawling cloud services and ever-increasing data, simple tools like my_personal_tg_assistant remind us of the power of building something just for you: small, secure, focused, and under your control. If you use Telegram and have ambient file-management needs — whether text snippets, photos, videos, or documents — this project is a terrific starting point.

If you give this a try, I’d love to hear how you use it, what you extend, and what features you add!

Linux note: How to start an application automatically on boot

  • Modify /etc/rc.d/rc.local file

If you wish to add a new service to start when the machine boots you should add the necessary script to the directory /etc/init.d/. Many of the scripts already present in that directory will give you an example of the kind of things that you can do.

  • Newer versions of linux support systemd.  It has more features and is more portable than debian-specific solution.

sample script:

[Unit]
Description=Example systemd service.

[Service]
Type=simple
ExecStart=/bin/bash /path/to/myscript.sh

[Install]
WantedBy=multi-user.target
  • Using crontab
$ crontab -e

@reboot /home/nick/auto_run_script.sh

Linux Screen Commands and Shortcuts

Screen is a very powerful tool to keep a process running in the background while retaining the ability to log out and log back in anytime to check on the output.

Annoyingly I keep forgetting the commands to use screen effectively so here’s a quick reference guide of commands and shortcuts for myself and maybe others.

Commands

To start a screen session:

$ screen -S <command>

To list existing screen sessions:

$ screen -ls

To reconnect to a screen session:

$ screen -r <session_name>

To reconnect to a still attached screen session:

$ screen -rd <session_name>

Shortcuts

To detach a screen session: ctrl + a + d

To open a new screen session while inside screen: ctrl + a + c

To switch back to the previous screen session: ctrl + a + p

To switch to the next screen session: ctrl + a + n

Use: screen [-opts] [cmd [args]]
 or: screen -r [host.tty]

Options:
-4            Resolve hostnames only to IPv4 addresses.
-6            Resolve hostnames only to IPv6 addresses.
-a            Force all capabilities into each window's termcap.
-A -[r|R]     Adapt all windows to the new display width & height.
-c file       Read configuration file instead of '.screenrc'.
-d (-r)       Detach the elsewhere running screen (and reattach here).
-dmS name     Start as daemon: Screen session in detached mode.
-D (-r)       Detach and logout remote (and reattach here).
-D -RR        Do whatever is needed to get a screen session.
-e xy         Change command characters.
-f            Flow control on, -fn = off, -fa = auto.
-h lines      Set the size of the scrollback history buffer.
-i            Interrupt output sooner when flow control is on.
-l            Login mode on (update /var/run/utmp), -ln = off.
-ls [match]   or
-list         Do nothing, just list our SockDir [on possible matches].
-L            Turn on output logging.
-Logfile file Set logfile name.
-m            ignore $STY variable, do create a new screen session.
-O            Choose optimal output rather than exact vt100 emulation.
-p window     Preselect the named window if it exists.
-q            Quiet startup. Exits with non-zero return code if unsuccessful.
-Q            Commands will send the response to the stdout of the querying process.
-r [session]  Reattach to a detached screen process.
-R            Reattach if possible, otherwise start a new session.
-s shell      Shell to execute rather than $SHELL.
-S sockname   Name this session <pid>.sockname instead of <pid>.<tty>.<host>.
-t title      Set title. (window's name).
-T term       Use term as $TERM for windows, rather than "screen".
-U            Tell screen to use UTF-8 encoding.
-v            Print "Screen version 4.09.00 (GNU) 30-Jan-22".
-wipe [match] Do nothing, just clean up SockDir [on possible matches].
-x            Attach to a not detached screen. (Multi display mode).
-X            Execute <cmd> as a screen command in the specified session.

References:

New Raspberry Pi OS released

New Raspberry Pi OS Bullseye is released. It comes with lots of new features.

  * Based on Debian version 11 (bullseye)
  * Desktop components (lxpanel and all plugins, libfm, pcmanfm) now built against GTK+3
  * Applications (piwiz, pipanel, rc_gui, lxinput) now built against GTK+3
  * PiXflat GTK+3 theme updated with numerous changes to support the above
  * GTK+3 : toolbar icon size setting added
  * GTK+3 : ability to request client-side decoration on windows added
  * GTK+3 : setting for indent for frame labels in custom style added
  * mutter window manager used instead of openbox on devices with 2GB or more of RAM
  * mutter : title bar icon behaviour and appearance modified to match openbox
  * mutter : additional keyboard shortcuts added
  * mutter : various performance enhancements
  * mutter compatibility added to screen magnifier
  * Numerous changes to Appearance Settings application to support GTK+3 and mutter
  * Updater plugin added to lxpanel to detect and install software updates
  * File manager view options simplified to either list or icons, with separate menu option for thumbnails
  * New file manager toolbar icons
  * KMS used as default display driver
  * Modifications to HDMI audio output selection to support the above
  * xcompmgr enabled when openbox is running under KMS
  * New default camera subsystem based on libcamera
  * New camera demo applications (libcamera-still and libcamera-vid) have replaced raspistill and raspivid
  * Legacy camera subsystem removed from 64-bit RPi OS (still available on 32-bit)
  * Chromium upgraded to version 92.0.4515.98
  * VLC media player upgraded to version 3.0.16
  * Spurious drive removal warning after use of SD card copier removed
  * Bookshelf application now includes Custom PC magazine
  * Various translation updates - Italian, Korean, Polish, German, Armenian
  * Startup wizard now installs Japanese fonts if needed
  * Progress and information dialog boxes for lxpanel plugins now common to lxpanel, rather than in individual plugins
  * Icon handling code for lxpanel plugins now common to lxpanel
  * Package with 4K version of Raspberry Pi wallpaper added to Recommended Software
  * Python Games and Minecraft removed from Recommended Software - neither is compatible with bullseye
  * Bluetooth pairing and connection dialogs updated for compatibility with more devices
  * Bluetooth devices always disconnected before removal to speed up removal process
  * Bluetooth pairing dialog now only shows devices which offer services which are usable by Pi
  * Separate Bluetooth unpair dialog removed - unpair now an option for each individual device
  * Bug fix - mutter : header bar colours not updating when theme is changed
  * Bug fix - GTK+3 : tooltips being displayed incorrectly at bottom of screen
  * Bug fix - lxpanel : crash when using keyboard shortcut to enable magnifier when magnifier not installed
  * Bug fix - lxpanel : lockup in Bluetooth plugin when connecting to certain devices
  * Bug fix - lxpanel : discoverable mode icon could get out of sync with underlying Bluetooth system state
  * Bug fix - piwiz : missing cities in timezone list
  * Bug fix - piwiz : country-specific language packages not being installed
  * Bug fix - bookshelf : now waits for longer between packets before timing out
  * Bug fix - accented characters now displayed correctly in localisation dialogs
  * Raspberry Pi firmware e2bab29767e51c683a312df20014e3277275b8a6
  * Linux kernel 5.10.63

https://www.raspberrypi.com/software/operating-systems/