compliting

This commit is contained in:
ggodot 2025-01-07 00:47:38 +01:00
parent de4369afb0
commit 45664d0567
4 changed files with 82 additions and 0 deletions

View File

27
bot.service Normal file
View File

@ -0,0 +1,27 @@
[Unit]
Description=Discord bot
After=syslog.target
[Service]
Type=simple
User=disbot
Group=disbot
ProtectControlGroups=true
ProtectHome=true
ProtectKernelModules=true
ProtectKernelTunables=true
ProtectSystem=full
PrivateDevices=true
PrivateUsers=true
WorkingDirectory=/opt/disbot/
ExecStart=/opt/disbot/env/bin/python3 /opt/disbot/disbot.py
Restart=on-failure
[Install]
WantedBy=multi-user.target

19
req.txt Normal file
View File

@ -0,0 +1,19 @@
aiohappyeyeballs==2.4.4
aiohttp==3.11.11
aiosignal==1.3.2
attrs==24.3.0
audioop-lts==0.2.1
beautifulsoup4==4.12.3
certifi==2024.12.14
charset-normalizer==3.4.1
discord.py==2.4.0
frozenlist==1.5.0
idna==3.10
multidict==6.1.0
propcache==0.2.1
py-cord==2.6.1
requests==2.32.3
soupsieve==2.6
urllib3==2.3.0
wikipedia==1.4.0
yarl==1.18.3

36
script.sh Executable file
View File

@ -0,0 +1,36 @@
#!/bin/bash
printf "Better to run as root, because of permisions handeling.\n"
sleep 2
apt update
apt upgrade -y
apt install python3 python3.11-venv pip git vim -y
groupadd bot
useradd --system --shell /usr/sbin/nologin --home /opt/bot -g bot bot
mkdir /opt/bot/
# python virtual enviroment
mkdir /opt/bot/env/
python3 -m venv /opt/bot/env/
source /opt/bot/env/bin/activate
pip install -r req.txt
deactivate
mv bot.py /opt/disbot/
mkdir /opt/disbot/backup/
chown -R bot:bot /opt/bot/
#systemD
mv bot.service /etc/systemd/system/
systemctl daemon-reload
systemctl start bot.service
systemctl enable bot.service