Error handling for the docker command
This commit is contained in:
parent
7977a0ac12
commit
6db4d657cd
@ -341,11 +341,18 @@ async def on_message(message):
|
|||||||
actions = ['restart', 'status', 'logs']
|
actions = ['restart', 'status', 'logs']
|
||||||
await client.send_message(
|
await client.send_message(
|
||||||
message.channel,
|
message.channel,
|
||||||
"\nSupported actions:\n{}".format(", ".join(actions))
|
"\nSupported actions:```\n{}```".format(", ".join(actions))
|
||||||
)
|
)
|
||||||
else:
|
else:
|
||||||
docker_client = docker.from_env()
|
docker_client = docker.from_env()
|
||||||
minecraft_container = docker_client.containers.get('beyondreality')
|
try:
|
||||||
|
minecraft_container = docker_client.containers.get('beyondreality')
|
||||||
|
except:
|
||||||
|
await client.send_message(
|
||||||
|
message.channel,
|
||||||
|
"The minecraft container is not running"
|
||||||
|
)
|
||||||
|
return
|
||||||
|
|
||||||
# Figure out what action they want to take
|
# Figure out what action they want to take
|
||||||
action = message.content.split()[1]
|
action = message.content.split()[1]
|
||||||
|
Loading…
x
Reference in New Issue
Block a user