diff --git a/wikibot.py b/bot.py similarity index 100% rename from wikibot.py rename to bot.py diff --git a/bot.service b/bot.service new file mode 100644 index 0000000..b6b12dc --- /dev/null +++ b/bot.service @@ -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 diff --git a/req.txt b/req.txt new file mode 100644 index 0000000..347141d --- /dev/null +++ b/req.txt @@ -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 diff --git a/script.sh b/script.sh new file mode 100755 index 0000000..d15d48a --- /dev/null +++ b/script.sh @@ -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 +