Skip to content

A Discord BOT that supports connecting, gaming, and remote computer management via Discord. Currently, it only supports Linux.

License

Notifications You must be signed in to change notification settings

Serena1432/Katheryne

Repository files navigation

Katheryne

Katheryne is a work-in-progress Discord BOT designed for remote gameplay, computer management, and connectivity via Discord.

Currently, it only supports Linux, with both X11 and Wayland compatibility. KDE Plasma is recommended since it's my development environment.

Table of Contents

Disclaimer

This BOT prioritizes simplicity and convenience over security and is intended for personal or small-scale use (e.g., providing a "cloud computer" for friends or remotely managing your own device). It is not suitable for large public servers, as I cannot guarantee security at scale.

Only grant permissions to trusted individuals. USE THIS PROGRAM AT YOUR OWN RISK. I am not responsible for any damage resulting from its use.

Purpose

I originally created this BOT in 2023 to let my friends easily connect to my computer and use features remotely without relying on traditional remote control applications. It also allows me to manage my own computer while away.

The initial implementation worked well, but I lost the original code recently. To prevent this from happening again, I decided to rebuild it and make it open-source.

Support

Katheryne works best with KDE Plasma 6 on Linux but is compatible with any distribution using X11 or Wayland.

Intel CPUs + NVIDIA GPUs are also recommended. I haven't tested AMD CPUs/GPUs, so be prepared for potential issues.

Supported Remote Play Applications

✅ Steam Link / Remote Play (official support)
⚠️ Moonlight and other tools can be launched via remote execution but are not officially supported—you have to run the commands manually.
❌ Parsec is not supported (no Linux hosting support).

Features

These features can be used directly in a Discord server, provided you have the required permissions:

  • Run whitelisted applications remotely using commands/built-in integrations
  • Take screenshots and monitor system stats
  • Auto-send in-game screenshots to a Discord channel
  • Lock the physical keyboard/mouse to prevent interference (I made that as my kids usually interrupt gameplay when my friends are playing)
  • Turn off the physical display and mute audio (for the same reason as above)
  • Send notifications (on-screen messages) to the computer from Discord
  • Refocus the game window if it minimizes unexpectedly
  • Remotely shut down the computer (only if the owner is away or explicitly allows it)
  • Remotely execute any commands on the computer (for BOT owner only)
  • Notify when the computer isn't plugged in, the battery is low, temperature is high or a driver error, requiring physical intervention
  • Check the connection between the user and computer through Steam Remote Play (experimental, may not work on some devices)

Note: Any changes with computer settings (physical input lock, brightness, volume, etc.) will be back to normal after restarting the computer. So if you encounter any errors when using the BOT, you just need to restart the computer.

Commands coverage

Feature X11 Wayland Intel NVIDIA
Take screenshots
View computer stats 🔴
Lock/disable physical input 🔴
Change screen brightness 🔴 🔴 🔴
Mute the host audio
Refocus the game window
Remotely shutdown the computer 🔴 🔴
Set the fan speed 🔴 🔴
Set the CPU governor 🔴 🔴 🔴
Check the running process

✅ Fully supported without root permissions
🔴 Supported but requires root permissions
⭕ Supported but not tested
❌ Totally not supported
❓ Not related

Currently, AMD CPUs/GPUs are not properly supported as I don't have any AMD computers.

To protect privacy, some features will only be available when a whitelisted game/application is running.

Running root commands

To run commands that require root permissions, you can do one of these ways below:

  • Grant the permissions for specific commands used by the BOT (recommended)
  • Running the BOT with sudo permissions
    • Using this way may cause some unexpected errors, proceed at your own risk.
    • Steam and some games will have some glitches, and tends to have a higher ping when Katheryne is running as root (idk why but it's what it is)
  • Or don't use these commands at all

List of root commands

This is the list of commands requiring root permissions:

  • Intel GPU stats:
    intel_gpu_top
  • Set display brightness:
    brightnessctl set ${pc}%
  • Set CPU governor:
    echo "${governor}" | tee /sys/devices/system/cpu/cpu*/cpufreq/scaling_governor
  • Set fan speed:
    nbfc set -s ${pc}
  • Physical input locking (Wayland):
    evtest --grab /dev/input/event${id} >/dev/null
  • Physical input device listing (Wayland):
    libinput list-devices

For security reasons, you have to find a way to allow these commands for your user by yourself.

Required applications

General

  • brightnessctl (for brightness control)
  • scrot (for X11 screenshot)
  • wmctrl (for X11 window focusing)
  • nbfc-linux (for fan control)
  • libinput-tools (for input devices management)
  • evtest (for Wayland physical input locking)
  • rfkill (for enabling/disabling Bluetooth)

Taking screenshots in Wayland

  • gnome-screenshot (for GNOME-based desktop environments)
  • spectacle (for KDE Plasma)
  • grim (for other desktop environments)

Intel GPUs

  • intel-gpu-tools

Usage

Installation

git clone https://github.com/Serena1432/Katheryne.git
  • Change the current directory to the source folder:
cd Katheryne
  • Install all the dependencies:
npm install
  • Install all required applications listed in the Required applications section above, depends on your distro and your need.

Configuration

  • Copy the .env file to a new one and rename it to .env, then edit the file and specify the token with the TOKEN variable.

  • Copy the config.sample folder into a new one, and rename it to config. After that, config the BOT yourself to your liking based on the instructions below.

You can view the example of all configurations in the config.sample folder.

config/main.json

Contains the main BOT configuration.

Property Type Description
language string BOT language. Make sure that strings/${language}.json exists in the BOT folder.
owner_id string BOT owner's Discord ID.
prefix string BOT prefix for message content based commands.
whitelist string[] List of Discord ID allowed to use the BOT.

config/computer.json

Contains the computer configuration.

Property Type Description
close_processes string[] List of processes to be closed upon starting an application.
start_processes string[] List of processes to be started after exitting applications.
auto_mute boolean Automatically mute the physical speakers upon starting.
auto_bluetooth_off boolean Automatically turn off Bluetooth upon starting.
auto_performance_governor boolean Automatically set the CPU govenor to performance upon starting.
auto_max_fan_speed boolean Automatically set the fan speed to maximum upon starting.
auto_lock_input boolean Automatically lock the physical inputs upon starting.
evtest_on_x11 boolean Use evtest instead of xinput --disable to lock the physical input on X11. This way is more stable than xinput but it will require root access.
lock_timer boolean If true, the BOT will rerun the physical input lock/set brightness commands each 10 seconds to further prevent external interference.

config/steam.json

Contains the Steam configuration.

Property Type Description
default_user string Default Steam user to be logged in when using the steam command. Leave empty to manually select the user upon starting.
wayland_enable_pipewire boolean Enable PipeWire screen capture when connecting to Steam Remote Play on Wayland.
detach boolean If true, Steam will keep running even when the BOT stops working.

config/whitelisted_apps.json

Contains a list of whitelisted apps for all users to run anytime they want.

Is a JSON array containing objects with these properties:

Property Type Description
process string Process name (will be used to detect if the app is running or not)
name string Display name to be displayed in the BOT status and statistics
alias string Shortened alias for members to use with the start command
command string Command to be executed after using the start command
screenshot string In-game screenshot folder to be monitored. Leave empty if not supported.
channel string Discord channel ID for in-game screenshots. Unused if screenshot isn't set.

config/logging.json

Contains the logging configuration.

Property Type Description
log_channel string Discord channel ID to receive logs. Leave empty if you don't want logging.
steam_connection string Whether to send a log when there's a new Steam Remote Play connection.
high_temperature string Whether to send a log when the computer temperature is high.
low_battery string Whether to send a log when the computer battery is low.

Starting

Running Katheryne as normal user

npm start

Enable further debugging

You can enable further debugging logs that contain all of the command the BOT uses to run by running one of these commands below instead of npm start. Remember that further debugging can output some personal information, and you should be cautious when running it in public.

This is also required when reporting an issue related to the BOT.

For writing the logs directly to the console window, run this command:

npm run debug

For writing the logs to journal (useful for debugging serious crashes):

npm run debug_journal

Running Katheryne as root (not recommended)

sudo -E npm start

Autostart

You can of course use your Desktop Environment's Autostart settings (or .config/autostart) to start Katheryne automatically after boot.

pm2 is not recommended in my opinion due to it invoking the BOT before starting the DE, so it may cause some unwanted issues.

Known issues

I'm not a skilled Linux expert, so issues are unable to avoid. These are the known issues that I've experienced myself, and I'm not sure if these also work for you.

Computer crashes after starting game while BOT is running

Try setting high_temperature in config/logging.json to false to disable high temperature warning. This logging may cause crashes on some devices and requires a force restart.

Game crashes when locking/unlocking physical inputs on X11

The xinput commands used on X11 can be unstable on some devices, therefore it crashes the game when executing.

Try setting evtest_on_x11 in config/computer.json to let the lock/unlock commands use evtest instead of xinput. It's more stable but it will require root permissions.

License

This BOT is licensed under the MIT License. You are free to use, modify, and distribute it, including for commercial purposes.

About

A Discord BOT that supports connecting, gaming, and remote computer management via Discord. Currently, it only supports Linux.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published