• Stars
    star
    134
  • Rank 270,967 (Top 6 %)
  • Language
    Python
  • License
    GNU General Publi...
  • Created about 7 years ago
  • Updated about 1 year ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

BashBot is a Discord bot that allows terminal access via chat

BashBot

BashBot is a Discord bot that provides terminal access via chat.

Features

  • Interactive. Works with nano, htop etc
  • Reactions can be used as input keys
  • Open/Close/Select/Freeze terminal sessions
  • Run terminal session as different user

Getting Started

These instructions will get you a bot installed and running quickly

Prerequisites

  • Python 3.5+
  • pyte library (installation instructions below)
  • discord.py library (installation instructions below)

Installing

You can download BashBot.zip from Releases which contains all required dependencies and continue to "Running" section.

or you can continue with manuall installation:

Type following commands to install dependencies:

pip install -r requirements.txt

Running

In order to run bot you have to obtain a bot account. It can be obtained through the applications page. Later you have to transform your app into app bot user

Create a Bot User

then enable "Message Content Intent"

2022-09-08_03-38

After these operations, copy your bot token using the Copy button

And run

python bashbot.py

or if you downloaded BashBot release

python BashBot.zip

Now BashBot should start and show later instructions

Docker

Copy config.toml.example to config.toml file. And in the same directory run following command:

docker run -v $(pwd)/config.toml:/BashBot/config.toml adikso/bashbot

You can add -d to run container in background

docker run -d -v $(pwd)/config.toml:/BashBot/config.toml adikso/bashbot

Now BashBot should start and show later instructions

Commands

(Every command have to start with prefix. By default it's "$". You can change it in settings. More information about commands after typing "$.help")

Command Alias Usage Description
.about - .about Shows information about project
.open .o .open [name] Opens new terminal session
.close .c .close Closes current terminal session
.freeze .f .freeze Freezes current terminal session
.here .h .here Moves selected terminal below the user message
.select .s .select [name] Sets terminal as selected
.controls - .controls add/remove [emoji] [content..] Manages terminal controls
.repeat .r .repeat <string..> Repeats string n times and sends to the current terminal session
.rename - .rename <new_name> Changes session name
.submit - .submit Toggles auto submit mode
.macro .m .macro <macro_name> Executes macro from "macros" directory
.interactive .i .interactive Enables interactive mode where all messages are sent to terminal
.exec .e .exec <command...> Execute single command
.whitelist - .whitelist add/remove <user_tag> Add/Remove user to/from whitelist. Bot owner can execute all commands without being on the whitelist

Shortcuts

Shortcut Description
[UP] Arrow up
[DOWN] Arrow down
[LEFT] Arrow left
[RIGHT] Arrow right
[ESC] Escape
[TAB] or [T] Horizontal tab
[F1]...[F12]
[<] Clears entire input line
\a Bell (BEL)
\b Backspace (BS)
\f Formfeed (FF)
\n Linefeed(Newline) (LF)
\r Carriage Return (CR)
\t Horizontal Tab (TAB)
\v Vertical Tab (VT)
^(key) CTRL + (key)

Built With

  • Discord.py - Discord API wrapper for Python
  • Pyte - VTXXX-compatible terminal emulator

Contributing

Feel free to contribute

Authors

  • Adam Zambrzycki (Adikso)

See also the list of contributors who participated in this project.

License

This project is licensed under the GNU License - see the LICENSE file for details

Acknowledgments

  • Bopke, tomangelo, RhAnjiE for testing