A simple remote debugger console for Enmity. This connects over a websocket to the iOS Discord app with Enmity installed, so you can execute JavaScript in Discord from the command line.
The prompt interface is Node.js's REPL, extended to send input over the websocket instead of executing JS locally. All commands from Node's REPL are automatically supported, including .editor
and .load
.
Prerequisites:
- git
- Node.js
- pnpm (other package managers should also work)
Run the following commands in the terminal:
git clone https://github.com/colin273/enmity-debug
cd enmity-debug
pnpm i
The debugger's dependencies are minimal and have no dependencies of their own:
ws
for the websocket serveransi-colors
for coloring the output
Run this command in the enmity-debug
folder to start the debugger:
node .
Then connect the Discord app, with Enmity installed, on your iOS device to the debugger. There are two ways to do this:
- Enmity settings: enable "Automatically connect to debug websocket" and fill in the hostname and port number (
local.ip.here:9090
) in the "Debug IP" field. - Run this slash command:
/websocket host:local.ip.here:9090
If everything goes smoothly, you should see a toast in the iOS app that says Connected to the websocket server.
At the same time, the debugger CLI will print Connected to Discord over websocket, starting debug session
. If you get an error, then you need to make sure that both devices are on the same network and can connect to one another.
At this point, you can run JavaScript through the debugger, much like a browser's console. All input executes in Discord, and the debugger displays the output.
If you have the developer version of Enmity, you can connect react-devtools
to Enmity to view the React tree.
- Install
react-devtools
from npm:pnpm add -g react-devtools
- Start the devtools:
react-devtools
- Start and connect this debugger.
- In the debugger, run this JavaScript:
connectToDevTools({ host: "local.ip.here", port: 8097 })
The React tree of the Discord app should now appear in the React devtools window.
Once you have finished debugging and closed the REPL, press Ctrl+C
on your keyboard to quit the CLI.
- enmity-devsocket: A GUI debugger for Enmity, consisting of a browser client and a CLI server.
- debug-ws-server: Aliucord's websocket debugger.
- vdebug: Vendetta's debugger, forked from this project with Vendetta-specific changes.