PC Slower Than It Used to Be?
A free scan shows the junk files, broken settings and background clutter dragging Windows down - then fixes them in one click.Free scan · Windows 10 & 11Crashes, No Sound, or Screen Glitches?
Random freezes, missing sound and display glitches usually trace back to one bad driver. Find and replace yours safely.Free scan · under a minuteYou can keep a Python Discord bot online continuously on a Linux VPS by combining four pieces: a Discord application and bot token, a Python virtual environment, a bot process built with discord.py, and a systemd service that starts and restarts it. This guide takes you from an empty VPS to a tested bot running under its own Linux account, with secrets outside your source code and logs available through journalctl.
Antihost offers Linux VPS plans with full root access, unlimited traffic on a 1 Gbps port and a 14-day free trial.
What you are building
A Discord bot has two sides. Discord hosts your application registration, bot identity, permissions and Gateway access. Your VPS runs a Python process that authenticates with the bot token and maintains a secure WebSocket connection to Discord’s Gateway. Events such as messages, reactions or member changes arrive over that connection; your code decides whether to respond.
As an Amazon Associate I earn from qualifying purchases.
Recommended Free Tools
Because the Gateway connection belongs to a live process, a bot is not a static website that runs only when someone opens a page. The VPS must keep the Python process alive, provide outbound network access and start it again after a reboot or an unexpected crash. systemd supplies that repeatable boot, restart and logging path.
Prerequisites and design decisions
- A Discord account with permission to create an application and install it in a test server.
- A Linux VPS with SSH access, a public network connection and enough disk space for Python, your virtual environment and logs.
- Python 3.8 or newer. The
discord.pydocumentation states that it works with Python 3.8 or higher. - Basic shell familiarity, including
sudo, file ownership and service management. - A private development or test Discord server. Discord recommends testing in a non-production server before inviting the bot into a live community.
A small event-driven bot normally needs modest CPU and memory, but there is no universal resource number. Voice processing, large caches, database clients, image manipulation and the number of servers or events can change the requirement substantially. Begin with a small VPS, watch memory and CPU, and resize only when your workload demonstrates a need.
#1 Best Overall
- BLUE LIGHT BLOCKING GLASSES: Our blue light glasses for women boast UV400 protection, blocking harmful blue rays from computer screens. With these bluelight glasses women, you can enjoy gaming, reading, or watching TV with no worries of eye strain.
- EYE RELIEF: Our blue light glasses are engineered to reduce blurry vision or strain caused by prolonged screen time. These womens blue light glasses aid in better sleep by preventing blue light from disrupting your natural sleep cycle, helping you fall asleep faster and enjoy a more restful night's sleep, making them the perfect christmas present.
- COMFORTABLE: Crafted from durable material, our trendy blue light glasses for woman or blue light glasses men ensure long-lasting comfort. The high-transmittance lenses accessories, gamer gifts for men, help keep your eyes relaxed. Perfect stocking stuffers, gifts for gamers men, christmas gifts for men, halloween costumes.
- LIGHTWEIGHT: These clear blue light glasses feature a lightweight frame, meaning they’ll stay comfy for long-term wear. Perfect as blue blockers glasses for women or mens blue light glasses, these non-prescription fake glasses for men can be worn throughout the day. The blue light blocking glasses women feature polycarbonate HD lenses, which are anti-reflective and restore true color.
- WORRY-FREE PURCHASE: If you experience any issues, our support team is ready to assist you quickly. These are the perfect costume glasses for cosplay dressing up.
Create the Discord application and bot
Register the application
- Open the Discord Developer Portal and create a new application.
- Open the application’s Bot page and add the bot user if the portal has not already done so.
- Generate or reset the token, copy it immediately into a password manager or another secret store, and do not put it in chat, screenshots, source code or version control.
Discord describes the token as the credential that authorizes API requests and carries the permissions of your app. Treat it like a password: anyone who obtains it can operate the bot within its granted permissions. If it is exposed, reset it in the Developer Portal and update the VPS environment file before restarting the service.
Choose only the permissions and scopes you need
When installing the bot, select the bot installation scope and grant only the server permissions required by the features you actually implement. A read-only utility does not need moderation or administrator access. Reducing permissions limits the damage from a coding mistake or a compromised token.
Quick wins for a faster PC:
Clear out junk files and repair common Windows errorsFree Scan →Scan for outdated or missing drivers - takes under a minuteDriver Scan →Install the bot in a private test server first. Confirm that its role appears with the intended permissions, then move to a production server after commands and events work as expected.
Prepare the Linux VPS
Create a dedicated service account
Do not run a bot as root. Create an unprivileged account and a directory owned by that account. The exact administrative username varies by distribution; the following commands assume an Ubuntu or Debian-style VPS and an existing administrator who can use sudo.
sudo adduser --system --group --home /opt/discord-bot discordbot
sudo mkdir -p /opt/discord-bot
sudo chown -R discordbot:discordbot /opt/discord-bot
Keep SSH administration separate from the service account. Use key-based SSH authentication, apply security updates, and configure the VPS firewall so that SSH is available from your administration path while unnecessary inbound ports remain closed. A typical Discord bot only needs outbound HTTPS and WebSocket connections; it does not need a publicly reachable web port unless you add a dashboard or webhook listener.
Install Python and create an isolated environment
Install the distribution’s supported Python 3 package, its virtual-environment module and build tools as needed. Check the actual interpreter before proceeding:
Do these 3 things before closing this tab:
1Fix the driver behind crashes, sound loss and screen glitches2Repair Windows errors before they cause bigger problems3Scan for outdated or missing drivers - takes under a minuteRank #2
- WINDEX GAMING WIPES: effortlessly clean all your gaming gear and gaming electronics in one easy step with our new Windex Gaming Wipes
- AMMONIA FREE: our ammonia-free formula is safe to use on all of your favorite gaming equipment like consoles, headsets, controllers, screens, keyboards, and more
- PRE-MOISTENED WIPES: each wipe instantly removes dust, dirt, and stubborn smudges and fingerprints leaving a streak-free shine
- ANTI-STATIC: great for cleaning and wiping down your gaming gear and electronics leaving behind no visible residue
- COMPACT RESEALABLE PACKAGE: store your pack of Windex Gaming Wipes anywhere in your home for whenever a quick and easy wipedown is needed
python3 --version
The output must show version 3.8 or newer. Then create the virtual environment as the service account:
sudo -u discordbot python3 -m venv /opt/discord-bot/.venv
sudo -u discordbot /opt/discord-bot/.venv/bin/python -m pip install --upgrade pip
sudo -u discordbot /opt/discord-bot/.venv/bin/python -m pip install -U discord.py
The documented installation form is python3 -m pip install -U discord.py; using the virtual environment’s interpreter explicitly prevents the package from being installed into the system Python by accident.
If you plan to use voice features, install the additional Linux development libraries required by the relevant audio dependencies. The discord.py documentation specifically identifies packages such as libffi, libnacl and python3-dev. Package names differ between distributions, so use your distribution’s package manager and verify the voice extension imports before deployment.
Write a minimal Python bot
Create /opt/discord-bot/bot.py as the discordbot user. This minimal example logs in, reports readiness and responds to a !ping command:
What’s actually slowing this PC down?
Pick the symptom - the matching free tool is one click away.
import os
import discord
from discord.ext import commands
intents = discord.Intents.default()
# Enable only when the feature requires it and it is enabled in the portal:
# intents.message_content = True
bot = commands.Bot(command_prefix="!", intents=intents)
@bot.event
async def on_ready():
print(f"Logged in as {bot.user}")
@bot.command()
async def ping(ctx):
await ctx.send("pong")
bot.run(os.environ["DISCORD_TOKEN"])
The code deliberately reads the token from an environment variable. There is no fallback string in the source, so a missing secret causes a clear startup error instead of silently running with an accidental value.
Understand intents before adding features
Intents tell Discord which categories of Gateway events your bot wants to receive. They must match in two places:
Rank #3
- Ergonomic & Adjustable Design: Fight "text neck" and improve your posture. Designed for comfort, it offers an adjustable height (7.1in-8.5in) (1.4in adjustable range) and angle (5°-85°) Please note: cell phone stand is only 9 inches tall—the length of a standard pencil
- Without blocking subtitles Perfect for office desk Tiktok Face Time Zoom video—this is the ultimate kitchen desk essential for phones! Perfect viewing experience while reducing neck back strain, A must-have for gamers streamers desk, and anyone who values both style and support!
- Sleek & Stable Design fits Otterbox Case: Say goodbye to bent cables, tangles, and tip-overs! LISEN’s stylish adjustable desk phone holder features a built-in charging hole and smart cable management, keeping your phone secure and your workspace clutter-free cool gadgets for men
- ANTI-SLIP DESIGN free hands: The under 10.00 items easy gadgets back and the bottom of this kitchen essentials for women are fully covered by anti-skid silicone, which LISEN stand up desk decor can provide maximum protection device from any scratches and slides
- Your Perfect Viewing Companion:If your product arrives damaged or breaks within 365 days, reach out to LISEN for a quick and hassle-free solution. Struggling with assembly, like tightening the screw? We’ve got your back! Your experience matters to us. (Product including: phone Holder stand*1, screw*1, hexagon screwdriver*1, specification*1)
- Developer Portal: open the bot’s settings and enable each privileged intent your application needs.
- Python: set the corresponding attribute on the
discord.Intentsobject before constructing the client or command bot.
For example, commands that inspect ordinary message text generally require the message-content intent:
intents = discord.Intents.default()
intents.message_content = True
bot = commands.Bot(command_prefix="!", intents=intents)
Enable that line only when the feature requires it, and enable the same privileged intent in the portal. If one side is enabled and the other is not, the bot may connect successfully while receiving none of the events your command handler needs.
Discord’s current Gateway documentation says applications serving fewer than 10,000 unique users can access privileged intents by enabling them in the Developer Portal. Larger applications may need review or approval. The threshold refers to Discord’s documented unique-user figure, not the number of commands in your code.
Test locally or directly on the VPS
Before involving systemd, prove that the interpreter, package and token work. Create a temporary environment variable in the shell or use a protected local method; do not paste the token into a command that will be saved in shell history.
export DISCORD_TOKEN='paste-the-token-only-in-your-protected-shell'
cd /opt/discord-bot
/opt/discord-bot/.venv/bin/python bot.py
A successful startup prints a line such as Logged in as BotName. In the test server, send !ping in a channel the bot can read and send to. You should receive pong. Stop the process with Ctrl+C after confirming the Gateway connection and at least one event covered by your selected intents.
If the bot is not yet installed in the server, use the application’s installation flow in the Developer Portal, select the test server and approve the requested scopes and permissions. A valid token alone does not add the bot to any server.
Free tools Windows power users keep installed
One-click scans. No signup required.
Rank #4
- Easy Installation: Our gaming lights have been designed to enhance your entertainment experience. Simply position the led light bar next to your TV or game console to create a game room environment with ease. They come with USB power and a 60 inch cord for direct mounting and mobility
- Audio Syncing & Extensive Mode: The built-in high-sensitivity music sensor allows you to sync the TV led lights to your favorite music. Lights react and move to the beat of music, film and game audio, creating an incredible immersive sound and light experience – and all without the need for an additional hub. You can choose from 64+ patterns, including strobe, illusion, jump, energy, gradient, running, chasing, fluttering mode etc. Each mode can be applied to different scenes
- 64+ Chasing IC+RGB & W Effect: The independent control design of IC+RGB and white all-in-one multifunctional rgbw led bar lights monitor backlight allows you to easily switch the led lights for desk between IC+RGB and white to enjoy a variety of lighting effects, you can choose white lighting mode with high brightness for better illumination when working, etc. Choose IC+RGB lighting mode when you need to create an entertaining atmosphere for the light show, 16 million colours of Color changing rgb light bar let you dance to the beat and create a dynamic party atmosphere
- Dynamic and Dimmable Lights: 1%-full brightness free brightness adjustment gives you the flexibility to adjust dimmable led light bar for room decorations or a variety of occasions
- USB Powered: USB light bars for room can be powered by powernank, usb charger, TV, Monitor, laptop PC mainframe, making behind TV led lighting bar easy to install in any location.TV led lights are powered by the TV usb interface / PC mainframe, can be turned on/off synchronously with TV / PC
Store the token outside the source tree
Create a root-owned environment file that contains only the variable needed by the service:
sudo sh -c 'umask 077 && printf "%sn" "DISCORD_TOKEN=your-token" > /etc/discord-bot.env'
sudo chown root:discordbot /etc/discord-bot.env
sudo chmod 640 /etc/discord-bot.env
The service account must be able to read the file, while ordinary users should not. Check the resulting permissions with ls -l /etc/discord-bot.env; never print the file’s contents into a support ticket or terminal recording. Keep the environment file out of Git, backups accessible to untrusted users and world-readable directories. If your VPS has a dedicated secret manager, it can replace this file, but the service still needs a secure way to receive the value at startup.
Run the bot continuously with systemd
Create the unit
Save the following as /etc/systemd/system/discord-bot.service:
The Tool Desk
Outbyte PC Repair FREEClear out junk files and repair common Windows errorsFree Scan →Outbyte Driver Updater FREEScan for outdated or missing drivers - takes under a minuteDriver Scan →[Unit]
Description=Discord Python bot
After=network-online.target
Wants=network-online.target
[Service]
Type=simple
User=discordbot
WorkingDirectory=/opt/discord-bot
EnvironmentFile=/etc/discord-bot.env
ExecStart=/opt/discord-bot/.venv/bin/python /opt/discord-bot/bot.py
Restart=on-failure
RestartSec=5
[Install]
WantedBy=multi-user.target
After=network-online.target delays startup until the system considers networking available. User prevents the bot from running as root. Absolute paths remove ambiguity about which Python interpreter and script are being launched. Restart=on-failure brings the process back after a crash, while the five-second delay avoids a tight restart loop when a configuration error is persistent.
Load, start and inspect the service
sudo systemctl daemon-reload
sudo systemctl enable --now discord-bot
sudo systemctl status discord-bot
sudo journalctl -u discord-bot -f
enable --now both starts the service immediately and enables it for future boots. The journal follows the bot’s standard output and error streams, so the on_ready message and Python tracebacks appear without a separate log file. Press Ctrl+C to leave the live log view; it does not stop the service.
After editing the unit, run sudo systemctl daemon-reload and restart it. After changing only the environment file, a restart is also required because services receive environment variables at process start:
Best Value
- Compatible with Wide Screens - To ensure compatibility with the dual monitor mount, your each monitor must meet three conditions at the same time: First, computer screens size range: 13 to 32 inches. Second, screen weight range: 4.4 to 19.8 lbs. Third, the back of the monitor screen must have VESA mounting holes with a pitch of 75x75mm or 100x100mm.
- Regarding the compatibility with desks - Your desk must meet three conditions at the same time: First, desk material: Only wooden desks are recommended, plastic or glass desks cannot be used. Second, desk thickness range: 0.59" - 3.54". Third, the bottom of the desk should not have any cross beams or panels, as this will interfere with installation. We recommend carefully checking that your desk and monitors meets all above conditions before purchasing.
- Dual C-Clamp Hold - Worried your dual monitors might wobble or slip? Our upgraded base uses a larger platform plus a dual C-clamp structure to lock the dual monitor arm firmly to your desk. Each arm safely keeps your screens steady while you type, click and game—no shaking, no sliding, just a clean and secure setup you can trust every day. It also provides Grommet Mounting installation choice, both options ensure stable and secure fixation for your 0.59" - 3.54" desk.
- Full-Motion Adjustment For Comfortable View - Pull the screen closer when you’re deep in a spreadsheet, push it back to watch videos, or rotate to portrait for coding — moving everything smoothly with just one hand. The monitor stand offers +85°/-50° tilt, ±90° swivel and 360° rotation. Raise your monitor up to 15.75″ to support a healthy sitting posture. Whether you’re working from home, gaming through the night, or switching between video calls and documents, getting the screens to your natural line of sight helps relieve neck, shoulder and back strain so you can stay focused longer with less fatigue.
- Keep Your Desk Organized: By lifting both screens off the desktop, this dual monitor stand opens up valuable space for your keyboard, notebook, docking station or a simple, clutter-free work area. Built-in cable management guides wires along the arms, keeping cords out of sight and out of the way. Enjoy a tidy, modern workstation that looks as good as it feels to use.
sudo systemctl restart discord-bot
sudo systemctl is-active discord-bot
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Verify the production installation
- Process:
systemctl is-active discord-botreturnsactive. - Identity: the journal shows a successful login as the expected bot account.
- Gateway behavior: the bot appears online in the test server and responds to a command or event that matches the enabled intents.
- Permissions: the bot can read the test channel and send a response, but has no unrelated elevated permissions.
- Reboot recovery: after a planned reboot, confirm that the service starts automatically and reconnects.
- Failure recovery: stop the process or introduce a controlled test failure, then confirm that
Restart=on-failureproduces a new process and a useful journal entry.
Move to a production server only after these checks pass. Keep a separate test server for future intent, permission and library changes.
Operate and update the bot safely
Read logs before changing code
Use a bounded journal query when diagnosing a historical incident:
sudo journalctl -u discord-bot --since "30 minutes ago" --no-pager
Look for the first traceback, not only the final restart message. A missing module, malformed environment file, invalid token or syntax error is usually visible in the earliest failure.
Deploy a code change
- Copy the reviewed source files into
/opt/discord-botand preserve ownership fordiscordbot. - Install or upgrade dependencies using the virtual environment’s interpreter, ideally from a pinned requirements file for repeatable deployments.
- Run a syntax or import check before restarting, for example
/opt/discord-bot/.venv/bin/python -m py_compile /opt/discord-bot/bot.py. - Restart the service and watch
journalctl -u discord-bot -funtil it logs in. - Exercise one command or event in the test server before promoting the change.
Do not replace the virtual environment’s Python with a system upgrade while the bot is running. Schedule interpreter or operating-system updates, keep a rollback copy of the previous code and verify the service after every maintenance reboot.
Troubleshoot the common failure modes
| Symptom | Likely cause | What to check |
|---|---|---|
| The service exits immediately | Python exception, missing package, invalid path or missing token | Run sudo journalctl -u discord-bot -n 100 --no-pager; run the exact ExecStart command as discordbot; confirm the virtual-environment path and environment-file permissions. |
| The bot logs in but ignores message commands | Message-content intent is absent or mismatched | Enable the privileged intent in the Developer Portal, set intents.message_content = True in Python, restart the service and verify that the bot can read the channel. |
| The bot is offline after a reboot | The unit was not enabled, or startup failed before networking or token loading | Run systemctl is-enabled discord-bot, then inspect systemctl status and the journal from the current boot. |
| Installation in a server fails | Incorrect OAuth installation scopes or insufficient bot permissions | Repeat the Developer Portal installation flow, select the intended server and grant only the permissions required by the bot’s commands. |
| Voice features fail while text commands work | Missing voice-related Python or Linux libraries | Install the distribution packages required by the voice stack, including the documented libffi, libnacl and python3-dev prerequisites where applicable, then test imports in the virtual environment. |
| The bot repeatedly restarts | A persistent configuration or code error combined with automatic restart | Read the first traceback, stop the service while editing with sudo systemctl stop discord-bot, correct the cause, then start it again. Do not treat rapid restarts as a healthy connection. |
Choose a VPS with the right operating characteristics
For this workflow, the provider’s logo matters less than the operational controls around the virtual machine. Compare candidates on the following axes:
| Decision axis | Why it matters for a Discord bot | Questions to ask |
|---|---|---|
| Uptime and restart controls | The Gateway session requires a continuously running process, and automatic recovery reduces manual intervention. | Can the VPS reboot cleanly, and do you have console access if the machine becomes unreachable? |
| Region and network latency | Closer network locations can reduce round-trip time for interactive commands, although Discord’s own routing also affects latency. | Is a location near most of your community available, and is outbound WebSocket traffic unrestricted? |
| Memory and CPU headroom | Libraries, voice processing, caches and multiple bots can consume more resources than a minimal command bot. | Can you monitor usage and resize without rebuilding the application? |
| SSH, firewall and console access | Secure administration and emergency recovery are essential when a service fails. | Are SSH keys supported, can inbound ports be filtered, and is there an out-of-band console? |
| Backups and snapshots | A snapshot can shorten recovery after an accidental deletion or bad system upgrade, but it may contain secrets. | Can backups be encrypted, restricted and restored to a test machine? |
| Total monthly cost | The cheapest plan may lack memory, reliable storage or support controls; a larger plan is wasteful if monitoring shows minimal usage. | Are bandwidth, IPv4, snapshots and backups charged separately, and does the price recur monthly? |
There is no authoritative one-size-fits-all resource benchmark for discord.py bots. Measure your own process with the VPS’s monitoring tools, especially after adding voice, databases or scheduled jobs.
Security checklist for a long-running bot
- Reset the Discord token immediately if it is exposed; never commit it to version control.
- Keep the token in the protected environment file or a secret manager, separate from source code and deployment archives.
- Run the service as
discordbot, not as root, and give that account write access only where the application needs it. - Grant the smallest practical set of Discord permissions and enable only the intents required by implemented features.
- Restrict SSH with keys and a firewall, apply operating-system security updates, and remove unused services.
- Review journal and backup access because logs or snapshots can reveal operational details or environment data if handled carelessly.
- Test new commands and permission changes in a private server before production deployment.
When a VPS is the right hosting model
A Linux VPS is a good fit when you want full control over the Python version, filesystem, service manager, firewall and deployment process. It also makes it straightforward to run a database or scheduled worker beside the bot. The trade-off is operational responsibility: you must patch the operating system, protect SSH, monitor disk and memory, renew any additional certificates and recover from provider or application failures.
If your bot is only an experiment and can tolerate sleeping or manual starts, a continuously running VPS may be unnecessary. For a bot expected to respond around the clock, however, the Gateway connection and systemd restart policy provide a predictable, transparent operating model.
Quick Recap
Final deployment sequence
- Create the Discord application, bot user and least-privilege installation settings.
- Protect and store the token without placing it in source control.
- Create the unprivileged VPS account and install Python 3.8 or newer.
- Create the virtual environment and install
discord.py. - Write the bot with matching portal and code intents.
- Install it in a private test server and verify one command or event.
- Place
DISCORD_TOKENin the protected environment file. - Create and enable the
systemdunit. - Inspect the journal, test reboot and failure recovery, then promote the bot to production.
Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.




