Hosting Discord.py and Pycord Bots on NodeFlux | NodeFlux.eu Docs

Deploy asynchronous Python Discord bots using discord.py or Pycord with environment variable security.

Steps

  1. Create a main bot script (e.g., bot.py) using discord.ext.commands.
  2. Load bot token securely: token = os.getenv("DISCORD_TOKEN").
  3. Create requirements.txt file listing exact versions: discord.py>=2.3.0 or pycord.
  4. Upload bot.py and requirements.txt to your NodeFlux Python service container via SFTP.
  5. Add DISCORD_TOKEN in the service Environment Variables panel.
  6. Set startup command to python bot.py.
  7. Start service and inspect logs to confirm discord.gateway connection success.

Notes