Giter VIP home page Giter VIP logo

discord-proxmox-bot's Introduction

Discord Bot for controlling a Proxmox VM

Uses the python libraries discord.py and proxmoxer to start, shutdown and show running status of a Proxmox QEMU VM in discord

Install

poetry install

Running

You'll need to have configured a bot in discord and invited it to your server.

Env variables

export VMID="111"
export PVE_PASSWORD="12345"
export PVE_USERNAME="user@pam"
export PVE_NODE="pvenodenamehere"
export PVE_URL="pve.url.here"
export DISCORD_TOKEN="12345"

Starting the bot

poetry run python main.py

Using the Bot

Command Purpose
$start starts vm
$shutdown shutdown the vm
$status running status of the VM

discord-proxmox-bot's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

hedgsagor

discord-proxmox-bot's Issues

discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ConnectionError: HTTPSConnectionPool(host='none', port=8006): Max retries exceeded with url: /api2/json/access/ticket (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fb2474e20>: Failed to establish a new connection: [Errno -5] No address associated with hostname'))

Traceback (most recent call last):
File "/home/pi/.cache/pypoetry/virtualenvs/discord-ct-5K29FBw_-py3.9/lib/python3.9/site-packages/urllib3/connection.py", line 174, in new_conn
conn = connection.create_connection(
File "/home/pi/.cache/pypoetry/virtualenvs/discord-ct-5K29FBw
-py3.9/lib/python3.9/site-packages/urllib3/util/connection.py", line 72, in create_connection
for res in socket.getaddrinfo(host, port, family, socket.SOCK_STREAM):
File "/usr/lib/python3.9/socket.py", line 953, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -5] No address associated with hostname

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/pi/.cache/pypoetry/virtualenvs/discord-ct-5K29FBw_-py3.9/lib/python3.9/site-packages/urllib3/connectionpool.py", line 703, in urlopen
httplib_response = self.make_request(
File "/home/pi/.cache/pypoetry/virtualenvs/discord-ct-5K29FBw
-py3.9/lib/python3.9/site-packages/urllib3/connectionpool.py", line 386, in _make_request
self.validate_conn(conn)
File "/home/pi/.cache/pypoetry/virtualenvs/discord-ct-5K29FBw
-py3.9/lib/python3.9/site-packages/urllib3/connectionpool.py", line 1042, in validate_conn
conn.connect()
File "/home/pi/.cache/pypoetry/virtualenvs/discord-ct-5K29FBw
-py3.9/lib/python3.9/site-packages/urllib3/connection.py", line 358, in connect
self.sock = conn = self.new_conn()
File "/home/pi/.cache/pypoetry/virtualenvs/discord-ct-5K29FBw
-py3.9/lib/python3.9/site-packages/urllib3/connection.py", line 186, in _new_conn
raise NewConnectionError(
urllib3.exceptions.NewConnectionError: <urllib3.connection.HTTPSConnection object at 0x7fb2474e20>: Failed to establish a new connection: [Errno -5] No address associated with hostname

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/pi/.cache/pypoetry/virtualenvs/discord-ct-5K29FBw_-py3.9/lib/python3.9/site-packages/requests/adapters.py", line 489, in send
resp = conn.urlopen(
File "/home/pi/.cache/pypoetry/virtualenvs/discord-ct-5K29FBw_-py3.9/lib/python3.9/site-packages/urllib3/connectionpool.py", line 787, in urlopen
retries = retries.increment(
File "/home/pi/.cache/pypoetry/virtualenvs/discord-ct-5K29FBw_-py3.9/lib/python3.9/site-packages/urllib3/util/retry.py", line 592, in increment
raise MaxRetryError(_pool, url, error or ResponseError(cause))
urllib3.exceptions.MaxRetryError: HTTPSConnectionPool(host='none', port=8006): Max retries exceeded with url: /api2/json/access/ticket (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fb2474e20>: Failed to establish a new connection: [Errno -5] No address associated with hostname'))

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/home/pi/.cache/pypoetry/virtualenvs/discord-ct-5K29FBw_-py3.9/lib/python3.9/site-packages/discord/ext/commands/core.py", line 229, in wrapped
ret = await coro(*args, **kwargs)
File "/home/pi/discord-proxmox-bot/main.py", line 92, in status
vm = ProxmoxVM(config)
File "/home/pi/discord-proxmox-bot/main.py", line 27, in init
self.proxmox = proxmoxer.ProxmoxAPI(
File "/home/pi/.cache/pypoetry/virtualenvs/discord-ct-5K29FBw_-py3.9/lib/python3.9/site-packages/proxmoxer/core.py", line 210, in init
self.backend = importlib.import_module(f".backends.{backend}", "proxmoxer").Backend(
File "/home/pi/.cache/pypoetry/virtualenvs/discord-ct-5K29FBw
-py3.9/lib/python3.9/site-packages/proxmoxer/backends/https.py", line 302, in init
self.auth = ProxmoxHTTPAuth(
File "/home/pi/.cache/pypoetry/virtualenvs/discord-ct-5K29FBw_-py3.9/lib/python3.9/site-packages/proxmoxer/backends/https.py", line 59, in init
self.get_new_tokens(password=password, otp=otp)
File "/home/pi/.cache/pypoetry/virtualenvs/discord-ct-5K29FBw
-py3.9/lib/python3.9/site-packages/proxmoxer/backends/https.py", line 70, in get_new_tokens
response_data = requests.post(
File "/home/pi/.cache/pypoetry/virtualenvs/discord-ct-5K29FBw
-py3.9/lib/python3.9/site-packages/requests/api.py", line 115, in post
return request("post", url, data=data, json=json, **kwargs)
File "/home/pi/.cache/pypoetry/virtualenvs/discord-ct-5K29FBw_-py3.9/lib/python3.9/site-packages/requests/api.py", line 59, in request
return session.request(method=method, url=url, **kwargs)
File "/home/pi/.cache/pypoetry/virtualenvs/discord-ct-5K29FBw_-py3.9/lib/python3.9/site-packages/requests/sessions.py", line 587, in request
resp = self.send(prep, **send_kwargs)
File "/home/pi/.cache/pypoetry/virtualenvs/discord-ct-5K29FBw_-py3.9/lib/python3.9/site-packages/requests/sessions.py", line 701, in send
r = adapter.send(request, **kwargs)
File "/home/pi/.cache/pypoetry/virtualenvs/discord-ct-5K29FBw_-py3.9/lib/python3.9/site-packages/requests/adapters.py", line 565, in send
raise ConnectionError(e, request=request)
requests.exceptions.ConnectionError: HTTPSConnectionPool(host='none', port=8006): Max retries exceeded with url: /api2/json/access/ticket (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fb2474e20>: Failed to establish a new connection: [Errno -5] No address associated with hostname'))

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
File "/home/pi/.cache/pypoetry/virtualenvs/discord-ct-5K29FBw_-py3.9/lib/python3.9/site-packages/discord/ext/commands/bot.py", line 1349, in invoke
await ctx.command.invoke(ctx)
File "/home/pi/.cache/pypoetry/virtualenvs/discord-ct-5K29FBw_-py3.9/lib/python3.9/site-packages/discord/ext/commands/core.py", line 1023, in invoke
await injected(*ctx.args, **ctx.kwargs) # type: ignore
File "/home/pi/.cache/pypoetry/virtualenvs/discord-ct-5K29FBw_-py3.9/lib/python3.9/site-packages/discord/ext/commands/core.py", line 238, in wrapped
raise CommandInvokeError(exc) from exc
discord.ext.commands.errors.CommandInvokeError: Command raised an exception: ConnectionError: HTTPSConnectionPool(host='none', port=8006): Max retries exceeded with url: /api2/json/access/ticket (Caused by NewConnectionError('<urllib3.connection.HTTPSConnection object at 0x7fb2474e20>: Failed to establish a new connection: [Errno -5] No address associated with hostname'))

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.