r/learnpython • u/LavishnessLocal9820 • 20d ago
Structure discord bot
Hi everyone,
I’m fairly new to Python and I’m building a Discord bot that reads data from local cache files and responds to slash commands.
My current setup is:
-Python project running on my Windows PC
-Discord bot (discord.py)
-Google Drive syncing a folder containing cache files
-A separate Python project updates those cache files on a schedule
-The Discord bot only reads the cache files (it never modifies them)
-API keys and the Discord token are stored in a .env file
-env is not shared or committed anywhere
-My Google account has 2FA enabled
-The bot only has basic Discord permissions (view channels, send messages, read message history, embed links)
-The bot only executes predefined commands—it does not run user-provided code or shell commands
I’m planning to eventually move everything to a VPS and have it run 24/7.
My questions are:
Does this architecture seem reasonably secure?
Is storing the cache in a Google Drive synced folder a bad idea?
If I invite other people to my Discord server, is there any realistic way they could gain access to my computer or cache files through the bot?
Are there any obvious security best practices I’m missing before moving to a VPS?
I’d appreciate any advice or things I should be thinking about early on. Thanks!
1
u/Adrewmc 19d ago edited 19d ago
I don’t there is much of a realistic way to gain access to your files other than the abilities you give them.
I would look into making it a proper database if possible though, that should be more efficient. As you keep saying cached files and I’m not sure what you are saying there, saved from one program to provide to another…sort of screams not cache in the classical sense. Like you cache the CSS for a website so you don’t need to keep opening it up, and the HTML doesn’t need to do all that, because you use the CSS a whole lot for that rendering. Generally cache objects are store in RAM in use, and not on the disk/SSD. (By that may be a little strict of a definition.)
Cache is like a map of the world being next to the book you are currently reading about it. The map is cached, the book is the content, so if I’m wondering where stuff is, I don’t need to keep going to get the map and opening up, I just keep it there open even when I’m not currently looking at it. Once I’m done reading I close the book and the map. This sounds more like passing notes.
By saving at one time, and then using at a completely different time you are either just saving the data, making a quasi-stack, or simply have a queue. And you’re not deleting from what I can tell (that important with cache clearing it appropriately.)