Execute in the developer console after you load into the server with your player. Tested with Chrome.
Development was done on a modified version of BrowserQuest that fixed some dependency issues in the original version.
It works by hooking the game's tick function and extracting out the Game class to the global level. To understand how this works, check out https://attilathedud.me/accessing-requirejs-modules-for-debugging/
From the Game class we can call
Game.makePlayerAttack(enemy_entity) which triggers the client to create an attack link and start sending attack packets up to the server. It also sends the necessary movement packets. We use an event driven model to make the bot continue to acquire targets.
Code be viewed here.