konata/install.sh

23 lines
674 B
Bash
Raw Normal View History

2021-01-02 17:57:07 +01:00
#!/bin/ash
[ $(whoami) != "root" ] && echo "Must run as root!" && exit 1
echo "Installing dependencies..."
apk add lighttpd curl jq bash youtube-dl ffmpeg
read -p "Please enter your bot token: " token
echo "token=$token" > /etc/konata.conf
read -p "Please enter the domain for your bot: " domain
echo "Installing application files..."
install -m644 lighttpd.conf /etc/lighttpd/lighttpd.conf
mkdir /var/www/konata
rand=$RANDOM
install -m755 konata.sh /var/www/konata/$rand.sh
echo "Requesting Telegram to use our webhook..."
curl -X POST "https://api.telegram.org/bot$token/setWebhook" \
-d "url=$domain/$rand.sh"
echo "That should be everything! Enjoy your new bot!"