Skip to content

Custom Discord bot with a music player, CS:GO lineups and map callouts, LoL counter and more.

License

Notifications You must be signed in to change notification settings

flumi3/discord-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

69 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Discord Bot

Features

Music Player

cmd_play

LoL Buddy

Get counter champions for a League of Legends champion

cmd_counter

CS:GO Buddy

[!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).

Get lineups for a map

cmd_lineups

Get callouts for a map

cmd_callouts

Get the jumpthrow bind that you can paste into your console

cmd_jumpthrow

Get the practice config that you can paste into your console

cmd_practice

Getting Started

Exporting YouTube cookies for authentication

[!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:

  1. Open a private browser window.
  2. Sign in to your YouTube account.
  3. Open a new tab and close the YouTube tab.
  4. Export the cookies, e.g. by using a chrome or firefox extension capable of this.
  5. Create the file cookies.txt in the repository root of the discord bot.
  6. Copy the content of the private window cookie file into a the cookies.txt file you created in step 5.

Installing and configuring the bot

📝 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.

  1. Create a Discord Bot Account and invite the bot to your server

  2. 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>
  3. Install FFmpeg

    sudo apt update
    sudo apt install ffmpeg
  4. Install Python and pipx

    sudo apt install python3
    sudo apt install pipx
  5. Install Poetry

    pipx install poetry
  6. Install project dependencies

    poetry install

Running the project

  1. Activate the Poetry shell

    poetry shell
  2. Run the discord bot

    poetry run python discord_bot/bot.py

(Optional) Create a CronJob

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:

  1. Install the Poetry export plugin:

    poetry self add poetry-plugin-export
  2. Create a requirements.txt file from the poetry.lock file:

    poetry export -f requirements.txt --output requirements.txt
  3. Install the dependencies globally:

    pip install -r requirements.txt
  4. Edit your crontab file:

    crontab -e
  5. 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.

  6. Test: Reboot the VM and see if the Discord bot starts up automatically.

About

Custom Discord bot with a music player, CS:GO lineups and map callouts, LoL counter and more.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages