How to upload your own Node.js or Python bot
Move an existing bot to FreeBot: upload the code, set the start file and add your secrets.
Pick the right start
Create a bot from Empty Node.js bot or Empty Python bot. You get a starting file and a list of packages that you can replace with your own code.
Upload your code
- Pack your project into a .zip file, without
node_modules,.venvor__pycache__. - Open Files, click Upload and choose the zip.
- Click the zip and choose Extract. Delete the zip afterwards to save space.
You can also connect with an SFTP app such as FileZilla. The login is in the SFTP tab.
Tell FreeBot how to start it
- Node.js: list your packages in
package.json. The start file isindex.jsunless you set another one in Settings. - Python: list your packages in
requirements.txt. The start file ismain.pyunless you set another one in Settings. - Packages install by themselves at every start.
Secrets
Put tokens and API keys into Settings, Variables, not into files. Your code reads them as environment variables.
If it does not start
- Start file not found: set the correct file in Settings, for example
src/bot.jsorbot/main.py. - Module not found: add the package to
package.jsonorrequirements.txtand restart. - The bot stops after a while: look at the last lines of the logs. Memory limits show as a sudden stop; a larger plan helps.