Package: ai-dungeon-cli
AI Dungeon CLIThis is basically a cli client toplay.aidungeon.io.This allows playing AI Dungeon 2 inside a terminal.I primarily did this to play the game on a DEC VT320 hardware terminal for a morefaithfulexperience.For more context, read theaccompanying blog post.Installationpip$ python3 -m pip install ai-dungeon-cliOr for unstable release from the source code:$ python3 -m pip install .Arch LinuxPackage is onAUR.Usingtrizen:$ trizen -S ai-dungeon-cli-gitOld school way:$ git clone https://aur.archlinux.org/ai-dungeon-cli-git.git
$ cd ai-dungeon-cli-git
$ makepkg -siPlayingUnless specified, all user inputs are consideredDoactions.Quoted input entries are automatically interpreted asSayactions, e.g.:> "Hey dragon! You didn't invite me to the latest BBQ party!"Do be explicit about the action type, prefix your input with a command:/do/say/story/rememberFor example, the previousSayprompt could also be written:> /say Hey dragon! You didn't invite me to the latest BBQ party!To quit, either pressCtrl-C,Ctrl-Dor type in the special/quitcommand.RunningIn any case, you first need to create a configuration file.Installed$ ai-dungeon-cliFrom sourceWith a conda env (assuming you're usinganaconda):$ cd ai-dungeon-cli
$ conda env create
$ conda activate ai-dungeon-cli-env
$ ./ai_dungeon_cli/__init__.pyWith a viltualenv:$ cd ai-dungeon-cli
$ virtualenv -p $(command -v python3) ai-dungeon-cli-venv
$ source ai-dungeon-cli-venv/bin/activate
$ python3 -m pip install -r requirements.txt
$ ./ai_dungeon_cli/__init__.pyPlease note that all those examples use a virtual env in order to not mess up with the main Python env on your system.Configuration (optional)Several things can be tuned by resorting to a config file.Create a fileconfig.ymleither:in the same folder in your home folder:$HOME/.config/ai-dungeon-cli/config.ymlin the same folder as the sources:./ai-dungeon-cli/ai_dungeon_cli/config.ymlAuthenticationBy default, if no authentication configuration is provided, an anonymous session is created.ai-dungeon-cli supports 2 ways to configure user authentication.Either precise a couple of credentials in conf:email:'<MY-USER-EMAIL>'password:'<MY-USER-PASSWORD>'Or sniff aAuthentication Tokenand use it directly:auth_token:'<MY-AUTH-TOKEN>'To get this token, you need to first login in a web browser toplay.aidungeon.io.Then you can find the token either in your browserlocalStorageor in the content of theconnection_initmessage of the websocket communication (first sent message).Either way, developer tools (F12) is your friend.Slow Typing AnimationBy default, responses are printed to the screen instantly.To enable a fun "slow" typing animation, use:slow_typing_effect:TruePromptThe default user prompt is'> '.You can customize it with e.g. :prompt:'me:'Command-line argumentsAll configuration options are mapped to command-line arguments.Additionally, some features (such as multi-player support) are only available through those arguments.The list of all arguments can be retrieved by callingai-dungeon-cliwith either-hof--help.AuthenticationOne can use either the--auth-token <token>or--email <email> --password <password>arguments to authenticate.Slow Typing AnimationJust append--slow-typingto your execution call to enable this fancy effect.PromptThe custom prompt can be set with--prompt '<prompt>'.Multi-playerTo join an existing multi-player adventure, use arguments--adventure <public-adventure-id> --name <character-name>.DebugTO enable debug mode and see the responses from the play.aidungeon.io API, use--debug. This option is mainly useful for developers.DependenciesPlease have a look atrequirements.txt.Limitations and future improvementsRight now, the code is over-optimistic: we don't catch cleanly when the backend is down.A better user experience could be achieved with the use of thecurseslibrary.For now/revertand/alterspecial actions are not supported.It would also be nice to add support for browsing other players' stories (Exploremenu).Implementation detailsWe fallback to a pure ASCII version of the splash logo if we detect an incompatible locale / terminal type.SupportAs you might have heard, hosting AI Dungeon costs a lot of money.This cli client relies on the same infrastructure as the online version (play.aidungeon.io).So don't hesitate tohelp support the hosting feesto keep the game up and running.AuthorJordan Besly@p3r7(blog).Contributors & acknowledgementsMajor contributions:Idan Gur@idangur: OOP rewrite of game logicAlberto Oporto Ames@otreblan: packaging, submission to AUR@jgb95: slow typing effectAlexander Batyrgariev@sasha00123: help on porting to new websocket/gql-based version of the APIMinor contributions:Robert Davis@bdavs: pip requirements@Jezza: suggested login using credsCode for slow typing effect inspired bythis messagefromMagnus Lyckaon thePython Tutor mailing list.Similar projectssasha00123/ai-dungeon-bot, a bot for Telegram & VK, written in pythonSoptikHa2/aidungeon2-cli, written in Rust (unmaintained)