mirror of
https://github.com/sdr-enthusiasts/docker-planefence.git
synced 2025-12-22 11:17:06 +00:00
Config loading fix and more discord config prep
This commit is contained in:
@@ -25,7 +25,7 @@ This is part of the [kx1t/docker-planefence] docker container. Nothing in this d
|
||||
|
||||
## Bring your bot into a server
|
||||
|
||||
- In the left-hand sidebar of your Application's plage click the "OAuth 2" button and then "URL Generator" below that.
|
||||
- In the left-hand sidebar of your Application's page click the "OAuth 2" button and then "URL Generator" below that.
|
||||
|
||||
- In the Scopes list we only need to check the "bot" box. It should be in the middle row, 5th entry down.
|
||||
|
||||
@@ -39,11 +39,11 @@ This is part of the [kx1t/docker-planefence] docker container. Nothing in this d
|
||||
|
||||
## Configure Planefence
|
||||
|
||||
- If you haven't already save the token from the first step into your `.env` file be sure to do that.
|
||||
- If you haven't already saved the token from the first step into your `.env` file be sure to do so.
|
||||
|
||||
- We also need to tell Planefence what Server and Channel to send to. Open the Preferences of your Discord client and go to the "Advanced" page (towards the bottom). Enable "Developer Mode"
|
||||
|
||||
- Right click on your server in the list on the far-left of the application and click "Copy ID" at the bottom. Paste that into `planefence.config` as `DISCORD_SERVER_ID=<paste>`.
|
||||
- Right click on your server and click "Copy ID" at the bottom. Paste that into `planefence.config` as `DISCORD_SERVER_ID=<paste>`.
|
||||
|
||||
- With your server selected right-click the channel you want the messages to be posted in and click "Copy ID" at the bottom. Paste this into `planefence.config` as `DISCORD_CHANNEL_ID=<paste>`
|
||||
|
||||
|
||||
@@ -79,7 +79,8 @@ def load_config():
|
||||
if line.strip().startswith("#"):
|
||||
continue
|
||||
split = line.split("=")
|
||||
config[split[0].strip()] = split[1].strip()
|
||||
if len(split) == 2:
|
||||
config[split[0].strip()] = split[1].strip()
|
||||
|
||||
# Validate configuration
|
||||
if config.get("DISCORD_TOKEN") is None:
|
||||
|
||||
@@ -319,6 +319,10 @@
|
||||
PF_DISCORD=OFF
|
||||
PA_DISCORD=OFF
|
||||
|
||||
DISCORD_TOKEN=
|
||||
DISCORD_SERVER_ID=
|
||||
DISCORD_CHANNEL_ID=
|
||||
|
||||
# Last, the version. Although you could change this, for tracking purposes, we'd like you to leave it to whatever the
|
||||
# official version number is. If you fork this software, we'd appreciate if you add on to the version number rather than
|
||||
# replace the entire number. That way, it's easy to understand from which version you forked. For example, VERSION=3.11-myfork-1.0
|
||||
|
||||
@@ -206,7 +206,16 @@ fi
|
||||
# enable or disable discord:
|
||||
#
|
||||
[[ "x$PF_DISCORD" == "xOFF" ]] && sed -i 's/\(^\s*PF_DISCORD=\).*/\1/' /usr/share/planefence/planefence.conf
|
||||
[[ "$PF_DISCORD" == "ON" ]] && sed -i 's/\(^\s*PF_DISCORD=\).*/\1ON/' /usr/share/planefence/planefence.conf
|
||||
if [[ "$PF_DISCORD" == "ON" ]]
|
||||
then
|
||||
sed -i 's/\(^\s*PF_DISCORD=\).*/\1ON/' /usr/share/planefence/planefence.conf
|
||||
[[ "x$DISCORD_TOKEN" != "x" ]] && sed -i 's/\(^\s*DISCORD_TOKEN=\).*/\1/' /usr/share/planefence/planefence.conf
|
||||
[[ "x$DISCORD_TOKEN" != "x" ]] && sed -i "s/\(^\s*DISCORD_TOKEN=\).*/\1${DISCORD_TOKEN}/" /usr/share/planefence/planefence.conf
|
||||
[[ "x$DISCORD_SERVER_ID" != "x" ]] && sed -i 's/\(^\s*DISCORD_SERVER_ID=\).*/\1/' /usr/share/planefence/planefence.conf
|
||||
[[ "x$DISCORD_SERVER_ID" != "x" ]] && sed -i "s/\(^\s*DISCORD_SERVER_ID=\).*/\1${DISCORD_SERVER_ID}/" /usr/share/planefence/planefence.conf
|
||||
[[ "x$DISCORD_CHANNEL_ID" != "x" ]] && sed -i 's/\(^\s*DISCORD_CHANNEL_ID=\).*/\1/' /usr/share/planefence/planefence.conf
|
||||
[[ "x$DISCORD_CHANNEL_ID" != "x" ]] && sed -i "s/\(^\s*DISCORD_CHANNEL_ID=\).*/\1${DISCORD_CHANNEL_ID}/" /usr/share/planefence/planefence.conf
|
||||
fi
|
||||
[[ "$PF_DISCORD" != "ON" ]] && sed -i 's|\(^\s*PF_DISCORD=\).*|\1OFF|' /usr/share/plane-alert/plane-alert.conf
|
||||
# -----------------------------------------------------------------------------------
|
||||
#
|
||||
|
||||
Reference in New Issue
Block a user