Keyboard shortcuts

Press ← or → to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Uninstall PolarBot

Remove it from one Discord server only

Kick PolarBot from the server (or let the server’s owner do it). When the bot sees that it was removed, it deletes every row of that server from its database at once: settings, roles, scanner rules and lists, punishment history, the authorization. Server outages do not count as a removal.

Remove it from the machine

1. Stop it and remove the service

sudo systemctl disable --now polarbot
sudo rm /etc/systemd/system/polarbot.service
sudo rm -rf /etc/systemd/system/polarbot.service.d
sudo systemctl daemon-reload
sudo systemctl reset-failed polarbot 2>/dev/null || true

After this systemctl status polarbot says Unit polarbot.service could not be found.

2. Remove the program and its configuration

sudo rm -rf /opt/polarbot
sudo rm -rf /etc/polarbot

This removes the binary, the previous binary, the config file and the encrypted credentials.

3. Remove the data (optional)

Keep this step for last and only do it if you are sure: it deletes the database, including every server’s settings and punishment history, and cannot be undone. Make a backup first if you might want it back.

sudo rm -rf /var/lib/private/polarbot
sudo rm -f /var/lib/polarbot
sudo rm -rf /var/backups/polarbot

/var/lib/polarbot is only a link to the private directory; /var/backups/polarbot holds the backups made by updates.

4. Remove the OAuth callback site (if you set it up)

Debian/Ubuntu:

sudo rm /etc/nginx/sites-enabled/bot.example.org /etc/nginx/sites-available/bot.example.org

Fedora:

sudo rm /etc/nginx/conf.d/bot.example.org.conf
sudo setsebool -P httpd_can_network_connect 0

Then, on both:

sudo nginx -t && sudo systemctl reload nginx
sudo certbot delete --cert-name bot.example.org

Only turn the SELinux setting off again if nothing else on the machine needs nginx to connect to other services. Remove the DNS record for the host name too.

5. The build tools and the source (optional)

rm -rf ~/PolarSystems
rustup self uninstall

rustup self uninstall removes Rust and everything in ~/.cargo and ~/.rustup. The packages from Install, step 3 can stay or be removed with your package manager.

6. Discord

In the Developer Portal you can delete the application, which also removes the bot from every server it is in and invalidates its token and client secret. Do this after step 1, or the running bot would stop with an error first.