[!NOTE] CS:GO buddy is a deprecated feature since CS:GO was replaced by CS2 in September 2023 (rip CS:GO, you will live on in our memories <\3).
[!IMPORTANT] Since a few months, YouTube steps up its measures for preventing bots accessing their content. Therefore, it is now necessary to provide some kind of login if you want to run the bot on a remote VM. If you want to run it on your local network, you should be fine.
In case you see the following error
ERROR: [youtube] KQBRM1GK3T4: Sign in to confirm you’re not a bot. This helps protect our community.
,
you have to export your cookies and provide them to the discord bot for authenticating to YouTube.
Follow these steps:
- Open a private browser window.
- Sign in to your YouTube account.
- Open a new tab and close the YouTube tab.
- Export the cookies, e.g. by using a chrome or firefox extension capable of this.
- Create the file
cookies.txt
in the repository root of the discord bot. - Copy the content of the private window cookie file into a the
cookies.txt
file you created in step 5.
📝 Note: This project uses Poetry for simple and consistent dependency management. If you want to learn more about Poetry see their Introduction or Basic usage documentation.
-
Create a Discord Bot Account and invite the bot to your server
-
Create .env file with the following content:
DISCORD_TOKEN = <your discord token> SPOTIFY_CLIENT_ID = <your spotify client id> SPOTIFY_CLIENT_SECRET = <your spotify client secret>
-
Install FFmpeg
sudo apt update sudo apt install ffmpeg
-
Install Python and pipx
sudo apt install python3 sudo apt install pipx
-
Install Poetry
pipx install poetry
-
Install project dependencies
poetry install
-
Activate the Poetry shell
poetry shell
-
Run the discord bot
poetry run python discord_bot/bot.py
If you want to run the discord bot on a server (e.g. a Oracle cloud free tier VM running Ubuntu) you can create a cron job that will automatically start the Discord bot upon each reboot. Run the following commands from within the discord bot repository:
-
Install the Poetry export plugin:
poetry self add poetry-plugin-export
-
Create a
requirements.txt
file from thepoetry.lock
file:poetry export -f requirements.txt --output requirements.txt
-
Install the dependencies globally:
pip install -r requirements.txt
-
Edit your crontab file:
crontab -e
-
Add a Cronjob to use Poetry's environment on startup:
@reboot PYTHONPATH=/home/ubuntu/discord-bot:$PYTHONPATH python3 /home/ubuntu/discord-bot/discord_bot/bot.py &
📝 Note: Make sure to adjust the path if your discord bot is in a different location.
-
Test: Reboot the VM and see if the Discord bot starts up automatically.