Skip to main content

Basic Proxmox + Discord bot template

Project description

proxmox-discord-connector

Python Discord bot template that queries Proxmox via slash commands.

The codebase now follows an object-oriented structure:

  • ProxmoxDiscordApplication handles app startup.
  • ProxmoxDiscordBot subclasses commands.Bot and registers cogs in setup_hook.
  • NodesCog and RandomMessageCog encapsulate slash command behavior.
  • ProxmoxService encapsulates Proxmox API client access.

Requirements

  • Python 3.11+

Setup

python -m venv .venv
cp .env.example .env

Activate the virtual environment:

# bash/zsh
source .venv/bin/activate

# fish
source .venv/bin/activate.fish

Install the project from the repository root (not src/):

python -m pip install -e .

Edit .env with your values.

DISCORD_BOT_TOKEN, PROXMOX_HOST, PROXMOX_USER, and PROXMOX_PASSWORD are required. DISCORD_ALLOWED_USER_IDS is optional (comma-separated Discord user IDs). DISCORD_SYNC_GUILD_ID is optional and recommended for development to get near-instant slash command updates. PROXMOX_VERIFY_SSL defaults to true.

Environment variables

  • DISCORD_BOT_TOKEN: Discord bot token.
  • DISCORD_ALLOWED_USER_IDS: Optional comma-separated allowlist for restricted commands (e.g. 123,456).
  • DISCORD_SYNC_GUILD_ID: Optional Discord server ID for development command sync (fast propagation).
  • PROXMOX_HOST: Proxmox host or IP.
  • PROXMOX_USER: Proxmox user (for example root@pam).
  • PROXMOX_PASSWORD: Proxmox password.
  • PROXMOX_VERIFY_SSL: true or false (defaults to true).

Slash Command Sync Speed

Discord global slash command propagation can take a while. For fast development updates, set DISCORD_SYNC_GUILD_ID to your server ID in .env.

Example:

DISCORD_SYNC_GUILD_ID=123456789012345678

When this is set, the bot copies global commands to that guild and syncs there on startup, so new commands usually appear quickly after restart.

Run

python -m proxmox_discord_connector.main

If activation is not working in your shell, run directly with the venv Python:

.venv/bin/python -m pip install -e .
.venv/bin/python -m proxmox_discord_connector.main

Slash commands

  • /nodes - List Proxmox nodes. Honors DISCORD_ALLOWED_USER_IDS when provided.
  • /lxcs - List Proxmox LXC containers. Honors DISCORD_ALLOWED_USER_IDS when provided.
  • /randommsg - Return a random greeting.

Project structure

src/proxmox_discord_connector/
	app.py                 # Application entry object
	bot.py                 # Bot subclass and setup_hook
	config.py              # Environment-backed settings
	main.py                # Executable module entrypoint
	services/
		proxmox_service.py   # Proxmox API service layer
	slash_commands/
		nodes.py             # NodesCog
		randommsg.py         # RandomMessageCog

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

proxmox_discord_connector-0.1.0.tar.gz (9.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

proxmox_discord_connector-0.1.0-py3-none-any.whl (12.2 kB view details)

Uploaded Python 3

File details

Details for the file proxmox_discord_connector-0.1.0.tar.gz.

File metadata

File hashes

Hashes for proxmox_discord_connector-0.1.0.tar.gz
Algorithm Hash digest
SHA256 f80926af30834b4d6d1c27718009f05778ae8dea11529923bd9553a345fb41d6
MD5 34abbf68baf64161ab8721c905bf3f53
BLAKE2b-256 9943f6fac4c62ffb8a0471a464241c9001c4ed977eeb7bae7d88e2b091d88703

See more details on using hashes here.

File details

Details for the file proxmox_discord_connector-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for proxmox_discord_connector-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 9e59666208e1facd4efb129a810e8a36b96519e5a86e0a57f2bb270db4902e41
MD5 65a587715281f4f330b3c1653b3d9f59
BLAKE2b-256 50c17a397179aa1e06409f810d8dc9e6dea32333a2a375765cc58a47765af29c

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page