{"id":49094086,"url":"https://github.com/leonyx007/bonkbot-js","last_synced_at":"2026-04-20T19:35:26.067Z","repository":{"id":340425428,"uuid":"1019518879","full_name":"leonyx007/bonkbot-js","owner":"leonyx007","description":"Automates buy/sell actions, monitors on-chain activity, and reacts to market signals in real time.","archived":false,"fork":false,"pushed_at":"2025-07-14T13:00:41.000Z","size":50,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-02-24T23:40:36.896Z","etag":null,"topics":["bonkfun","bot","defi","solana"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/leonyx007.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-07-14T13:00:02.000Z","updated_at":"2025-08-10T06:19:10.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/leonyx007/bonkbot-js","commit_stats":null,"previous_names":["leonyx007/bonkbot-js"],"tags_count":null,"template":false,"template_full_name":null,"purl":"pkg:github/leonyx007/bonkbot-js","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonyx007%2Fbonkbot-js","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonyx007%2Fbonkbot-js/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonyx007%2Fbonkbot-js/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonyx007%2Fbonkbot-js/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/leonyx007","download_url":"https://codeload.github.com/leonyx007/bonkbot-js/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/leonyx007%2Fbonkbot-js/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32062780,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-20T11:35:06.609Z","status":"ssl_error","status_checked_at":"2026-04-20T11:34:48.899Z","response_time":94,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["bonkfun","bot","defi","solana"],"created_at":"2026-04-20T19:35:19.919Z","updated_at":"2026-04-20T19:35:26.051Z","avatar_url":"https://github.com/leonyx007.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# BonkBot.js\n\nBonkBot is a JavaScript library for creating bots for the web game [Bonk.io](https://bonk.io). It provides an easy way to create custom bots that can automate various actions within the game. With BonkBot, you can interact with the game's websocket protocol easily, chat with other players, and perform actions such as joining and leaving rooms.\n\n\n## Features\n\n- Connect to existing rooms or create new ones\n- Automatically determine the optimal server using the game's API\n- Send and receive chat messages\n- Track players joining and leaving\n- Manage teams and game settings\n- Handle game events\n- Comprehensive error handling\n- Detailed logging\n\n# Support\n[Discord Server](https://discord.gg/USJQjwD7AY)\n\n## Basic Usage\n\n```javascript\nconst { createBot, LOG_LEVELS } = require('bonkbot');\n\n// Create a bot instance\nconst bot = createBot({\n  account: {\n    username: 'BotName',\n    guest: true,  // Use guest account\n  },\n  logLevel: LOG_LEVELS.WARN, // Set log level (DEBUG, INFO, WARN, ERROR, NONE)\n});\n\n// Initialize and handle events\nbot.events.on('ready', async () =\u003e {\n  await bot.connect();\n});\n\n// Handle chat messages\nbot.events.on('CHAT_MESSAGE', (message) =\u003e {\n  console.log(`${message.player.username}: ${message.message}`);\n  \n  // Respond to !ping command\n  if (message.message === '!ping') {\n    bot.chat('Pong!');\n  }\n});\n\nbot.events.on('PACKET', (packet) =\u003e {\n  bot.autoHandlePacket(packet);\n});\n\nbot.init();\n```\n\n\n## Authentication Examples\n\n### Automatic Server Detection\n\nBy default, BonkBot will automatically determine the optimal server to connect to by querying the game's API. This ensures your bot connects to the most appropriate server based on the current game infrastructure.\n\nIf you want to override this behavior and connect to a specific server, you can provide the `server` option when creating the bot:\n\n```javascript\nconst bot = createBot({\n  // ... other options\n  server: 'b2ny1'  // Force connection to a specific server\n});\n```\n\n### Guest Account\n\n```javascript\nconst bot = createBot({\n  account: {\n    username: 'BotName',\n    guest: true\n  },\n  logLevel: LOG_LEVELS.WARN\n});\n```\n\n### User Account\n\n```javascript\nconst bot = createBot({\n  account: {\n    username: 'YourUsername',\n    password: 'YourPassword',\n    guest: false\n  },\n  logLevel: LOG_LEVELS.WARN\n});\n```\n\n## Connection Flow and Examples\n\nThe connection flow typically follows this sequence:\n1. Bot initialization (`bot.init()`)\n2. Ready event fires when login completes\n3. Connect to game server (`bot.connect()`)\n4. Find or create room\n5. Join room or create room\n6. Handle game events\n\n### Joining a Room by Name\n\n```javascript\nbot.events.on('ready', async () =\u003e {\n  try {\n    // Find room by name\n    const roomInfo = await bot.getAddressFromRoomName(\"roomName\");\n    console.log(`Found room: ${roomInfo.roomname}`);\n    \n    // Set address and connect\n    bot.setAddress(roomInfo);\n    await bot.connect();\n    \n    // Join with optional password\n    await bot.joinRoom({\n      password: \"optional-password\"\n    });\n  } catch (error) {\n    console.error(\"Failed to join room:\", error);\n  }\n});\n```\n\n### Joining a Room by Link\n\n```javascript\nbot.events.on('ready', async () =\u003e {\n  try {\n    // Get room info from share link\n    const roomInfo = await bot.getAddressFromUrl(\"https://bonk.io/123abc\");\n    console.log(`Found room: ${roomInfo.roomname}`);\n    \n    // Connect to room\n    bot.setAddress(roomInfo);\n    await bot.connect();\n    await bot.joinRoom();\n  } catch (error) {\n    console.error(\"Failed to join room:\", error);\n  }\n});\n```\n\n### Creating a Room\n\n```javascript\nbot.events.on('ready', async () =\u003e {\n  try {\n    // Connect to server first\n    await bot.connect();\n    \n    // Then create room\n    bot.createRoom({\n      roomname: \"BonkBot Room\",\n      maxplayers: 10,\n      roompassword: \"\",\n      hidden: true\n    });\n  } catch (error) {\n    console.error(\"Failed to create room:\", error);\n  }\n});\n\n// Get share link when room is created\nbot.events.on('ROOM_SHARE_LINK', (data) =\u003e {\n  console.log(`Room created! URL: ${data.url}`);\n});\n```\n\n## Available Events\n\n| Event | Description | Returns |\n|-------|-------------|---------|\n| `ready` | Bot is ready to connect | - |\n| `connect` | Connected to server | - |\n| `PACKET` | Any packet received | `{type, ...data}` |\n| `JOIN` | Joined a room | `{game, room, players}` |\n| `PLAYER_JOIN` | Player joined room | `{player, id}` |\n| `PLAYER_LEAVE` | Player left room | `{player, id}` |\n| `CHAT_MESSAGE` | Chat message received | `{player, message}` |\n| `TEAM_CHANGE` | Player changed team | `{player, team}` |\n| `HOST_TRANSFER` | Host was transferred | `{oldHost, newHost}` |\n| `READY_CHANGE` | Player ready status changed | `{player, ready}` |\n| `GAME_START` | Game started | - |\n| `GAME_END` | Game ended | - |\n| `COUNTDOWN` | Game countdown | `{countdown}` |\n| `MAP_SWITCH` | Map was switched | `{map}` |\n| `MAP_SUGGEST` | Map was suggested | `{title, author, player}` |\n| `CHANGE_ROUNDS` | Round count changed | `{rounds}` |\n| `GAMEMODE_CHANGE` | Game mode changed | `{mode, engine}` |\n| `ROOM_SHARE_LINK` | Room link created | `{url}` |\n| `PLAYER_KICK` | Player was kicked | `player` |\n| `PLAYER_TABBED` | Player tabbed in/out | `{player, tabbed}` |\n| `PLAYER_INPUT` | Player input received | `{player, movement}` |\n| `TEAMLOCK_TOGGLE` | Teams locked/unlocked | `{teamsLocked}` |\n| `ROOM_NAME_UPDATE` | Room name changed | `{name}` |\n| `ROOM_ADDRESS` | Room address updated | `{address}` |\n| `BALANCE_SET` | Player balance changed | `{player, balance}` |\n| `disconnect` | Disconnected from server | - |\n\n## Common Methods\n\n```javascript\n// Chat message\nbot.chat(\"Hello world\");\n\n// Get all players\nconst players = bot.getAllPlayers();\n\n// Get host\nconst host = bot.getHost();\n\n// Get room share link\nconst shareLink = bot.getShareLink();\n\n// Set player ready status\nbot.ready(true);\n\n// Join a team (0-5)\nbot.joinTeam(2); // 0=spectator, 1=FFA, 2=red, 3=blue...\n\n// Give host to player\nbot.giveHost(playerId);\n\n// Kick a player\nbot.kickPlayer(playerId);\n\n// Leave the room\nbot.leaveGame();\n```\n\n\n## Examples\n\nCheck out the `examples` directory for more examples:\n\n- `simple-bot.js`: A basic bot that connects to a room and responds to chat commands\n- `host-bot.js`: A bot that creates and hosts a room\n\n## Contributing\n\nContributions are always welcome! If you find a bug or have a feature request, please open an issue on the project's GitHub page.\n\n## License\n\nBonkBot is open-source software licensed under the [GPL-3.0 License](https://www.gnu.org/licenses/gpl-3.0.en.html).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleonyx007%2Fbonkbot-js","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fleonyx007%2Fbonkbot-js","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fleonyx007%2Fbonkbot-js/lists"}