Skip to content

Anime-pdf/FifoToDiscordBridge-tw

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

18 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

FIFO to Discord bridge

This python script will start discord bot that will pull lines from logfile to send them over discord, and read messages from discord to push them into fifo file.

Requirments

You will need:

  • DDNet/Teeworlds server with logfile path/to/logfile and sv_input_fifo path/to/fifo
  • Discord bot with message content intent
  • Python3 with nextcord and watchdog packages installed

Config

Copy config.json.example and rename it to config.json. Replace values with your own.

Note: servers value is an array that should contain values with logfile_path, fifo_path, channel_id, broadcast and mode. Useful if you have multiple servers running at once.

Running

sudo apt update
sudo apt install python3-venv
cd path/to/bot
python3 -m venv venv
source venv/bin/activate
pip install nextcord watchdog
python main.py
deactivate

Running As Service

For running your bot as a background service, you can create a systemd service file.

  1. Create a systemd Service File:

    sudo nano /etc/systemd/system/discord-bot.service
  2. Add the Following Configuration: Replace path/to/bot/ with the actual path to bot repository.

    [Unit]
    Description=Discord Bot
    After=network.target
    
    [Service]
    User=your_username
    WorkingDirectory=/path/to/bot
    ExecStart=/path/to/bot/venv/bin/python /path/to/bot/main.py
    Restart=always
    
    [Install]
    WantedBy=multi-user.target
  3. Reload systemd and Start the Service:

    sudo systemctl daemon-reload
    sudo systemctl start discord-bot.service
    sudo systemctl enable discord-bot.service
  4. Check the Status: You can check the status of your bot with:

    sudo systemctl status discord-bot.service

Showcase

example

About

console in discord channel with logfile+fifo

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages