Move bot username into install.sh / konata.conf

This commit is contained in:
2021-01-04 16:39:50 +01:00
parent a0b2eaded2
commit 30ff526fc0
2 changed files with 17 additions and 3 deletions

View File

@@ -6,9 +6,24 @@ echo "Installing dependencies..."
apk add lighttpd curl jq bash youtube-dl ffmpeg apk add lighttpd curl jq bash youtube-dl ffmpeg
read -p "Please enter your bot token: " token read -p "Please enter your bot token: " token
echo "token=$token" > /etc/konata.conf read -p "Please enter the bot's username (without @): " bot
read -p "Please enter the domain for your bot: " domain read -p "Please enter the domain for your bot: " domain
if [ -f /etc/konata.conf ]
then
read -p "/etc/konata.conf already exists. Do you want to remove it? (y/n) " ans
if [ "$ans" == "y" ]
then
rm /etc/konata.conf
else
echo "Keeping file. Please investigate this file and run the installer again."
exit 1
fi
else
echo "token=$token" >> /etc/konata.conf
echo "bot=$bot" >> /etc/konata.conf
fi
echo "Installing application files..." echo "Installing application files..."
install -m644 lighttpd.conf /etc/lighttpd/lighttpd.conf install -m644 lighttpd.conf /etc/lighttpd/lighttpd.conf
mkdir /var/www/konata mkdir /var/www/konata

View File

@@ -5,10 +5,9 @@ printf "Content-Type: text/plain\n\n"
# Initialize basic variables # Initialize basic variables
. /etc/konata.conf . /etc/konata.conf
input=$(cat /dev/stdin)
bot="konatasanbot"
# Parse incoming messages # Parse incoming messages
input=$(cat /dev/stdin)
cmd=$(jq -r '.message.text' <<< $input) cmd=$(jq -r '.message.text' <<< $input)
args=$(cut -d" " -f2- <<< $cmd) args=$(cut -d" " -f2- <<< $cmd)
chat=$(jq -r '.message.chat.id' <<< $input) chat=$(jq -r '.message.chat.id' <<< $input)