proxmox-bot

command module
v0.0.8 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 28, 2023 License: MIT Imports: 16 Imported by: 0

README

Proxmox Discord Bot

Tests Release GitHub forks GitHub stars GitHub contributors GitHub license GitHub All Releases Docker Pulls Discord

Supports amd64

Discord Support

Purpose

Enables users in Discord to invoke Start or Stop actions on Proxmox VMs

Did I save you some time? Buy me a ☕😄

Configure the bot

Env Vars

It's unsafe to store credentials in files, so we require the credentials to be injected via env variables.

For every proxmox_host_url, we assume there's two env vars like HOSTPORT_USERNAME and HOSTPORT_PASSWORD, where HOST and PORT are the portions defined in the below YAML.

Config File

Modify proxmox-bot-config.yml as needed.

Each entry in the list has 3 properties

  • logical_name: The name users will call the VM when they invoke startvm or stopvm
  • proxmox_vm_id: The numberic VM ID of the target.
  • proxmox_host_url: the HOST:PORT portion of a URL to connect to proxmox.

Running the bot

Environment Variables
  • PROXMOX_BOT_DISCORD_TOKEN
VSCode

Included is a VSCode devcontainer to help you get off the ground quickly.

Debugger is enabled in devcontainer, provided env variables below are set.

Kubernetes

Take a look at kube-manifest.yml for an idea of what you need to deploy.

Ensure you have secrets & configmaps set.

Example Configmap:

apiVersion: v1
kind: ConfigMap
metadata:
  name: proxmox-bot-live-config
data:
  config: |
    vms:
      - logical_name: A
        proxmox_vm_id: B
        proxmox_host_url: C
        proxmox_host_name: D
Discord Bot Setup
  • This guide seems to have a good write up on how to generate a bot token.
  • Note that during the creation of the bot, you will need to enable the "Server Members Intent" flag on the Bot page in the Discord developers portal.
  • Once you have the token in step 5, replace "9999" in the docker-compose.yml file with your bot's token.
  • Finally, craft your authorization URL. You can copy the authorization URL from the Discord developers portal as mentioned in step 5.
  • Once the authorization URL is copied, replace the permissions integer with that from the URL given above to join the public bot to your server.
  • You should now be able to visit your authorization URL and join your own bot to your Discord guild.

Using the bot

Once the bot is joined, in any channel it has read access to, send a message $help. This command will enumerate all the commands the bot currently supports.

Contributing

Contributions are what make the open source community such an amazing place to be learn, inspire, and create. Any contributions you make are greatly appreciated.

  1. Fork the project
  2. Create your feature branch (git checkout -b feature/AmazingFeature)
  3. Make changes, and update CHANGELOG.md to describe them.
  4. Commit your changes (git commit -m 'Add some AmazingFeature')
  5. Push to the branch (git push origin feature/AmazingFeature)
  6. Open a pull request

Documentation

The Go Gopher

There is no documentation for this package.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL