Termbot

A fully fledged terminal emulator in a Discord chat.

Features

  • Session management
  • Interactive mode
  • Autosubmit mode
  • Execution of a single command
  • Macros
  • TUI friendly
  • Color! Experimental, uses ANSI escape codes. Can easily reach Discord’s 2000 character limit. Use it wisely.

Installation and launch

Make sure you have Go 1.18 or later installed.

git clone https://github.com/polyzium/termbot
cd termbot
go run .

Be sure to configure your instance before running the bot.

Usage

User settings are managed via slash commands. Terminal input is being done via the prefix (unless interactive mode is enabled). The bot accepts shortcut sequences for keys. See the list below.

Shortcuts

Input Key name
\n Linefeed
\r Carriage Return (Enter)
\b Backspace
\t Tab
[ESC] Escape
[F1] F1
[F2] F2
[F3] F3
[F4] F4
[F5] F5
[F6] F6
[F7] F7
[F8] F8
[F9] F9
[F10] F10
[F11] F11
[F12] F12
[UP] Up Arrow
[DOWN] Down Arrow
[RIGHT] Right Arrow
[LEFT] Left Arrow
[INS] Insert
[DEL] Delete
[PGUP] Page Up
[PGDN] Page Down
^[key] CTRL + key (i.e. ^C = CTRL+C, etc)

Configuration

The configuration values are located in the config.yaml file. The keys should be pretty self explanatory.

Example:

token: YOUR_TOKEN_HERE
prefix: $
ownerid: "YOUR_USERID_HERE"
macros:
    - name: example
      in: Here's an example macro.
      whitelist: false
      allowedids: []
userprefs:
    "552930095141224479":
        defaultsharedusers:
            - "216836179415269376"
        color: false
        interactive: true
        autosubmit: true

Made with <3 using

DiscordGo pty for Go vt10x

License

Licensed under GPLv3. See LICENSE for more details.

Thanks to

anic17 for testing ZackeryRSmith for suggestions

GitHub

View Github