mirror of
https://github.com/opus-tango/minecraft-server-discord-bot.git
synced 2026-03-20 03:55:20 +00:00
add check for running server when starting new server
This commit is contained in:
@@ -13,7 +13,7 @@ Commands:
|
|||||||
!ping - Pings the bot
|
!ping - Pings the bot
|
||||||
|
|
||||||
-Add currently running server variable
|
-Add currently running server variable
|
||||||
Add running server check to prevent multiple servers running
|
-Add running server check to prevent multiple servers running
|
||||||
-Add list command to see currently running servers
|
-Add list command to see currently running servers
|
||||||
-Add server stop command
|
-Add server stop command
|
||||||
-Add server command command
|
-Add server command command
|
||||||
|
|||||||
5
bot.py
5
bot.py
@@ -81,6 +81,11 @@ async def startserver(ctx, *args):
|
|||||||
return
|
return
|
||||||
servername = args[0]
|
servername = args[0]
|
||||||
|
|
||||||
|
# Check if the server is already running
|
||||||
|
if active_server is not None:
|
||||||
|
await ctx.send("A server is already running. If you think this is an error, run !list to refresh the list of servers and try again.")
|
||||||
|
return
|
||||||
|
|
||||||
# Load server data from json
|
# Load server data from json
|
||||||
with open('servers.json', 'r') as f:
|
with open('servers.json', 'r') as f:
|
||||||
servers = json.load(f)
|
servers = json.load(f)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
{
|
{
|
||||||
"config": {
|
"config": {
|
||||||
"chat_channel": "minecraft",
|
"chat_channel": "testchatchannel",
|
||||||
"command_channel": "minecraft",
|
"command_channel": "testchatchannel",
|
||||||
"command_prefix": "!"
|
"command_prefix": "!"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user